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