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