vendor/kobizo/cms-bundle/src/Security/Voter/TermRelationshipVoter.php line 9

Open in your IDE?
  1. <?php
  2. namespace Kobizo\Bundle\CmsBundle\Security\Voter;
  3. use Kobizo\Component\Entity\PostTermRelationship;
  4. use Kobizo\Component\Resources\AccessControl\TermRelationshipResource;
  5. use Kobizo\Bundle\CoreBundle\Security\Voter\KobizoVoter;
  6. class TermRelationshipVoter extends KobizoVoter
  7. {
  8.     protected function supports($attribute$subject): bool
  9.     {
  10.         if (!in_array($attributeTermRelationshipResource::getAllResources())) {
  11.             return false;
  12.         }
  13.         if (!$subject instanceof PostTermRelationship
  14.             && !in_array($attribute, [TermRelationshipResource::INDEXTermRelationshipResource::CREATE])
  15.         ) {
  16.             return false;
  17.         }
  18.         return true;
  19.     }
  20. }