Skip to content

Commit 52acea0

Browse files
committed
minor #11420 Fixing broken sentence (ThomasLandauer)
This PR was merged into the 4.2 branch. Discussion ---------- Fixing broken sentence Basically resetting it to where it was in v3.4: https://symfony.com/doc/3.4/security.html#access-control-in-templates Questions: 1. Is there an easy way to check if access is granted to the *current* user (without hard-coding the role)? Anything shorter than:? ```twig {% for role in app.user.roles|default(null) %} {% if is_granted(role) %} ... {% endif %} {% endfor %} ``` 2. For building a "dynamic" navbar, it would be nice to check if a certain *path* is accessible by the current user. Is this possible? Commits ------- 33bcdea Fixing broken sentence
2 parents a1427e5 + 33bcdea commit 52acea0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

security.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,8 @@ For more information, see the `FrameworkExtraBundle documentation`_.
602602
Access Control in Templates
603603
...........................
604604

605-
If you want to check if the current access inside a template, use
606-
the built-in ``is_granted()`` helper function:
605+
If you want to check if the current user has a certain role, you can use
606+
the built-in ``is_granted()`` helper function in any Twig template:
607607

608608
.. code-block:: html+twig
609609

0 commit comments

Comments
 (0)