Rules

Access rules class.

since

2.5.0

Methods

__construct

Constructor.

__construct(mixed $input = '') 

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.

since

1.7.0

Arguments

$input

mixedA JSON format string (probably from the database) or a nested array.

__toString

Magic method to convert the object to JSON string representation.

__toString() : string
since

1.7.0

Response

stringJSON representation of the actions array

allow

Checks that an action can be performed by an identity.

allow(string $action, mixed $identity) : mixed

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

since

1.7.0

Arguments

$action

stringThe name of the action.

$identity

mixedAn integer representing the identity, or an array of identities

Response

mixedObject or null if there is no information about the action.

getAllowed

Get the allowed actions for an identity.

getAllowed(mixed $identity) : \JObject
since

1.7.0

Arguments

$identity

mixedAn integer representing the identity or an array of identities

Response

\JObjectAllowed actions for the identity or identities

getData

Get the data for the action.

getData() : array
since

1.7.0

Response

arrayA named array of Rule objects.

merge

Method to merge actions with this object.

merge(mixed $actions) : void
since

1.7.0

Arguments

$actions

mixedRule object, an array of actions or a JSON string array of actions.

mergeAction

Merges an array of identities for an action.

mergeAction(string $action, array $identities) : void
since

1.7.0

Arguments

$action

stringThe name of the action.

$identities

arrayAn array of identities

mergeCollection

Method to merge a collection of Rules.

mergeCollection(mixed $input) : void
since

1.7.0

Arguments

$input

mixedRule or array of Rules

Properties

data

A named array.

since

1.7.0

Type(s)

array