SecurityVoter
extends Voter
in package
Voter is an abstract default implementation of a voter.
Table of Contents
Properties
Methods
- __construct() : mixed
- supportsAttribute() : bool
- Return false if your voter doesn't support the given attribute. Symfony will cache that decision and won't call your voter again for that attribute.
- supportsType() : bool
- Return false if your voter doesn't support the given subject type. Symfony will cache that decision and won't call your voter again for that subject type.
- vote() : int
- Returns the vote for the given parameters.
- supports() : bool
- Determines if the attribute and subject are supported by this voter.
- voteOnAttribute() : bool
- Perform a single access check operation on a given attribute, subject and token.
- voteOnExecuteActionPermission() : bool
- voteOnExitImpersonationPermission() : bool
- voteOnViewEntityPermission() : bool
- voteOnViewMenuItemPermission() : bool
- voteOnViewPropertyPermission() : bool
Properties
$adminContextProvider
private
AdminContextProvider
$adminContextProvider
$authorizationChecker
private
AuthorizationCheckerInterface
$authorizationChecker
Methods
__construct()
public
__construct(AuthorizationCheckerInterface $authorizationChecker, AdminContextProvider $adminContextProvider) : mixed
Parameters
- $authorizationChecker : AuthorizationCheckerInterface
- $adminContextProvider : AdminContextProvider
supportsAttribute()
Return false if your voter doesn't support the given attribute. Symfony will cache that decision and won't call your voter again for that attribute.
public
supportsAttribute(string $attribute) : bool
Parameters
- $attribute : string
Return values
boolsupportsType()
Return false if your voter doesn't support the given subject type. Symfony will cache that decision and won't call your voter again for that subject type.
public
supportsType(string $subjectType) : bool
Parameters
- $subjectType : string
-
The type of the subject inferred by
get_class()
orget_debug_type()
Return values
boolvote()
Returns the vote for the given parameters.
public
vote(TokenInterface $token, mixed $subject, array<string|int, mixed> $attributes) : int
Parameters
- $token : TokenInterface
- $subject : mixed
-
The subject to secure
- $attributes : array<string|int, mixed>
-
An array of attributes associated with the method being invoked
Return values
int —either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED
supports()
Determines if the attribute and subject are supported by this voter.
protected
supports(string $permissionName, mixed $subject) : bool
Parameters
- $permissionName : string
- $subject : mixed
-
The subject to secure, e.g. an object the user wants to access or any other PHP type
Return values
boolvoteOnAttribute()
Perform a single access check operation on a given attribute, subject and token.
protected
voteOnAttribute(mixed $permissionName, mixed $subject, TokenInterface $token) : bool
It is safe to assume that $attribute and $subject already passed the "supports()" method check.
Parameters
- $permissionName : mixed
- $subject : mixed
- $token : TokenInterface
Return values
boolvoteOnExecuteActionPermission()
private
voteOnExecuteActionPermission(CrudDto $crudDto, ActionDto|string $actionNameOrDto, EntityDto|null $entityDto) : bool
Parameters
Return values
boolvoteOnExitImpersonationPermission()
private
voteOnExitImpersonationPermission() : bool
Return values
boolvoteOnViewEntityPermission()
private
voteOnViewEntityPermission(EntityDto $entityDto) : bool
Parameters
- $entityDto : EntityDto
Return values
boolvoteOnViewMenuItemPermission()
private
voteOnViewMenuItemPermission(MenuItemDto $menuItemDto) : bool
Parameters
- $menuItemDto : MenuItemDto
Return values
boolvoteOnViewPropertyPermission()
private
voteOnViewPropertyPermission(FieldDto $field) : bool
Parameters
- $field : FieldDto