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.


Constructor summary

Attr. Name / Description
public

RoleSet()

Construct a role set object.

Member summary

Attr. Type Name Description
private int[] $roleIds An array of role ids.

Method summary

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.


Members


				
private int[] $roleIds

An array of role ids.

Inital value: array()


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.

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.

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.
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.

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.

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.

public offsetUnset(int $offset)

Illegal method, necessary for the implementation of the ArrayAccess interface.

Parameters:

Type Name Def. Description
int $offset

Not applicable.


Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013