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