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