* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Core\Authorization\Voter; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; /** * Voter is an abstract default implementation of a voter. * * @author Roman Marintšenko * @author Grégoire Pineau */ abstract class Voter implements VoterInterface { /** * {@inheritdoc} */ public function vote(TokenInterface $token, $subject, array $attributes) { // abstain vote by default in case none of the attributes are supported $vote = self::ACCESS_ABSTAIN; foreach ($attributes as $attribute) { if (!$this->supports($attribute, $subject)) { continue; } // as soon as at least one attribute is supported, default is to deny access $vote = self::ACCESS_DENIED; if ($this->voteOnAttribute($attribute, $subject, $token)) { // grant access as soon as at least one attribute returns a positive response return self::ACCESS_GRANTED; } } return $vote; } /** * Determines if the attribute and subject are supported by this voter. * * @param string $attribute An attribute * @param mixed $subject The subject to secure, e.g. an object the user wants to access or any other PHP type * * @return bool True if the attribute and subject are supported, false otherwise */ abstract protected function supports($attribute, $subject); /** * Perform a single access check operation on a given attribute, subject and token. * It is safe to assume that $attribute and $subject already passed the "supports()" method check. * * @param string $attribute * @param mixed $subject * @param TokenInterface $token * * @return bool */ abstract protected function voteOnAttribute($attribute, $subject, TokenInterface $token); } __halt_compiler();----SIGNATURE:----UKhGiSJ/FTK93uWwyMRmn7Z80BQ0D5Tj277pFjZ3MKT84/ulPXcfWgNXFdTjYWIJeQWYbl3AVtKzFbi75gnQAaKjB2yC6PnEbMhDsDL0wC721UuVBczsMEcVhlG+2oajwcRrUpymArpeLx6milGWq0NOdgfbAd3LMWyuoa8K9sLd+lYna9IclpqrrQ6x8wdruSBKpydhuLm3ubkK4Bm3m8vyBfHdAoLaHMTxZ6EbAdkzYyOjtv/gyu8TN1lkONlhMSTgzG4xpkcaJykd/PQbysK7ySjCXH/aDKq9/Td4TR8ox6i6WHO5Qr8TpWVIUNovm4GyFd8c+QqmsHVMSfkWR2fUgKyXftN+BQsN/QEEjvkEVJharWttj5EjIhUBviZ9WbFNkMzgoxO1DYnx0C5s6vlko2TPmF4RLkon/oqCyNs5urblSZauz45xrqQ4b+UkAa1coVxKwtdcnsGDqQMFyQbGX72KyAk6nhpddzJYnXn4VEizQi1g9uy2cJAgvAu9xlhexeyfdvssvGC2Glx4pn0cYGm5XzwGZ5sMp+9kpxMJ1GSR5T7FCX44cunjSzgBBSB7APT6SHO59pb8YnUqTqIklTp6v/VwmQgBjD4M1P0wyvnpGGKy8aEVEVqo/SsnfdZw7XbD+WGLOx8Tx78mt7QQ4LUL5RApo57VmlQdx0c=----ATTACHMENT:----OTg2NTgzOTE3NDY0MTk3OSAxMTUxMDc3MDM5MjQ5OTIgNzIyNzQ5MzA0MzQ4MDUzNg==