|
12 | 12 | namespace Symfony\Component\Security\Http\Attribute;
|
13 | 13 |
|
14 | 14 | use Symfony\Component\ExpressionLanguage\Expression;
|
| 15 | +use Symfony\Component\HttpFoundation\Request; |
| 16 | +use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; |
| 17 | +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; |
| 18 | +use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; |
15 | 19 |
|
16 | 20 | /**
|
17 | 21 | * Checks if user has permission to access to some resource using security roles and voters.
|
|
24 | 28 | final class IsGranted
|
25 | 29 | {
|
26 | 30 | /**
|
27 |
| - * @param string|Expression $attribute The attribute that will be checked against a given authentication token and optional subject |
28 |
| - * @param array|string|Expression|null $subject An optional subject - e.g. the current object being voted on |
29 |
| - * @param string|null $message A custom message when access is not granted |
30 |
| - * @param int|null $statusCode If set, will throw HttpKernel's HttpException with the given $statusCode; if null, Security\Core's AccessDeniedException will be used |
31 |
| - * @param int|null $exceptionCode If set, will add the exception code to thrown exception |
| 31 | + * @param string|Expression|(\Closure(TokenInterface $token, mixed $subject, AccessDecisionManagerInterface $accessDecisionManager, AuthenticationTrustResolverInterface $trustResolver): bool) $attribute The attribute that will be checked against a given authentication token and optional subject |
| 32 | + * @param array|string|Expression|(\Closure(array<string, mixed>, Request): mixed)|null $subject An optional subject - e.g. the current object being voted on |
| 33 | + * @param string|null $message A custom message when access is not granted |
| 34 | + * @param int|null $statusCode If set, will throw HttpKernel's HttpException with the given $statusCode; if null, Security\Core's AccessDeniedException will be used |
| 35 | + * @param int|null $exceptionCode If set, will add the exception code to thrown exception |
32 | 36 | */
|
33 | 37 | public function __construct(
|
34 |
| - public string|Expression $attribute, |
35 |
| - public array|string|Expression|null $subject = null, |
| 38 | + public string|Expression|\Closure $attribute, |
| 39 | + public array|string|Expression|\Closure|null $subject = null, |
36 | 40 | public ?string $message = null,
|
37 | 41 | public ?int $statusCode = null,
|
38 | 42 | public ?int $exceptionCode = null,
|
|
0 commit comments