. * ------------------------------------------------------------------------- * @copyright Copyright (C) 2006-2022 by Example plugin team. * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/pluginsGLPI/example * ------------------------------------------------------------------------- */ // ---------------------------------------------------------------------- // Original Author of file: // Purpose of file: // ---------------------------------------------------------------------- namespace GlpiPlugin\Example; use CommonDBTM; class Computer extends CommonDBTM { public static function showInfo() { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
' . __s('More information') . '
'; echo __s('Test successful'); echo '
'; } public static function item_can($item) { if (($item->getType() == 'Computer') && ($item->right == READ) && ($item->fields['groups_id'] > 0) && !in_array($item->fields['groups_id'], $_SESSION['glpigroups'])) { $item->right = 0; // unknown, so denied. } } public static function add_default_where($in) { [$itemtype, $condition] = $in; if ($itemtype == 'Computer') { $table = getTableForItemType($itemtype); $condition .= ' (' . $table . '.groups_id NOT IN (' . implode(',', $_SESSION['glpigroups']) . '))'; } return [$itemtype, $condition]; } }