Documentation

Acl
in package

ACL class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2021 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
3.4.0

Table of Contents

$allowed  : array<string|int, mixed>
Array of allowed roles, resources and permissions
$assertions  : array<string|int, mixed>
Array of assertions
$denied  : array<string|int, mixed>
Array of denied roles, resources and permissions
$policies  : array<string|int, mixed>
Array of policies
$resources  : array<string|int, mixed>
Array of resources
$roles  : array<string|int, mixed>
Array of roles
__construct()  : mixed
Constructor
addPolicy()  : Acl
Add policy
addResource()  : Acl
Add a resource
addResources()  : Acl
Add resources
addRole()  : Acl
Add a role
addRoles()  : Acl
Add roles
allow()  : Acl
Allow a user role permission to a resource or resources
createAssertion()  : void
Create assertion
deleteAssertion()  : void
Delete assertion
deny()  : Acl
Deny a user role permission to a resource or resources
evaluatePolicies()  : bool|null
Evaluate policies
evaluatePolicy()  : bool
Evaluate policy
getAssertionKey()  : string
Get assertion key
getResource()  : AclResource
Get a resource
getResources()  : array<string|int, mixed>
Get resources
getRole()  : AclRole
Get a role
getRoles()  : array<string|int, mixed>
Get roles
hasAssertionKey()  : bool
Has assertion key
hasPolicies()  : bool
Has policies
hasResource()  : bool
See if a resource has been added
hasRole()  : bool
See if a role has been added
isAllowed()  : bool
Determine if the user is allowed
isAllowedMany()  : bool
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)
isAllowedManyStrict()  : bool
Determine if a user that is assigned many roles is allowed All of the roles must be allowed to allow the user (return true)
isDenied()  : bool
Determine if the user is denied
isDeniedMany()  : bool
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)
isDeniedManyStrict()  : bool
Determine if a user that is assigned many roles is denied All of the roles must be denied to deny the user (return true)
removeAllowRule()  : Acl
Remove an allow rule
removeDenyRule()  : Acl
Remove a deny rule
generateAssertionKey()  : string
Generate assertion key
traverseChildren()  : void
Traverse child roles to add them to the ACL object
verifyResource()  : bool
Verify resource
verifyRole()  : bool
Verify role

Properties

$allowed

Array of allowed roles, resources and permissions

protected array<string|int, mixed> $allowed = []

$assertions

Array of assertions

protected array<string|int, mixed> $assertions = ['allowed' => [], 'denied' => []]

$denied

Array of denied roles, resources and permissions

protected array<string|int, mixed> $denied = []

$policies

Array of policies

protected array<string|int, mixed> $policies = []

$resources

Array of resources

protected array<string|int, mixed> $resources = []

$roles

Array of roles

protected array<string|int, mixed> $roles = []

Methods

__construct()

Constructor

public __construct() : mixed

Instantiate the ACL object

Return values
mixed

addPolicy()

Add policy

public addPolicy(string $method, mixed $role[, mixed $resource = null ]) : Acl
Parameters
$method : string
$role : mixed
$resource : mixed = null
Return values
Acl

addResources()

Add resources

public addResources(array<string|int, mixed> $resources) : Acl
Parameters
$resources : array<string|int, mixed>
Tags
throws
Exception
Return values
Acl

addRoles()

Add roles

public addRoles(array<string|int, mixed> $roles) : Acl
Parameters
$roles : array<string|int, mixed>
Return values
Acl

allow()

Allow a user role permission to a resource or resources

public allow(mixed $role[, mixed $resource = null ][, mixed $permission = null ][, AssertionInterface $assertion = null ]) : Acl
Parameters
$role : mixed
$resource : mixed = null
$permission : mixed = null
$assertion : AssertionInterface = null
Tags
throws
Exception
Return values
Acl

createAssertion()

Create assertion

public createAssertion(AssertionInterface $assertion, string $type, mixed $role[, mixed $resource = null ][, string $permission = null ]) : void
Parameters
$assertion : AssertionInterface
$type : string
$role : mixed
$resource : mixed = null
$permission : string = null
Tags
throws
InvalidArgumentException
Return values
void

deleteAssertion()

Delete assertion

public deleteAssertion(string $type, mixed $role[, mixed $resource = null ][, string $permission = null ]) : void
Parameters
$type : string
$role : mixed
$resource : mixed = null
$permission : string = null
Return values
void

deny()

Deny a user role permission to a resource or resources

public deny(mixed $role[, mixed $resource = null ][, mixed $permission = null ][, AssertionInterface $assertion = null ]) : Acl
Parameters
$role : mixed
$resource : mixed = null
$permission : mixed = null
$assertion : AssertionInterface = null
Tags
throws
Exception
Return values
Acl

evaluatePolicies()

