getUserEntitiesForRight() 정적인 공개 메소드

Get entities for which a user have a right
static public getUserEntitiesForRight ( $user_ID, $right, $is_recursive = true ) : array
$user_ID integer user ID
$right right to check
$is_recursive check also using recursive rights (true by default)
리턴 array of entities ID
예제 #1
0
         $ismine = true;
     } else {
         $entities = Profile_User::getUserEntitiesForRight($user->getID(), Planning::READGROUP);
         $groups = Group_User::getUserGroups($user->getID());
         foreach ($groups as $group) {
             if ($_GET["gID"] == $group['id'] && in_array($group['entities_id'], $entities)) {
                 $ismine = true;
             }
         }
     }
 }
 $canview = false;
 // If not mine check global right
 if (!$ismine) {
     // First check user
     $entities = Profile_User::getUserEntitiesForRight($user->getID(), Planning::READALL);
     if ($_GET["uID"]) {
         $userentities = Profile_User::getUserEntities($user->getID());
         $intersect = array_intersect($entities, $userentities);
         if (count($intersect)) {
             $canview = true;
         }
     }
     // Else check group
     if (!$canview && $_GET['gID']) {
         $group = new Group();
         if ($group->getFromDB($_GET['gID'])) {
             if (in_array($group->getEntityID(), $entities)) {
                 $canview = true;
             }
         }
예제 #2
0
파일: planning.php 프로젝트: gaforeror/glpi
         $ismine = true;
     } else {
         $entities = Profile_User::getUserEntitiesForRight($user->getID(), 'show_group_planning');
         $groups = Group_User::getUserGroups($user->getID());
         foreach ($groups as $group) {
             if ($_GET["gID"] == $group['id'] && in_array($group['entities_id'], $entities)) {
                 $ismine = true;
             }
         }
     }
 }
 $canview = false;
 // If not mine check global right
 if (!$ismine) {
     // First check user
     $entities = Profile_User::getUserEntitiesForRight($user->getID(), 'show_all_planning');
     if ($_GET["uID"]) {
         $userentities = Profile_User::getUserEntities($user->getID());
         $intersect = array_intersect($entities, $userentities);
         if (count($intersect)) {
             $canview = true;
         }
     }
     // Else check group
     if (!$canview && $_GET['gID']) {
         $group = new Group();
         if ($group->getFromDB($_GET['gID'])) {
             if (in_array($group->getEntityID(), $entities)) {
                 $canview = true;
             }
         }