Properties

$roles

$roles : array

Array of roles

Type

array

$resources

$resources : array

Array of resources

Type

array

$allowed

$allowed : array

Array of allowed roles, resources and permissions

Type

array

$denied

$denied : array

Array of denied roles, resources and permissions

Type

array

$assertions

$assertions : array

Array of assertions

Type

array

$policies

$policies : array

Array of policies

Type

array

Methods

__construct()

__construct() 

Constructor

Instantiate the ACL object

getRole()

getRole(string  $role) : \Pop\Acl\AclRole

Get a role

Parameters

string $role

Returns

\Pop\Acl\AclRole

getRoles()

getRoles() : array

Get roles

Returns

array

hasRole()

hasRole(string  $role) : boolean

See if a role has been added

Parameters

string $role

Returns

boolean

addRoles()

addRoles(array  $roles) : \Pop\Acl\Acl

Add roles

Parameters

array $roles

Returns

\Pop\Acl\Acl

getResource()

getResource(string  $resource) : \Pop\Acl\AclResource

Get a resource

Parameters

string $resource

Returns

\Pop\Acl\AclResource

hasResource()

hasResource(string  $resource) : boolean

See if a resource has been added

Parameters

string $resource

Returns

boolean

getResources()

getResources() : array

Get resources

Returns

array

addResources()

addResources(array  $resources) : \Pop\Acl\Acl

Add resources

Parameters

array $resources

Throws

\Pop\Acl\Exception

Returns

\Pop\Acl\Acl

allow()

allow(mixed  $role, mixed  $resource = null, mixed  $permission = null, \Pop\Acl\Assertion\AssertionInterface  $assertion = null) : \Pop\Acl\Acl

Allow a user role permission to a resource or resources

Parameters

mixed $role
mixed $resource
mixed $permission
\Pop\Acl\Assertion\AssertionInterface $assertion

Throws

\Pop\Acl\Exception

Returns

\Pop\Acl\Acl

removeAllowRule()

removeAllowRule(mixed  $role, mixed  $resource = null, mixed  $permission = null) : \Pop\Acl\Acl

Remove an allow rule

Parameters

mixed $role
mixed $resource
mixed $permission

Throws

\Pop\Acl\Exception

Returns

\Pop\Acl\Acl

deny()

deny(mixed  $role, mixed  $resource = null, mixed  $permission = null, \Pop\Acl\Assertion\AssertionInterface  $assertion = null) : \Pop\Acl\Acl

Deny a user role permission to a resource or resources

Parameters

mixed $role
mixed $resource
mixed $permission
\Pop\Acl\Assertion\AssertionInterface $assertion

Throws

\Pop\Acl\Exception

Returns

\Pop\Acl\Acl

removeDenyRule()

removeDenyRule(mixed  $role, mixed  $resource = null, mixed  $permission = null) : \Pop\Acl\Acl

Remove a deny rule

Parameters

mixed $role
mixed $resource
mixed $permission

Throws

\Pop\Acl\Exception

Returns

\Pop\Acl\Acl

isAllowed()

isAllowed(mixed  $role, mixed  $resource = null, mixed  $permission = null) : boolean

Determine if the user is allowed

Parameters

mixed $role
mixed $resource
mixed $permission

Returns

boolean

isAllowedMany()

isAllowedMany(array  $roles, mixed  $resource = null, mixed  $permission = null) : boolean

Determine if a user that is assigned many roles is allowed If one of the roles is allowed, then the user will be allowed (return true)

Parameters

array $roles
mixed $resource
mixed $permission

Throws

\Pop\Acl\Exception

Returns

boolean

isAllowedManyStrict()

isAllowedManyStrict(array  $roles, mixed  $resource = null, mixed  $permission = null) : boolean

Determine if a user that is assigned many roles is allowed All of the roles must be allowed to allow the user (return true)

Parameters

array $roles
mixed $resource
mixed $permission

Returns

boolean

isDenied()

isDenied(mixed  $role, mixed  $resource = null, mixed  $permission = null) : boolean

Determine if the user is denied

Parameters

mixed $role
mixed $resource
mixed $permission

Throws

\Pop\Acl\Exception

Returns

boolean

isDeniedMany()

isDeniedMany(array  $roles, mixed  $resource = null, mixed  $permission = null) : boolean

Determine if a user that is assigned many roles is denied If one of the roles is denied, then the user will be denied (return true)

Parameters

array $roles
mixed $resource
mixed $permission

Throws

\Pop\Acl\Exception

Returns

boolean

isDeniedManyStrict()

isDeniedManyStrict(array  $roles, mixed  $resource = null, mixed  $permission = null) : boolean

Determine if a user that is assigned many roles is denied All of the roles must be denied to deny the user (return true)

Parameters

array $roles
mixed $resource
mixed $permission

Throws

\Pop\Acl\Exception

Returns

boolean

createAssertion()

createAssertion(\Pop\Acl\Assertion\AssertionInterface  $assertion, string  $type, mixed  $role, mixed  $resource = null, string  $permission = null) : void

Create assertion

Parameters

\Pop\Acl\Assertion\AssertionInterface $assertion
string $type
mixed $role
mixed $resource
string $permission

Throws

\InvalidArgumentException

deleteAssertion()

deleteAssertion(string  $type, mixed  $role, mixed  $resource = null, string  $permission = null) : void

Delete assertion

Parameters

string $type
mixed $role
mixed $resource
string $permission

hasAssertionKey()

hasAssertionKey(string  $type, mixed  $role, mixed  $resource = null, string  $permission = null) : boolean

Has assertion key

Parameters

string $type
mixed $role
mixed $resource
string $permission

Throws

\InvalidArgumentException

Returns

boolean

getAssertionKey()

getAssertionKey(string  $type, mixed  $role, mixed  $resource = null, string  $permission = null) : string

Get assertion key

Parameters

string $type
mixed $role
mixed $resource
string $permission

Throws

\InvalidArgumentException

Returns

string

addPolicy()

addPolicy(string  $method, mixed  $role, mixed  $resource = null) : \Pop\Acl\Acl

Add policy

Parameters

string $method
mixed $role
mixed $resource

Returns

\Pop\Acl\Acl

hasPolicies()

hasPolicies() : boolean

Has policies

Returns

boolean

evaluatePolicies()

evaluatePolicies(mixed  $role = null, mixed  $resource = null, mixed  $permission = null) : boolean|null

Evaluate policies

Parameters

mixed $role
mixed $resource
mixed $permission

Returns

boolean|null

evaluatePolicy()

evaluatePolicy(string  $method, mixed  $role, mixed  $resource = null) : boolean

Evaluate policy

Parameters

string $method
mixed $role
mixed $resource

Throws

\Pop\Acl\Exception

Returns

boolean

verifyRole()

verifyRole(mixed  $role) : boolean

Verify role

Parameters

mixed $role

Throws

\Pop\Acl\Exception

Returns

boolean

verifyResource()

verifyResource(mixed  $resource) : boolean

Verify resource

Parameters

mixed $resource

Throws

\Pop\Acl\Exception

Returns

boolean

generateAssertionKey()

generateAssertionKey(mixed  $role, mixed  $resource = null, string  $permission = null) : string

Generate assertion key

Parameters

mixed $role
mixed $resource
string $permission

Returns

string

traverseChildren()

traverseChildren(array  $roles) : void

Traverse child roles to add them to the ACL object

Parameters

array $roles