<?php
declare(strict_types=1);
namespace Kobizo\Bundle\ECommerceBundle\Security\Voter;
use Kobizo\Bundle\CoreBundle\Security\Voter\KobizoVoter;
use Kobizo\Bundle\ECommerceBundle\Entity\StoreBudgetBook;
use Kobizo\Bundle\ECommerceBundle\Resources\AccessControl\StoreBudgetBookResource;
class StoreBudgetBookVoter extends KobizoVoter
{
protected function supports($attribute, $subject): bool
{
if (!in_array($attribute, StoreBudgetBookResource::getAllResources())) {
return false;
}
if (!$subject instanceof StoreBudgetBook
&& !in_array($attribute, [StoreBudgetBookResource::INDEX, StoreBudgetBookResource::CREATE, StoreBudgetBookResource::EDIT], true)
) {
return false;
}
return true;
}
}