コード例 #1
0
ファイル: ezrole_test.php プロジェクト: rmiguel/ezpublish
 /**
  * Unit test for eZRole::fetchIDListByUser()
  **/
 public function testFetchIDListByUser()
 {
     // fetch roles ID for anonymous group
     $roles = eZRole::fetchIDListByUser(array(self::$anonymousGroupID));
     $this->assertType('array', $roles, "The method should have returned an array");
     $this->assertEquals(1, count($roles), "The array should contain one item");
     $this->assertEquals(1, $roles[0], "The returned role ID should be 1 (anonymous role)");
 }
コード例 #2
0
 function roleIDList()
 {
     if (eZINI::instance()->variable('RoleSettings', 'EnableCaching') === 'true') {
         $userCache = $this->getUserCache();
         return $userCache['roles'];
     }
     $groups = $this->attribute('groups');
     $groups[] = $this->attribute('contentobject_id');
     return eZRole::fetchIDListByUser($groups);
 }
コード例 #3
0
ファイル: ezuser.php プロジェクト: runelangseid/ezpublish
 function roleIDList()
 {
     // If the user object is not the currently logged in user we cannot use the session cache
     $useCache = $this->ContentObjectID == eZSession::get('eZUserLoggedInID', self::anonymousId());
     if ($useCache) {
         $userCache = $this->getUserCache();
         return $userCache['roles'];
     }
     $groups = $this->attribute('groups');
     $groups[] = $this->attribute('contentobject_id');
     return eZRole::fetchIDListByUser($groups);
 }