Acl
in package
ACL class
Tags
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
- $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
- 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
- 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
$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
AcladdResource()
Add a resource
public
addResource(AclResource $resource) : Acl
Parameters
- $resource : AclResource
Return values
AcladdResources()
Add resources
public
addResources(array<string|int, mixed> $resources) : Acl
Parameters
- $resources : array<string|int, mixed>
Return values
AcladdRole()
Add a role
public
addRole(AclRole $role) : Acl
Parameters
- $role : AclRole
Return values
AcladdRoles()
Add roles
public
addRoles(array<string|int, mixed> $roles) : Acl
Parameters
- $roles : array<string|int, mixed>
Return values
Aclallow()
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
Return values
AclcreateAssertion()
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
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
Return values
AclevaluatePolicies()
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
Return values
bool|nullevaluatePolicy()
Evaluate policy
public
evaluatePolicy(string $method, mixed $role[, mixed $resource = null ]) : bool|null
Parameters
- $method : string
- $role : mixed
- $resource : mixed = null
Tags
Return values
bool|nullgetAssertionKey()
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
Return values
string|nullgetResource()
Get a resource
public
getResource(string $resource) : AclResource|null
Parameters
- $resource : string
Return values
AclResource|nullgetResources()
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|nullgetRoles()
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
Return values
boolhasPolicies()
Has policies
public
hasPolicies() : bool
Return values
boolhasResource()
See if a resource has been added
public
hasResource(string $resource) : bool
Parameters
- $resource : string
Return values
boolhasRole()
See if a role has been added
public
hasRole(string $role) : bool
Parameters
- $role : string
Return values
boolisAllowed()
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
Return values
boolisAllowedMulti()
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
Return values
boolisAllowedMultiStrict()
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
Return values
boolisDenied()
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
Return values
boolisDeniedMulti()
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
Return values
boolisDeniedMultiStrict()
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
Return values
boolisMultiStrict()
See if ACL object is set to multi strict
public
isMultiStrict() : bool
Return values
boolisStrict()
See if ACL object is set to strict
public
isStrict() : bool
Return values
boolremoveAllowRule()
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
Return values
AclremoveDenyRule()
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
Return values
AclsetMultiStrict()
Set multi strict
public
setMultiStrict([bool $multiStrict = true ]) : Acl
Parameters
- $multiStrict : bool = true
Return values
AclsetStrict()
Set strict
public
setStrict([bool $strict = true ][, bool|null $multiStrict = null ]) : Acl
Parameters
- $strict : bool = true
- $multiStrict : bool|null = null
Return values
AclgenerateAssertionKey()
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
stringtraverseChildren()
Traverse child roles to add them to the ACL object
protected
traverseChildren(array<string|int, mixed> $roles) : void
Parameters
- $roles : array<string|int, mixed>
verifyResource()
Verify resource
protected
verifyResource(mixed $resource) : bool
Parameters
- $resource : mixed
Tags
Return values
boolverifyRole()
Verify role
protected
verifyRole(mixed $role) : bool
Parameters
- $role : mixed