Class PhpAro
Access Request Object
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Controller/Component/Acl/PhpAcl.php
Constants summary
-
string
DEFAULT_ROLE
¶'Role/default'
Properties summary
Method Summary
-
__construct() public
-
addAlias() public
adds one or more aliases to the internal map. Overwrites existing entries. -
addRole() public
adds a new ARO to the tree -
build() public
build an ARO tree structure for internal processing -
resolve() public
resolve an ARO identifier to an internal ARO string using the internal mapping information.
-
roles() public
From the perspective of the given ARO, walk down the tree and collect all inherited AROs levelwise such that AROs from different branches with equal distance to the requested ARO will be collected at the same index. The resulting array will contain a prioritized list of (list of) roles ordered from the most distant AROs to the requested one itself.
Method Detail
__construct() public ¶
__construct( array $aro = array() , array $map = array() , array $aliases = array() )
addAlias() public ¶
addAlias( array $alias )
adds one or more aliases to the internal map. Overwrites existing entries.
Parameters
- array $alias
- alias from => to (e.g. Role/13 -> Role/editor)
addRole() public ¶
addRole( array $aro )
adds a new ARO to the tree
Parameters
- array $aro
- one or more ARO records
build() public ¶
build( array $aros )
build an ARO tree structure for internal processing
Parameters
- array $aros
- array of AROs as key and their inherited AROs as values
resolve() public ¶
resolve( mixed $aro )
resolve an ARO identifier to an internal ARO string using the internal mapping information.
Parameters
- mixed $aro
- ARO identifier (User.jeff, array('User' => ...), etc)
Returns
internal aro string (e.g. User/jeff, Role/default)
roles() public ¶
roles( mixed $aro )
From the perspective of the given ARO, walk down the tree and collect all inherited AROs levelwise such that AROs from different branches with equal distance to the requested ARO will be collected at the same index. The resulting array will contain a prioritized list of (list of) roles ordered from the most distant AROs to the requested one itself.
Parameters
- mixed $aro
- An ARO identifier
Returns
prioritized AROs
Properties detail
$map ¶
map external identifiers. E.g. if
array('User' => array('username' => 'jeff', 'role' => 'editor'))
is passed as an ARO to one of the methods of AclComponent, PhpAcl will check if it can be resolved to an User or a Role defined in the configuration file.
See
array( 'User' => 'User/username', 'Role' => 'User/role', )