feat: upgrade project to symfony 7.4
This commit is contained in:
@@ -5,7 +5,8 @@ declare(strict_types=1);
|
||||
namespace App\Security\Voter;
|
||||
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Vote;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
|
||||
/**
|
||||
@@ -16,7 +17,7 @@ class AdministrativeAccessVoter extends Voter
|
||||
public const ADMINISTRATIVE_ACCESS = 'ADMINISTRATIVE_ACCESS';
|
||||
|
||||
public function __construct(
|
||||
private readonly AuthorizationCheckerInterface $authorizationChecker,
|
||||
private readonly AccessDecisionManagerInterface $accessDecisionManager,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -25,9 +26,9 @@ class AdministrativeAccessVoter extends Voter
|
||||
return self::ADMINISTRATIVE_ACCESS === $attribute;
|
||||
}
|
||||
|
||||
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
|
||||
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool
|
||||
{
|
||||
return $this->authorizationChecker->isGranted('ROLE_ADMIN')
|
||||
|| $this->authorizationChecker->isGranted('ROLE_GROUPS_MANAGER');
|
||||
return $this->accessDecisionManager->decide($token, ['ROLE_ADMIN'])
|
||||
|| $this->accessDecisionManager->decide($token, ['ROLE_GROUPS_MANAGER']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace App\Security\Voter;
|
||||
use App\BusProNet\Model\Booking;
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Vote;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
|
||||
/**
|
||||
@@ -32,7 +33,7 @@ class BookingVoter extends Voter
|
||||
return $subject instanceof Booking;
|
||||
}
|
||||
|
||||
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
|
||||
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool
|
||||
{
|
||||
/** @var User|null $user */
|
||||
$user = $token->getUser();
|
||||
|
||||
Reference in New Issue
Block a user