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