* * 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:----UP8W2BVLrFw7G3a4e24MPqBYM+K34iBoCcoU/09qlJZZgX3krB3sPXQTzm8qwRtNERjZSKSDjazLfi/u2GmkbpxKsGLxnFS4+TdZKuajz0M7rtT96//2ere7zi/1rZEoEsj4JD0lrU/TAzVgEvgpw+CbMiSsPT1/euzatmXiys6EDemKGvi33rdg7+c+qxSD/4NlPUKo6ql3oMbj+hEic3cBmW2WiBL74tb6y0yFB9KxwlH2yInNnp4GJEAjKmtklvVP4MdugAvTt4ovJp6ntRUkj2pSSpcKBj1QeJ4buqWQ7DZl7gLZ2JWF7zA4BSDsulg81xmawoOg+59I6gAgjcRZK6ZCx4BongIeDZtf2cmdNRDFcpMj+A3eayiVhl7rW8Uad+DCGupERSnyE9Ro7452Mo1i2fZOkrALL3z+lNvXGOlEBpfZdUCuj62RHHi3rcqmCQsKW2VJTJBbYRSpxwCkCUoW3orYfcBnYBbJPjvUybhL14oOch+MfXnumN2Qe31L/V70cpfqLgycQiKgTx5SGe8a37+OlZpuWglNctUvy3PUg3PXHAN5WODe3RV8Im8nmZaWG1WWzp8Ta1+lP8t+dfdP1JYvE6Om5WXv5qZhCiEjpgUAcu8eBoxIdEknmAtrR+QQiqGEn+35vqFxgoku5gomHhjR0nDyuFKdeiM=----ATTACHMENT:----NTYzMDA4NzAyMjA4NTEzNiA0NjI4NDExNDIwMTkzNDYyIDU3NzExMjQ4MzQ2MjExMDk=