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