Class PhpAro

Access Request Object

Package: Cake\Controller\Component\Acl
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Located at Cake/Controller/Component/Acl/PhpAcl.php

Method Detail

__constructsource public

__construct( array $aro array() , array $map array() , array $aliases array() )

Constructor

Parameters

array $aro optional array()
The aro data
array $map optional array()
The identifier mappings
array $aliases optional array()
The aliases to map.

addAliassource 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)

addRolesource public

addRole( array $aro )

adds a new ARO to the tree

Parameters

array $aro
one or more ARO records

buildsource 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

resolvesource public

resolve( string|array $aro )

resolve an ARO identifier to an internal ARO string using the internal mapping information.

Parameters

string|array $aro
ARO identifier (User.jeff, array('User' => ...), etc)

Returns

string
internal aro string (e.g. User/jeff, Role/default)

rolessource public

roles( string|array $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

string|array $aro
An ARO identifier

Returns

array
prioritized AROs

Constants summary

string DEFAULT_ROLE

role to resolve to when a provided ARO is not listed in the internal tree

'Role/default'

Properties summary

$_treesource

protected array

internal ARO representation

array()

$aliasessource

public array

aliases to map

array()

$mapsource

public array

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

app/Config/acl.php
array(
    'User' => 'User/username',
    'Role' => 'User/role',
)

© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.7/class-PhpAro.html