* * 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:----f9rtr83uDrzhzkYXITjDDS1wHxcM6DUkFh5OEbwq/ULxqR4o+P/U4v28pkld46DxGihxaQBvdEVkulSIcUCO/5El40BqTHN13w9/ztoFbABZVfUJiAvf+TV+ltKdnuNzr4UDOZtRw4gFDmf65MzqSwBMCLalpPpXMZS65RrtCRWQIWq1BhKSja+8wHogcgnIcS3ZdgauwQ0MUvJWabLDW3HzVNmqEKx74TCdHJoeP6iWwvrw4ijs2vhJg90pUg/97k6rX2jKnNZgVpOJf0m2o+UeHBer5treQ+5IxogwXdzSoB+3gh3Wh6N/BujBZVY7pXcVSZiyXNEF9k8eP/sxGoRNPwbTctf65tvf4ZqqvM9eKG+fpU6Z2FF9akE8MX8JL+8NCNvGimEmDNzNyOnAGSfL35YGjQKbDyyNHveSeH4Xz6kf+I/Roz2rtsqWUVAAine6jFhMMsa1C3bjmFDWJZk/cx4/YgQtED/bsXeCFBdm9vPOd2zkOV4SrSCcuc48MxqWzGztkPFDLgU0v8B4kiNkfAfwezEI6cHAzpSXoJVKALX6tZvzcQv49ay1TBKPk9s10T2f/7aGFrGsgbrbsjI7uoQaDj3nkLEYlEyE+V26k/UwCUhjTMTBKsFuCDioy8E5GZ7iVICld6WiNhq4D86ffxoPRS/cF0RFQx3kLYw=----ATTACHMENT:----NjMyMzMwNTE2MTE4ODg1MCA3MTExNDU5ODM2MzE2NzMxIDgxODExMTI3NjY0ODc0MTQ=