. */ declare(strict_types=1); namespace App\Security\Voter; use App\Entity\UserSystem\User; /** * This voter implements a virtual role, which can be used if the user has any permission set to allowed. * We use this to restrict access to the homepage. */ class HasAccessPermissionsVoter extends ExtendedVoter { public const ROLE = "HAS_ACCESS_PERMISSIONS"; protected function voteOnUser(string $attribute, $subject, User $user): bool { return $this->resolver->hasAnyPermissionSetToAllowInherited($user); } protected function supports(string $attribute, mixed $subject): bool { return $attribute === self::ROLE; } }