static function addVisibilityRestrict()
{
$restrict = "`glpi_reminders`.`users_id` = '" . Session::getLoginUserID() . "' ";
if (!Session::haveRight(self::$rightname, READ)) {
return $restrict;
}
// Users
$restrict .= " OR `glpi_reminders_users`.`users_id` = '" . Session::getLoginUserID() . "' ";
// Groups
if (isset($_SESSION["glpigroups"]) && count($_SESSION["glpigroups"])) {
$restrict .= " OR (`glpi_groups_reminders`.`groups_id`\n IN ('" . implode("','", $_SESSION["glpigroups"]) . "')\n AND (`glpi_groups_reminders`.`entities_id` < 0\n " . getEntitiesRestrictRequest("OR", "glpi_groups_reminders", '', '', true) . ")) ";
}
// Profiles
if (isset($_SESSION["glpiactiveprofile"]) && isset($_SESSION["glpiactiveprofile"]['id'])) {
$restrict .= " OR (`glpi_profiles_reminders`.`profiles_id`\n = '" . $_SESSION["glpiactiveprofile"]['id'] . "'\n AND (`glpi_profiles_reminders`.`entities_id` < 0\n " . getEntitiesRestrictRequest("OR", "glpi_profiles_reminders", '', '', true) . ")) ";
}
// Entities
if (isset($_SESSION["glpiactiveentities"]) && count($_SESSION["glpiactiveentities"])) {
// Force complete SQL not summary when access to all entities
$restrict .= getEntitiesRestrictRequest("OR", "glpi_entities_reminders", '', '', true, true);
}
return '(' . $restrict . ')';
}