vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Security/AccessVoter.php line 24

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * CoreShop
  5.  *
  6.  * This source file is available under two different licenses:
  7.  *  - GNU General Public License version 3 (GPLv3)
  8.  *  - CoreShop Commercial License (CCL)
  9.  * Full copyright and license information is available in
  10.  * LICENSE.md which is distributed with this source code.
  11.  *
  12.  * @copyright  Copyright (c) CoreShop GmbH (https://www.coreshop.org)
  13.  * @license    https://www.coreshop.org/license     GPLv3 and CCL
  14.  *
  15.  */
  16. namespace CoreShop\Bundle\CoreBundle\Security;
  17. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  18. use Symfony\Component\Security\Core\Authorization\Voter\Voter;
  19. class AccessVoter extends Voter
  20. {
  21.     public function __construct(
  22.         protected string $prefix 'CORESHOP_',
  23.     ) {
  24.     }
  25.     protected function supports(string $attribute$subject)
  26.     {
  27.         return str_starts_with($attribute$this->prefix);
  28.     }
  29.     protected function voteOnAttribute(string $attribute$subjectTokenInterface $token)
  30.     {
  31.         return true;
  32.     }
  33. }