PrincipalVoter
abstract class \
- Extends
- Voter
Base class of voters deciding for a Principal: the one of the request, or the one given to isGrantedForUser(). A request without principal, e.g. of an anonymous visitor, is denied once the voter supports the attribute and subject.
Implement supports() to state which attribute and subject the voter decides, and voteOnPrincipal() to decide. Overriding supportsAttribute() and supportsType() lets the access decision manager skip the voter without calling supports().
Tags
Table of Contents
Methods
- hasRole() : bool
- voteOnAttribute() : bool
- voteOnPrincipal() : bool
Methods
hasRole()
protected
final hasRole(Principal $principal, SecurityRole $role) : bool
Parameters
- $principal : Principal
- $role : SecurityRole
Return values
boolvoteOnAttribute()
protected
final voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token[, Vote|null $vote = null ]) : bool
Parameters
- $attribute : string
- $subject : mixed
- $token : TokenInterface
- $vote : Vote|null = null
Return values
boolvoteOnPrincipal()
protected
abstract voteOnPrincipal(TAttribute $attribute, TSubject $subject, Principal $principal[, Vote|null $vote = null ]) : bool
Parameters
- $attribute : TAttribute
- $subject : TSubject
- $principal : Principal
- $vote : Vote|null = null
-
Collects the reasons of the decision, see Vote::addReason()