class Rules

Access rules class.

Methods

__construct( mixed $input = '')

Constructor.

array
getData()

Get the data for the action.

void
mergeCollection( mixed $input)

Method to merge a collection of Rules.

void
merge( mixed $actions)

Method to merge actions with this object.

void
mergeAction( string $action, array $identities)

Merges an array of identities for an action.

mixed
allow( string $action, mixed $identity)

Checks that an action can be performed by an identity.

JObject
getAllowed( mixed $identity)

Get the allowed actions for an identity.

string
__toString()

Magic method to convert the object to JSON string representation.

Details

__construct( mixed $input = '')

Constructor.

The input array must be in the form: array('action' => array(-42 => true, 3 => true, 4 => false)) or an equivalent JSON encoded string, or an object where properties are arrays.

Parameters

mixed $input A JSON format string (probably from the database) or a nested array.

array getData()

Get the data for the action.

Return Value

array A named array of Rule objects.

void mergeCollection( mixed $input)

Method to merge a collection of Rules.

Parameters

mixed $input Rule or array of Rules

Return Value

void

void merge( mixed $actions)

Method to merge actions with this object.

Parameters

mixed $actions Rule object, an array of actions or a JSON string array of actions.

Return Value

void

void mergeAction( string $action, array $identities)

Merges an array of identities for an action.

Parameters

string $action The name of the action.
array $identities An array of identities

Return Value

void

mixed allow( string $action, mixed $identity)

Checks that an action can be performed by an identity.

The identity is an integer where +ve represents a user group, and -ve represents a user.

Parameters

string $action The name of the action.
mixed $identity An integer representing the identity, or an array of identities

Return Value

mixed Object or null if there is no information about the action.

JObject getAllowed( mixed $identity)

Get the allowed actions for an identity.

Parameters

mixed $identity An integer representing the identity or an array of identities

Return Value

JObject Allowed actions for the identity or identities

string __toString()

Magic method to convert the object to JSON string representation.

Return Value

string JSON representation of the actions array