mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
Remove unused dependency on DefaultVoter (+ fix when throwing an exception)
This commit is contained in:
@@ -18,7 +18,10 @@ use function in_array;
|
||||
|
||||
final readonly class DefaultVoterHelper implements VoterHelperInterface
|
||||
{
|
||||
public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher, private array $configuration) {}
|
||||
public function __construct(
|
||||
private AuthorizationHelper $authorizationHelper,
|
||||
private array $configuration
|
||||
) {}
|
||||
|
||||
public function supports($attribute, $subject): bool
|
||||
{
|
||||
@@ -37,7 +40,9 @@ final readonly class DefaultVoterHelper implements VoterHelperInterface
|
||||
|
||||
public function voteOnAttribute($attribute, $subject, $token): bool
|
||||
{
|
||||
if (!$token->getUser() instanceof User) {
|
||||
$user = $token->getUser();
|
||||
|
||||
if (!$user instanceof User) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -46,7 +51,7 @@ final readonly class DefaultVoterHelper implements VoterHelperInterface
|
||||
}
|
||||
|
||||
return $this->authorizationHelper->userHasAccess(
|
||||
$token->getUser(),
|
||||
$user,
|
||||
$subject,
|
||||
$attribute
|
||||
);
|
||||
|
Reference in New Issue
Block a user