PHP Class Symfony\Component\Security\Authorization\AccessDecisionManager

Author: Fabien Potencier ([email protected])
Inheritance: implements Symfony\Component\Security\Authorization\AccessDecisionManagerInterface
Mostra file Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Property Type Description
$allowIfAllAbstainDecisions
$allowIfEqualGrantedDeniedDecisions
$strategy
$voters

Public Methods

Method Description
__construct ( array $voters = [], string $strategy = 'affirmative', boolean $allowIfAllAbstainDecisions = false, $allowIfEqualGrantedDeniedDecisions = true ) Constructor.
addVoter ( Symfony\Component\Security\Authorization\Voter\VoterInterface $voter ) Adds a voter.
decide ( Symfony\Component\Security\Authentication\Token\TokenInterface $token, array $attributes, $object = null )
decideConsensus ( Symfony\Component\Security\Authentication\Token\TokenInterface $token, array $attributes, $object = null ) Grants access if there is consensus of granted against denied responses.
decideUnanimous ( Symfony\Component\Security\Authentication\Token\TokenInterface $token, array $attributes, $object = null ) Grants access if only grant (or abstain) votes were received.
getVoters ( ) : Symfony\Component\Security\Authorization\Voter\VoterInterface[] Returns all voters.
setVoters ( array $voters ) Sets voters.
supportsAttribute ( $attribute )
supportsClass ( $class )

Protected Methods

Method Description
decideAffirmative ( Symfony\Component\Security\Authentication\Token\TokenInterface $token, array $attributes, $object = null ) Grants access if any voter returns an affirmative response.

Method Details

__construct() public method

Constructor.
public __construct ( array $voters = [], string $strategy = 'affirmative', boolean $allowIfAllAbstainDecisions = false, $allowIfEqualGrantedDeniedDecisions = true )
$voters array An array of VoterInterface instances
$strategy string The vote strategy
$allowIfAllAbstainDecisions boolean Whether to grant access if all voters abstained or not

addVoter() public method

Adds a voter.
public addVoter ( Symfony\Component\Security\Authorization\Voter\VoterInterface $voter )
$voter Symfony\Component\Security\Authorization\Voter\VoterInterface A VoterInterface instance

decide() public method

public decide ( Symfony\Component\Security\Authentication\Token\TokenInterface $token, array $attributes, $object = null )
$token Symfony\Component\Security\Authentication\Token\TokenInterface
$attributes array

decideAffirmative() protected method

If all voters abstained from voting, the decision will be based on the allowIfAllAbstainDecisions property value (defaults to false).
protected decideAffirmative ( Symfony\Component\Security\Authentication\Token\TokenInterface $token, array $attributes, $object = null )
$token Symfony\Component\Security\Authentication\Token\TokenInterface
$attributes array

decideConsensus() public method

Consensus means majority-rule (ignoring abstains) rather than unanimous agreement (ignoring abstains). If you require unanimity, see UnanimousBased. If there were an equal number of grant and deny votes, the decision will be based on the allowIfEqualGrantedDeniedDecisions property value (defaults to true). If all voters abstained from voting, the decision will be based on the allowIfAllAbstainDecisions property value (defaults to false).
public decideConsensus ( Symfony\Component\Security\Authentication\Token\TokenInterface $token, array $attributes, $object = null )
$token Symfony\Component\Security\Authentication\Token\TokenInterface
$attributes array

decideUnanimous() public method

If all voters abstained from voting, the decision will be based on the allowIfAllAbstainDecisions property value (defaults to false).
public decideUnanimous ( Symfony\Component\Security\Authentication\Token\TokenInterface $token, array $attributes, $object = null )
$token Symfony\Component\Security\Authentication\Token\TokenInterface
$attributes array

getVoters() public method

Returns all voters.
public getVoters ( ) : Symfony\Component\Security\Authorization\Voter\VoterInterface[]
return Symfony\Component\Security\Authorization\Voter\VoterInterface[] $voters An array of VoterInterface instances

setVoters() public method

Sets voters.
public setVoters ( array $voters )
$voters array An array of VoterInterface instances

supportsAttribute() public method

public supportsAttribute ( $attribute )

supportsClass() public method

public supportsClass ( $class )

Property Details

$allowIfAllAbstainDecisions protected_oe property

protected $allowIfAllAbstainDecisions

$allowIfEqualGrantedDeniedDecisions protected_oe property

protected $allowIfEqualGrantedDeniedDecisions

$strategy protected_oe property

protected $strategy

$voters protected_oe property

protected $voters