Evaluate policies

public evaluatePolicies([mixed $role = null ][, mixed $resource = null ][, mixed $permission = null ]) : bool|null
Parameters
$role : mixed = null
$resource : mixed = null
$permission : mixed = null
Return values
bool|null

evaluatePolicy()

Evaluate policy

public evaluatePolicy(string $method, mixed $role[, mixed $resource = null ]) : bool
Parameters
$method : string
$role : mixed
$resource : mixed = null
Tags
throws
Exception
Return values
bool

getAssertionKey()

Get assertion key

public getAssertionKey(string $type, mixed $role[, mixed $resource = null ][, string $permission = null ]) : string
Parameters
$type : string
$role : mixed
$resource : mixed = null
$permission : string = null
Tags
throws
InvalidArgumentException
Return values
string

getResource()

Get a resource

public getResource(string $resource) : AclResource
Parameters
$resource : string
Return values
AclResource

getResources()

Get resources

public getResources() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRole()

Get a role

public getRole(string $role) : AclRole
Parameters
$role : string
Return values
AclRole

getRoles()

Get roles

public getRoles() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasAssertionKey()

Has assertion key

public hasAssertionKey(string $type, mixed $role[, mixed $resource = null ][, string $permission = null ]) : bool
Parameters
$type : string
$role : mixed
$resource : mixed = null
$permission : string = null
Tags
throws
InvalidArgumentException
Return values
bool

hasPolicies()

Has policies

public hasPolicies() : bool
Return values
bool

hasResource()

See if a resource has been added

public hasResource(string $resource) : bool
Parameters
$resource : string
Return values
bool

hasRole()

See if a role has been added

public hasRole(string $role) : bool
Parameters
$role : string
Return values
bool

isAllowed()

Determine if the user is allowed

public isAllowed(mixed $role[, mixed $resource = null ][, mixed $permission = null ]) : bool
Parameters
$role : mixed
$resource : mixed = null
$permission : mixed = null
Return values
bool

isAllowedMany()

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)

public isAllowedMany(array<string|int, mixed> $roles[, mixed $resource = null ][, mixed $permission = null ]) : bool
Parameters
$roles : array<string|int, mixed>
$resource : mixed = null
$permission : mixed = null
Tags
throws
Exception
Return values
bool

isAllowedManyStrict()

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

public isAllowedManyStrict(array<string|int, mixed> $roles[, mixed $resource = null ][, mixed $permission = null ]) : bool
Parameters
$roles : array<string|int, mixed>
$resource : mixed = null
$permission : mixed = null
Return values
bool

isDenied()

Determine if the user is denied

public isDenied(mixed $role[, mixed $resource = null ][, mixed $permission = null ]) : bool
Parameters
$role : mixed
$resource : mixed = null
$permission : mixed = null
Tags
throws
Exception
Return values
bool

isDeniedMany()

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)

public isDeniedMany(array<string|int, mixed> $roles[, mixed $resource = null ][, mixed $permission = null ]) : bool
Parameters
$roles : array<string|int, mixed>
$resource : mixed = null
$permission : mixed = null
Tags
throws
Exception
Return values
bool

isDeniedManyStrict()

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

public isDeniedManyStrict(array<string|int, mixed> $roles[, mixed $resource = null ][, mixed $permission = null ]) : bool
Parameters
$roles : array<string|int, mixed>
$resource : mixed = null
$permission : mixed = null
Tags
throws
Exception
Return values
bool

removeAllowRule()

Remove an allow rule

public removeAllowRule(mixed $role[, mixed $resource = null ][, mixed $permission = null ]) : Acl
Parameters
$role : mixed
$resource : mixed = null
$permission : mixed = null
Tags
throws
Exception
Return values
Acl

removeDenyRule()

Remove a deny rule

public removeDenyRule(mixed $role[, mixed $resource = null ][, mixed $permission = null ]) : Acl
Parameters
$role : mixed
$resource : mixed = null
$permission : mixed = null
Tags
throws
Exception
Return values
Acl

generateAssertionKey()

Generate assertion key

protected generateAssertionKey(mixed $role[, mixed $resource = null ][, string $permission = null ]) : string
Parameters
$role : mixed
$resource : mixed = null
$permission : string = null
Return values
string

traverseChildren()

Traverse child roles to add them to the ACL object

protected traverseChildren(array<string|int, mixed> $roles) : void
Parameters
$roles : array<string|int, mixed>
Return values
void

verifyResource()

Verify resource

protected verifyResource(mixed $resource) : bool
Parameters
$resource : mixed
Tags
throws
Exception
Return values
bool

verifyRole()

Verify role

protected verifyRole(mixed $role) : bool
Parameters
$role : mixed
Tags
throws
Exception
Return values
bool

Search results