-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Security] Add statusCode
and message
arguments to #[IsGranted]
#18103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security] Add statusCode
and message
arguments to #[IsGranted]
#18103
Conversation
Great thanks @alexandre-daubois! I was searching for it after looking at your last PR! |
I am also tempted to explicitly specify the default status code, and maybe document |
eceb5fa
to
7961840
Compare
Updated! What do you think? |
statusCode
to #[IsGranted]
statusCode
and message
arguments to #[IsGranted]
security.rst
Outdated
|
||
use Symfony\Component\Security\Http\Attribute\IsGranted; | ||
|
||
#[IsGranted('ROLE_ADMIN', statusCode: 403)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep a custom statusCode here and specify in text above 403 is default value, seems confusing to me to explicitly define default value here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, updated!
statusCode
and message
arguments to #[IsGranted]statusCode
and message
arguments to #[IsGranted]
security.rst
Outdated
class AdminController extends AbstractController | ||
{ | ||
// ... | ||
} | ||
|
||
The default code is 403. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default code is 403. |
already mentioned in the sentence above. Afterwards good to merge 👍
Thank you @alexandre-daubois. |
17ceb21
to
149d33b
Compare
…#[IsGranted]` (alexandre-daubois) This PR was squashed before being merged into the 6.2 branch. Discussion ---------- [Security] Add `statusCode` and `message` arguments to `#[IsGranted]` Following #18101 (comment) Commits ------- 149d33b [Security] Add `statusCode` and `message` arguments to `#[IsGranted]`
Following #18101 (comment)