<?php
namespace Kobizo\Bundle\CoreBundle\Security\Voter;
use Kobizo\Component\Entity\Option;
use Kobizo\Component\Resources\AccessControl\OptionResource;
class OptionVoter extends KobizoVoter
{
protected function supports($attribute, $subject): bool
{
if (!in_array($attribute, OptionResource::getAllResources())) {
return false;
}
if (!$subject instanceof Option
&& !in_array($attribute, [OptionResource::INDEX, OptionResource::CREATE])
) {
return false;
}
return true;
}
}