TestingPrivilegeManager
class TestingPrivilegeManager extends PrivilegeManager (View source)
An access decision manager that can be overridden for tests
Properties
protected ObjectManagerInterface | $objectManager | from PrivilegeManager | |
protected Context | $securityContext | from PrivilegeManager | |
protected bool | $allowAccessIfAllAbstain | If set to true access will be granted for objects where all voters abstain from decision. |
from PrivilegeManager |
protected bool | $overrideDecision |
Methods
Returns true, if the given privilege type is granted for the given subject based on the current security context or if set based on the override decision value.
Returns true, if the given privilege type would be granted for the given roles and subject
Returns true if access is granted on the given privilege target in the current security context or if set based on the override decision value.
Returns true if access is granted on the given privilege target in the current security context
No description
Set the decision override
Resets the AccessDecisionManager to behave transparently.
Details
__construct(ObjectManagerInterface $objectManager, Context $securityContext)
No description
bool
isGranted(string $privilegeType, mixed $subject, string $reason = '')
Returns true, if the given privilege type is granted for the given subject based on the current security context or if set based on the override decision value.
bool
isGrantedForRoles(array $roles, string $privilegeType, mixed $subject, string $reason = '')
Returns true, if the given privilege type would be granted for the given roles and subject
bool
isPrivilegeTargetGranted(string $privilegeTargetIdentifier, array $privilegeParameters = [])
Returns true if access is granted on the given privilege target in the current security context or if set based on the override decision value.
bool
isPrivilegeTargetGrantedForRoles(array $roles, string $privilegeTargetIdentifier, array $privilegeParameters = [])
Returns true if access is granted on the given privilege target in the current security context
protected PrivilegePermissionResult
applyPrivilegeToResult(PrivilegePermissionResult $result, PrivilegeInterface $privilege = null)
No description
protected Closure
getPrivilegeByTypeReducer(string $privilegeType)
No description
protected Closure
getPrivilegeSubjectFilter(mixed $subject)
No description
void
setOverrideDecision(bool $overrideDecision)
Set the decision override
void
reset()
Resets the AccessDecisionManager to behave transparently.