Documentation

Acl
in package

ACL class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

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

license

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

version
4.0.0

Table of Contents

Properties

$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
$multiStrict  : bool
Multi strict flag
$parentStrict  : bool
Parent strict flag
$policies  : array<string|int, mixed>
Array of policies
$resources  : array<string|int, mixed>
Array of resources
$roles  : array<string|int, mixed>
Array of roles
$strict  : bool
Strict flag

Methods

__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 role permission to a resource or resources
createAssertion()  : void
Create assertion
deleteAssertion()  : void
Delete assertion
deny()  : Acl
Deny a role permission to a resource or resources
evaluatePolicies()  : bool|null
Evaluate policies
evaluatePolicy()  : bool|null
Evaluate policy
getAssertionKey()  : string|null
Get assertion key
getResource()  : AclResource|null
Get a resource
getResources()  : array<string|int, mixed>
Get resources
getRole()  : AclRole|null
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 role is allowed
isAllowedMulti()  : bool
Determine if multiple roles are allowed
isAllowedMultiStrict()  : bool
Determine if multiple roles are allowed using the strict parameter All of the roles must be allowed to return true, otherwise it will return false
isDenied()  : bool
Determine if a role is denied
isDeniedMulti()  : bool
Determine if multiple roles are denied
isDeniedMultiStrict()  : bool
Determine if multiple roles are denied using the strict parameter All of the roles must be denied to return true, otherwise it will return false
isMultiStrict()  : bool
See if ACL object is set to multi strict
isParentStrict()  : bool
See if ACL object is set to parent strict
isStrict()  : bool
See if ACL object is set to strict
removeAllowRule()  : Acl
Remove an allow rule
removeDenyRule()  : Acl
Remove a deny rule
setMultiStrict()  : Acl
Set multi strict
setParentStrict()  : Acl
Set parent strict
setStrict()  : Acl
Set strict
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 = []

$multiStrict

Multi strict flag

protected bool $multiStrict = false

$parentStrict

Parent strict flag

protected bool $parentStrict = false

$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 = []

$strict

Strict flag

protected bool $strict = false

Methods

__construct()

Constructor

public __construct() : mixed

Instantiate the ACL object

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>
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 role permission to a resource or resources

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

createAssertion()

Create assertion

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

deleteAssertion()

Delete assertion

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

deny()

Deny a role permission to a resource or resources

public deny(mixed $role[, mixed $resource = null ][, mixed $permission = null ][, AssertionInterface|null $assertion = null ]) : Acl
Parameters
$role : mixed
$resource : mixed = null
$permission : mixed = null
$assertion : AssertionInterface|null = 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
Tags
throws
Exception
Return values
bool|null

evaluatePolicy()

Evaluate policy

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

getAssertionKey()

Get assertion key

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

getResource()

Get a resource

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

getResources()

Get resources

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

getRole()

Get a role

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

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|null $permission = null ]) : bool
Parameters
$type : string
$role : mixed
$resource : mixed = null
$permission : string|null = 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 role is allowed

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

isAllowedMulti()

Determine if multiple roles are allowed

public isAllowedMulti(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

isAllowedMultiStrict()

Determine if multiple roles are allowed using the strict parameter All of the roles must be allowed to return true, otherwise it will return false

public isAllowedMultiStrict(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

isDenied()

Determine if a role 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

isDeniedMulti()

Determine if multiple roles are denied

public isDeniedMulti(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

isDeniedMultiStrict()

Determine if multiple roles are denied using the strict parameter All of the roles must be denied to return true, otherwise it will return false

public isDeniedMultiStrict(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

isMultiStrict()

See if ACL object is set to multi strict

public isMultiStrict() : bool
Return values
bool

isParentStrict()

See if ACL object is set to parent strict

public isParentStrict() : bool
Return values
bool

isStrict()

See if ACL object is set to strict

public isStrict() : bool
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

setMultiStrict()

Set multi strict

public setMultiStrict([bool $multiStrict = true ]) : Acl
Parameters
$multiStrict : bool = true
Return values
Acl

setParentStrict()

Set parent strict

public setParentStrict([bool $parentStrict = true ]) : Acl
Parameters
$parentStrict : bool = true
Return values
Acl

setStrict()

Set strict

public setStrict([bool $strict = true ][, bool|null $multiStrict = null ]) : Acl
Parameters
$strict : bool = true
$multiStrict : bool|null = null
Return values
Acl

generateAssertionKey()

Generate assertion key

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

traverseChildren()

Traverse child roles to add them to the ACL object

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

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

        
On this page

Search results