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