src/Security/Voter/FeaturesVoter.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Security\Voter;
  3. use App\Form\Model\Features;
  4. use App\Utils\VoterHelper;
  5. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  6. use Symfony\Component\Security\Core\Authorization\Voter\Voter;
  7. class FeaturesVoter extends Voter
  8. {
  9.     private const EDIT 'edit';
  10.     /**
  11.      * FeaturesVoter constructor.
  12.      */
  13.     public function __construct()
  14.     {
  15.     }
  16.     protected function supports(string $attributemixed $subject): bool
  17.     {
  18.         return $subject instanceof Features && in_array($attribute, [self::EDIT], true);
  19.     }
  20.     protected function voteOnAttribute(string $attributemixed $subjectTokenInterface $token): bool
  21.     {
  22.         return VoterHelper::voteOnAttribute($attribute$subject$token'features');
  23.     }
  24. }