feat: groups price calculator admin crud, booking/offer flow and api
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
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\Voter\Voter;
|
||||
|
||||
/**
|
||||
* @extends Voter<string, mixed>
|
||||
*/
|
||||
class AdministrativeAccessVoter extends Voter
|
||||
{
|
||||
public const ADMINISTRATIVE_ACCESS = 'ADMINISTRATIVE_ACCESS';
|
||||
|
||||
public function __construct(
|
||||
private readonly AuthorizationCheckerInterface $authorizationChecker,
|
||||
) {
|
||||
}
|
||||
|
||||
protected function supports(string $attribute, mixed $subject): bool
|
||||
{
|
||||
return self::ADMINISTRATIVE_ACCESS === $attribute;
|
||||
}
|
||||
|
||||
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
|
||||
{
|
||||
return $this->authorizationChecker->isGranted('ROLE_ADMIN')
|
||||
|| $this->authorizationChecker->isGranted('ROLE_GROUPS_MANAGER');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user