W3cubDocs

/Symfony 2.7

Symfony\Component\Security\Acl\Voter\AclVoter

class AclVoter implements VoterInterface

This voter can be used as a base class for implementing your own permissions.

Methods

__construct(AclProviderInterface $aclProvider, ObjectIdentityRetrievalStrategyInterface $oidRetrievalStrategy, SecurityIdentityRetrievalStrategyInterface $sidRetrievalStrategy, PermissionMapInterface $permissionMap, LoggerInterface $logger = null, $allowIfObjectIdentityUnavailable = true)
bool supportsAttribute(string $attribute)

Checks if the voter supports the given attribute.

int vote(TokenInterface $token, object|null $object, array $attributes)

Returns the vote for the given parameters.

bool supportsClass(string $class)

You can override this method when writing a voter for a specific domain class.

Details

public __construct(AclProviderInterface $aclProvider, ObjectIdentityRetrievalStrategyInterface $oidRetrievalStrategy, SecurityIdentityRetrievalStrategyInterface $sidRetrievalStrategy, PermissionMapInterface $permissionMap, LoggerInterface $logger = null, $allowIfObjectIdentityUnavailable = true)

Parameters

AclProviderInterface $aclProvider
ObjectIdentityRetrievalStrategyInterface $oidRetrievalStrategy
SecurityIdentityRetrievalStrategyInterface $sidRetrievalStrategy
PermissionMapInterface $permissionMap
LoggerInterface $logger
$allowIfObjectIdentityUnavailable

public bool supportsAttribute(string $attribute)

Checks if the voter supports the given attribute.

Parameters

string $attribute An attribute

Return Value

bool true if this Voter supports the attribute, false otherwise

public int vote(TokenInterface $token, object|null $object, array $attributes)

Returns the vote for the given parameters.

This method must return one of the following constants: ACCESSGRANTED, ACCESSDENIED, or ACCESS_ABSTAIN.

Parameters

TokenInterface $token A TokenInterface instance
object|null $object The object to secure
array $attributes An array of attributes associated with the method being invoked

Return Value

int either ACCESSGRANTED, ACCESSABSTAIN, or ACCESS_DENIED

public bool supportsClass(string $class)

You can override this method when writing a voter for a specific domain class.

Parameters

string $class The class name

Return Value

bool true if this Voter can process the class

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.7/Symfony/Component/Security/Acl/Voter/AclVoter.html