PHP Class li3_access\extensions\adapter\security\access\AuthRbac

Inheritance: extends lithium\core\Object
Datei anzeigen Open project: tmaiaroto/li3_access

Protected Properties

Property Type Description
$_autoConfig array
$_roles mixed null if unset array otherwise with fetched AuthObjects

Public Methods

Method Description
check ( mixed $requester, mixed $params, array $options = [] ) : Array The Rbac adapter will iterate through the rbac data Array.
parseMatch ( mixed $match, mixed $params ) : boolean parseMatch Matches the current request parameters against a set of given parameters.

Protected Methods

Method Description
_accessable ( $resources, $roles, array $options = [] ) : void _hasRole Compares the results from _getRolesByAuth with the array passed to it.
_getRolesByAuth ( mixed $params, array $options = [] ) : array | mixed
_hasRole ( $requesters, $params, array $options = [] )
_isAccessible ( array &$role, $params, array $options ) : boolean Checks if the Role grants access If allow === false => no access If requesters has no role => no access If allows contains closures => return closures return Otherwise => grants access
_parseClosures ( array &$data, object $request, array &$roleOptions = [] ) : boolean _parseClosures Iterates over an array and runs any anonymous functions it finds. Returns true if all of the closures it runs evaluate to true. $match is passed by refference and any closures found are removed from it before the method is complete.
_run ( array &$data, mixed $request = null, array &$options = [] ) : void Itterates over an array and runs any anonymous functions it finds. Returns true if all of the closures it runs evaluate to true. $match is passed by reference and any closures found are removed from it before the method is complete.

Method Details

_accessable() protected method

_hasRole Compares the results from _getRolesByAuth with the array passed to it.
protected _accessable ( $resources, $roles, array $options = [] ) : void
$options array
return void

_getRolesByAuth() protected static method

protected static _getRolesByAuth ( mixed $params, array $options = [] ) : array | mixed
$params mixed The Lithium `Request` object, or an array with at least 'request', and 'params'
$options array
return array | mixed $roles Roles with attached User Models

_hasRole() protected static method

protected static _hasRole ( $requesters, $params, array $options = [] )
$options array

_isAccessible() protected static method

Checks if the Role grants access If allow === false => no access If requesters has no role => no access If allows contains closures => return closures return Otherwise => grants access
protected static _isAccessible ( array &$role, $params, array $options ) : boolean
$role array Array Set of Roles (dereferenced)
$options array An array of additional options for the _getRolesByAuth method.
return boolean $accessable

_parseClosures() protected static method

_parseClosures Iterates over an array and runs any anonymous functions it finds. Returns true if all of the closures it runs evaluate to true. $match is passed by refference and any closures found are removed from it before the method is complete.
protected static _parseClosures ( array &$data, object $request, array &$roleOptions = [] ) : boolean
$data array dereferenced Array
$request object The Lithium `Request` object
$roleOptions array dereferenced Array
return boolean

_run() protected method

Itterates over an array and runs any anonymous functions it finds. Returns true if all of the closures it runs evaluate to true. $match is passed by reference and any closures found are removed from it before the method is complete.
protected _run ( array &$data, mixed $request = null, array &$options = [] ) : void
$data array
$request mixed
$options array
return void

check() public method

The Rbac adapter will iterate through the rbac data Array.
public check ( mixed $requester, mixed $params, array $options = [] ) : Array
$requester mixed The user data array that holds all necessary information about the user requesting access. Or false (because Auth::check() can return false). This is an optional parameter, because we will fetch the users data through Auth seperately.
$params mixed The Lithium `Request` object, or an array with at least 'request', and 'params'
$options array An array of additional options for the _getRolesByAuth method.
return Array An empty array if access is allowed or an array with reasons for denial if denied.

parseMatch() public static method

Can match against a shorthand string (Controller::action) or a full array. If a parameter is provided then it must have an equivilent in the Request objects parmeters in order to validate. * Is also acceptable to match a parameter without a specific value.
public static parseMatch ( mixed $match, mixed $params ) : boolean
$match mixed A set of parameters to validate the request against.
$params mixed The Lithium `Request` object, or an array with at least 'request', and 'params'
return boolean True if a match is found.

Property Details

$_autoConfig protected_oe property

See also: lithium\core\Object::$_autoConfig
protected array $_autoConfig
return array

$_roles protected_oe property

null if unset array otherwise with fetched AuthObjects
protected mixed $_roles
return mixed