/** * 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)"); }
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); }
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); }