PHP Class Acl\Adapter\Utility\PhpAro

Mostra file Open project: cakephp/acl Class Usage Examples

Public Properties

Property Type Description
$aliases array aliases to map
$map array ['Users' => ['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.

Protected Properties

Property Type Description
$_tree array internal ARO representation

Public Methods

Method Description
__construct ( array $aro = [], array $map = [], array $aliases = [] ) Constructor
addAlias ( array $alias ) : void adds one or more aliases to the internal map. Overwrites existing entries.
addRole ( array $aro ) : void adds a new ARO to the tree
build ( array $aros ) : void build an ARO tree structure for internal processing
resolve ( string | array $aro ) : string resolve an ARO identifier to an internal ARO string using the internal mapping information.
roles ( string | array $aro ) : array 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 Details

__construct() public method

Constructor
public __construct ( array $aro = [], array $map = [], array $aliases = [] )
$aro array Aro instance
$map array Map
$aliases array Aliases

addAlias() public method

adds one or more aliases to the internal map. Overwrites existing entries.
public addAlias ( array $alias ) : void
$alias array alias from => to (e.g. Role/13 -> Role/editor)
return void

addRole() public method

adds a new ARO to the tree
public addRole ( array $aro ) : void
$aro array one or more ARO records
return void

build() public method

build an ARO tree structure for internal processing
public build ( array $aros ) : void
$aros array array of AROs as key and their inherited AROs as values
return void

resolve() public method

resolve an ARO identifier to an internal ARO string using the internal mapping information.
public resolve ( string | array $aro ) : string
$aro string | array ARO identifier (Users.jeff, ['Users' => ...], etc)
return string internal aro string (e.g. Users/jeff, Role/default)

roles() public method

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.
public roles ( string | array $aro ) : array
$aro string | array An ARO identifier
return array prioritized AROs

Property Details

$_tree protected_oe property

internal ARO representation
protected array $_tree
return array

$aliases public_oe property

aliases to map
public array $aliases
return array

$map public_oe property

['Users' => ['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.
public array $map
return array