class PrivilegeManager implements PrivilegeManagerInterface (View source)

An access decision voter manager

Properties

protected ObjectManagerInterface $objectManager
protected Context $securityContext
protected bool $allowAccessIfAllAbstain

If set to true access will be granted for objects where all voters abstain from decision.

Methods

__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.

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

bool
isPrivilegeTargetGrantedForRoles(array $roles, string $privilegeTargetIdentifier, array $privilegeParameters = [])

Returns true if access is granted on the given privilege target in the current security context

getPrivilegeByTypeReducer(string $privilegeType)

No description

getPrivilegeSubjectFilter(mixed $subject)

No description

Details

__construct(ObjectManagerInterface $objectManager, Context $securityContext)

No description

Parameters

ObjectManagerInterface $objectManager

The object manager

Context $securityContext

The current security context

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.

Parameters

string $privilegeType

The type of privilege that should be evaluated

mixed $subject

The subject to check privileges for

string $reason

This variable will be filled by a message giving information about the reasons for the result of this method

Return Value

bool

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

Parameters

array $roles

The roles that should be evaluated

string $privilegeType

The type of privilege that should be evaluated

mixed $subject

The subject to check privileges for

string $reason

This variable will be filled by a message giving information about the reasons for the result of this method

Return Value

bool

bool isPrivilegeTargetGranted(string $privilegeTargetIdentifier, array $privilegeParameters = [])

Returns true if access is granted on the given privilege target in the current security context

Parameters

string $privilegeTargetIdentifier

The identifier of the privilege target to decide on

array $privilegeParameters

Optional array of privilege parameters (simple key => value array)

Return Value

bool

true if access is granted, false otherwise

bool isPrivilegeTargetGrantedForRoles(array $roles, string $privilegeTargetIdentifier, array $privilegeParameters = [])

Returns true if access is granted on the given privilege target in the current security context

Parameters

array $roles

The roles that should be evaluated

string $privilegeTargetIdentifier

The identifier of the privilege target to decide on

array $privilegeParameters

Optional array of privilege parameters (simple key => value array)

Return Value

bool

true if access is granted, false otherwise

protected PrivilegePermissionResult applyPrivilegeToResult(PrivilegePermissionResult $result, PrivilegeInterface $privilege = null)

No description

Parameters

PrivilegePermissionResult $result
PrivilegeInterface $privilege

Return Value

PrivilegePermissionResult

protected Closure getPrivilegeByTypeReducer(string $privilegeType)

No description

Parameters

string $privilegeType

Return Value

Closure

protected Closure getPrivilegeSubjectFilter(mixed $subject)

No description

Parameters

mixed $subject

Return Value

Closure