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