|
eZ Publish
[4.2]
|
A container for policies in the permission system. More...
Inheritance diagram for eZRole:
Collaboration diagram for eZRole:Public Member Functions | |
| accessArray ($ignoreLimitIdentifier=false) | |
| appendPolicy ($module, $function, $limitations=array()) | |
| assignToUser ($userID, $limitIdent= '', $limitValue= '') | |
| copy () | |
| copyPolicies ($roleID) | |
| createTemporaryVersion () | |
| eZRole ($row=array()) | |
| fetchUserByRole () | |
| fetchUserID () | |
| limitIdentifier () | |
| limitValue () | |
| policyList () | |
| removePolicies ($fromDB=true) | |
| removePolicy ($moduleName, $functionName=false) | |
| removeThis () | |
| removeUserAssignment ($userID) | |
| removeUserAssignmentByID ($id) | |
| revertFromTemporaryVersion () | |
| turnOffCaching () | |
| turnOnCaching () | |
| userRoleID () | |
Static Public Member Functions | |
| static | accessArrayByUserID ($userIDArray) |
| static | cleanupByNode ($node) |
| static | create ($roleName, $version=0) |
| static | createNew () |
| static | definition () |
| static | expireCache () |
| static | fetch ($roleID, $version=0) |
| static | fetchByName ($roleName, $version=0) |
| static | fetchByOffset ($offset, $limit, $asObject=true, $ignoreTemp=false, $ignoreNew=true) |
| static | fetchByUser ($idArray, $recursive=false) |
| Returns the roles matching the given users' eZContentObject ID array. | |
| static | fetchIDListByUser ($idArray) |
| Fetches the list of roles ID matching an array of eZContentObject IDs (either users and/or groups IDs) | |
| static | fetchList ($tempVersions=false) |
| static | fetchRolesByLimitation ($limit_identifier, $limit_value) |
| static | removeRole ($roleID) |
| static | removeTemporary () |
| static | roleCount () |
Public Attributes | |
| $AccessArray | |
| $CachePolicies = true | |
| $Functions | |
| $ID | |
| $LimitIdentifier | |
| $LimitValue | |
| $Modules | |
| $Name | |
| $Policies | |
| $PolicyArray | |
| $Sets | |
| $UserRoleID | |
A container for policies in the permission system.
It consists merely of a name() and has a DB id() and a version() number. The actual permissions are stored in policies and policy values which can be fetched with the method policyList().
To fetch permission access array you can use accessArrayByUserID() and accessArray().
There are multiple ways to fetch a role, directly from an id() with fetch(), by a role name() with fetchByName(), by a given user with fetchByUser() or the whole list with fetchList() and fetchByOffset().
Creating roles is done with create(), after which new policies can be added using appendPolicy().
Remove roles with remove() and its policies with removePolicies().
Definition at line 57 of file ezrole.php.
| eZRole::accessArray | ( | $ | ignoreLimitIdentifier = false | ) |
Fetch access array of current role
Definition at line 626 of file ezrole.php.
Referenced by accessArrayByUserID().
| static eZRole::accessArrayByUserID | ( | $ | userIDArray | ) | [static] |
| user | id |
Definition at line 583 of file ezrole.php.
Referenced by eZUser\generateAccessArray().
| eZRole::appendPolicy | ( | $ | module, |
| $ | function, | ||
| $ | limitations = array() |
||
| ) |
Appends a new policy to the current role and returns it.
| $module | Which module to give access to or true to give access to all modules. |
| $function | Which function to give access to or true to give access to all functions. |
| $limitations | An associative array with limitations and their values, use an empty array for no limitations. |
// Access to content/read $policy1 = $role->appendPolicy( 'content', 'read' ); // Access to content/read in section 1 $policy2 = $role->appendPolicy( 'content', 'read', array( 'Section' => 1 ) ); // Access to content/read for class 2 and 5 $policy3 = $role->appendPolicy( 'content', 'read', array( 'Class' => array( 2, 5 ) ) );
Definition at line 221 of file ezrole.php.
| eZRole::assignToUser | ( | $ | userID, |
| $ | limitIdent = '', |
||
| $ | limitValue = '' |
||
| ) |
Assigns the current role to the given user or user group identified by the id.
Definition at line 695 of file ezrole.php.
| static eZRole::cleanupByNode | ( | $ | node | ) | [static] |
Cleans up policies and role assignments related to node when this node is removed
Definition at line 409 of file ezrole.php.
Referenced by eZContentObjectTreeNode\removeThis().
| eZRole::copy | ( | ) |
Copies this role, stores it and returns it.
Definition at line 141 of file ezrole.php.
| eZRole::copyPolicies | ( | $ | roleID | ) |
Copies all policies for this role and assigns them to the role identified by ID $roleID.
Definition at line 251 of file ezrole.php.
Referenced by copy(), and createTemporaryVersion().
| static eZRole::create | ( | $ | roleName, |
| $ | version = 0 |
||
| ) | [static] |
Creates a new role with the name $roleName and version $version and returns it.
Definition at line 193 of file ezrole.php.
Referenced by eZSiteInstaller\addPoliciesForRole(), appendPolicy(), and eZSiteInstaller\updateRoles().
| static eZRole::createNew | ( | ) | [static] |
Creates a new role with the name 'New role', stores it and returns it.
Definition at line 180 of file ezrole.php.
Referenced by copy(), and createTemporaryVersion().
| eZRole::createTemporaryVersion | ( | ) |
Definition at line 159 of file ezrole.php.
| static eZRole::definition | ( | ) | [static] |
The definition array is an associative array consists of these keys:
asc or desc.Example:
static function definition() { return array( "fields" => array( "id" => "ID", "version" => "Version", "name" => "Name" ), "keys" => array( "id", "version" ), "function_attributes" => array( "current" => "currentVersion", "class_name" => "className" ), "increment_key" => "id", "class_name" => "eZContentClass", "sort" => array( "id" => "asc" ), "name" => "ezcontentclass" ); }
Reimplemented from eZPersistentObject.
Definition at line 76 of file ezrole.php.
Referenced by fetch(), fetchByName(), fetchByOffset(), fetchList(), and eZPolicy\role().
| static eZRole::expireCache | ( | ) | [static] |
Expires all roles, policies and limitations cache.
Definition at line 559 of file ezrole.php.
Referenced by cleanupByNode(), and eZContentObjectTreeNode\move().
| eZRole::eZRole | ( | $ | row = array() | ) |
Constructor
Definition at line 62 of file ezrole.php.
Referenced by create(), createNew(), and fetchByUser().
| static eZRole::fetch | ( | $ | roleID, |
| $ | version = 0 |
||
| ) | [static] |
Fetches the role identified by the role ID $roleID and returns it.
| $version | Which version to fetch, 0 is the published one. Temporary versions get the id of the role. |
Definition at line 855 of file ezrole.php.
Referenced by assignToUser(), cleanupByNode(), fetchRolesByLimitation(), fetchUserByRole(), removeRole(), and revertFromTemporaryVersion().
| static eZRole::fetchByName | ( | $ | roleName, |
| $ | version = 0 |
||
| ) | [static] |
Fetches the role identified by the role name $roleName and returns it.
| $version | Which version to fetch, 0 is the published one and 1 is the temporary. |
Definition at line 870 of file ezrole.php.
Referenced by eZSiteInstaller\addPoliciesForRole(), eZSiteInstaller\assignUserToRole(), eZSiteInstaller\createSiteAccess(), eZSiteInstaller\removePoliciesForRole(), and eZSiteInstaller\updateRoles().
| static eZRole::fetchByOffset | ( | $ | offset, |
| $ | limit, | ||
| $ | asObject = true, |
||
| $ | ignoreTemp = false, |
||
| $ | ignoreNew = true |
||
| ) | [static] |
Definition at line 893 of file ezrole.php.
| static eZRole::fetchByUser | ( | $ | idArray, |
| $ | recursive = false |
||
| ) | [static] |
Returns the roles matching the given users' eZContentObject ID array.
| array | $idArray | Array of eZContentObject IDs, either groups or users |
| bool | $recursive | If true, roles will be looked up for each given object's main node path_array |
Definition at line 491 of file ezrole.php.
Referenced by accessArrayByUserID(), and eZUser\roles().
| static eZRole::fetchIDListByUser | ( | $ | idArray | ) | [static] |
Fetches the list of roles ID matching an array of eZContentObject IDs (either users and/or groups IDs)
| array(eZContentObjectID) | $idArray |
Definition at line 670 of file ezrole.php.
Referenced by eZUser\roleIDList().
| static eZRole::fetchList | ( | $ | tempVersions = false | ) | [static] |
Definition at line 877 of file ezrole.php.
Referenced by removeTemporary().
| static eZRole::fetchRolesByLimitation | ( | $ | limit_identifier, |
| $ | limit_value | ||
| ) | [static] |
Definition at line 824 of file ezrole.php.
Referenced by eZSection\canBeRemoved().
| eZRole::fetchUserByRole | ( | ) |
Definition at line 795 of file ezrole.php.
| eZRole::fetchUserID | ( | ) |
Fetch user id array which have been assigned to this role.
Definition at line 751 of file ezrole.php.
| eZRole::limitIdentifier | ( | ) |
Returns the limit identifier if it is set.
Definition at line 111 of file ezrole.php.
| eZRole::limitValue | ( | ) |
Returns the limit value if it is set.
Definition at line 121 of file ezrole.php.
| eZRole::policyList | ( | ) |
Definition at line 639 of file ezrole.php.
Referenced by removePolicy().
| eZRole::removePolicies | ( | $ | fromDB = true | ) |
Removes the policy object list from this role.
| $fromDB | If true then the policies are removed from database. |
Definition at line 353 of file ezrole.php.
Referenced by revertFromTemporaryVersion().
| eZRole::removePolicy | ( | $ | moduleName, |
| $ | functionName = false |
||
| ) |
Removes the policy object(s) by specified $moduleName and/or $functionName. Removes all policies for module $moduleName if $functionName is false.
| $moduleName | Module name |
| $functionName | function name. Default is false. |
Definition at line 376 of file ezrole.php.
| static eZRole::removeRole | ( | $ | roleID | ) | [static] |
Definition at line 319 of file ezrole.php.
| static eZRole::removeTemporary | ( | ) | [static] |
Removes all temporary roles and roles without policies from the database.
Definition at line 302 of file ezrole.php.
| eZRole::removeThis | ( | ) |
Removes the role, it's policies and any assignments to users/groups.
| $roleID | If this is false then the function is not static and the ID is fetched from $this. |
Definition at line 334 of file ezrole.php.
| eZRole::removeUserAssignment | ( | $ | userID | ) |
Removes the role assignment
Definition at line 766 of file ezrole.php.
| eZRole::removeUserAssignmentByID | ( | $ | id | ) |
Remove ezuser_role by id
| ezuser_role | id |
Definition at line 783 of file ezrole.php.
| eZRole::revertFromTemporaryVersion | ( | ) |
Definition at line 266 of file ezrole.php.
| static eZRole::roleCount | ( | ) | [static] |
Definition at line 918 of file ezrole.php.
| eZRole::turnOffCaching | ( | ) |
Sets caching of policies to off for this role.
Definition at line 929 of file ezrole.php.
| eZRole::turnOnCaching | ( | ) |
Sets caching of policies to on for this role.
Definition at line 937 of file ezrole.php.
| eZRole::userRoleID | ( | ) |
Returns the user role ID if it is set.
Definition at line 131 of file ezrole.php.
| eZRole::$AccessArray |
Definition at line 954 of file ezrole.php.
| eZRole::$CachePolicies = true |
Definition at line 955 of file ezrole.php.
| eZRole::$Functions |
Definition at line 947 of file ezrole.php.
| eZRole::$ID |
Definition at line 944 of file ezrole.php.
| eZRole::$LimitIdentifier |
Definition at line 949 of file ezrole.php.
| eZRole::$LimitValue |
Definition at line 948 of file ezrole.php.
| eZRole::$Modules |
Definition at line 946 of file ezrole.php.
| eZRole::$Name |
Definition at line 945 of file ezrole.php.
| eZRole::$Policies |
Definition at line 953 of file ezrole.php.
| eZRole::$PolicyArray |
Definition at line 951 of file ezrole.php.
| eZRole::$Sets |
Definition at line 952 of file ezrole.php.
| eZRole::$UserRoleID |
Definition at line 950 of file ezrole.php.