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.
1 parent 8ded86a commit 58f4a00Copy full SHA for 58f4a00
best_practices/security.rst
@@ -327,9 +327,13 @@ via the even easier shortcut in a controller:
327
{
328
$post = // query for the post ...
329
330
- if (!$this->get('security.authorization_checker')->isGranted('edit', $post)) {
331
- throw $this->createAccessDeniedException();
332
- }
+ $this->denyAccessUnlessGranted('edit', $post);
+
+ // or without the shortcut:
333
+ //
334
+ // if (!$this->get('security.authorization_checker')->isGranted('edit', $post)) {
335
+ // throw $this->createAccessDeniedException();
336
+ // }
337
}
338
339
Learn More
0 commit comments