Class \Scrivo\RoleSet
A role set is a utilitity object to determine the if a specific item (page, list or asset) is readable.
The role ids of the roles assigned to that item are stored in an array-like structure. The role set provides the methods RoleSet::canRead(\Scrivo\User $user) and RoleSet::checkReadPermission(\Scrivo\User $user) that can be used to check if the specific item is readable.
Implements
Defined in:
RoleSet.php.
Attr. | Name / Description |
---|---|
public |
RoleSet() Construct a role set object. |
Attr. | Type | Name | Description |
---|---|---|---|
private | int[] | $roleIds | An array of role ids. |
Attr. | Type | Name / Description |
---|---|---|
public | boolean |
canRead($user) Test of the given user has read access according to this role set object. |
public | boolean |
canWrite($user) Test of the given user has write access according to this role set object. |
public |
checkReadPermission($user) Test of the given user has read access according to this role set object. |
|
public | boolean |
offsetExists($index) Check if a role id is set at the given index position. |
public | int |
offsetGet($offset) Get the role id at the given index position. |
public |
offsetSet($offset, $value) Add a role id to the role set. |
|
public |
offsetUnset($offset) Illegal method, necessary for the implementation of the ArrayAccess interface. |
Constructor
- public RoleSet()
-
Construct a role set object.
View source: RoleSet.php line 57.
Members
- private int[] $roleIds
-
An array of role ids.
Inital value: array()
View source: RoleSet.php line 52.
Methods
- public boolean canRead(\Scrivo\User $user)
-
Test of the given user has read access according to this role set object.
Parameters:
Type Name Def. Description \Scrivo\User $user The user for which to test read access.
Returns:
boolean Test of the given user has read access according to this role set object.
View source: RoleSet.php line 113.
- public boolean canWrite(\Scrivo\User $user)
-
Test of the given user has write access according to this role set object.
Parameters:
Type Name Def. Description \Scrivo\User $user The user for which to test write access.
Returns:
boolean Test of the given user has write access according to this role set object.
View source: RoleSet.php line 152.
- public checkReadPermission(\Scrivo\User $user)
-
Test of the given user has read access according to this role set object.
Parameters:
Type Name Def. Description \Scrivo\User $user The user for which to test read access.
Throws:
Exception Type Description \Scrivo\ApplicationException if no access was granted. View source: RoleSet.php line 136.
- public boolean offsetExists(int $index)
-
Check if a role id is set at the given index position.
Parameters:
Type Name Def. Description int $index The index position for which to check.
Returns:
boolean Check if a role id is set at the given index position.
View source: RoleSet.php line 79.
- public int offsetGet(int $offset)
-
Get the role id at the given index position.
Parameters:
Type Name Def. Description int $offset The index position for which to get the role id.
Returns:
int Get the role id at the given index position.
View source: RoleSet.php line 101.
- public offsetSet(int $offset, int $value)
-
Add a role id to the role set.
Parameters:
Type Name Def. Description int $offset Not applicable.
int $value A role id to set in the array.
View source: RoleSet.php line 67.
- public offsetUnset(int $offset)
-
Illegal method, necessary for the implementation of the ArrayAccess interface.
Parameters:
Type Name Def. Description int $offset Not applicable.
View source: RoleSet.php line 89.
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013