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