.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
// Class of the defined type
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access directly to this file");
}
class PluginExampleComputer extends CommonDBTM {
static function showInfo() {
echo '
';
echo '';
echo ''.__('More information').' | ';
echo '
';
echo '';
echo '';
echo __('Test successful');
echo ' | ';
echo '
';
echo '
';
}
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.
}
}
static function add_default_where($in) {
list($itemtype, $condition) = $in;
if ($itemtype == 'Computer') {
$table = getTableForItemType($itemtype);
$condition .= " (".$table.".groups_id NOT IN (".implode(',', $_SESSION["glpigroups"])."))";
}
return [$itemtype, $condition];
}
}