We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
statusCode
#[IsGranted]
1 parent 9f38a74 commit eceb5faCopy full SHA for eceb5fa
security.rst
@@ -2306,6 +2306,20 @@ the ``ROLE_SUPER_ADMIN`` permission:
2306
}
2307
2308
2309
+A custom status code can be set with the ``statusCode`` argument. This
2310
+code will be used in the response::
2311
+
2312
+ // src/Controller/AdminController.php
2313
+ // ...
2314
2315
+ use Symfony\Component\Security\Http\Attribute\IsGranted;
2316
2317
+ #[IsGranted('ROLE_ADMIN', statusCode: 423)]
2318
+ class AdminController extends AbstractController
2319
+ {
2320
2321
+ }
2322
2323
.. versionadded:: 6.2
2324
2325
The ``#[IsGranted()]`` attribute was introduced in Symfony 6.2.
0 commit comments