Skip to content

Commit b162846

Browse files
committed
minor #14165 Update voters.rst (94noni)
This PR was merged into the 4.4 branch. Discussion ---------- Update voters.rst Map path file as code example below at the `Checking for Access in a Controller` part Commits ------- 8afdf41 Update voters.rst
2 parents 2229eb0 + 8afdf41 commit b162846

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

security/voters.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ However, if you don't reuse permissions or your rules are basic, you can always
1313
put that logic directly into your controller instead. Here's an example how
1414
this could look like, if you want to make a route accessible to the "owner" only::
1515

16-
// src/AppBundle/Controller/PostController.php
16+
// src/Controller/PostController.php
1717
// ...
1818

19+
// inside your controller action
1920
if ($post->getOwner() !== $this->getUser()) {
2021
throw $this->createAccessDeniedException();
2122
}

0 commit comments

Comments
 (0)