interface PrivilegeManagerInterface (View source)

Contract for a privilege manager

Methods

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

Details

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