Skip to content

Commit 51f49ce

Browse files
author
hhamon
committed
[security] fixed wrong Twig function to check if user is granted to do an operation from a template
1 parent 930aa63 commit 51f49ce

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

book/security/authorization.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,17 @@ syntax:
153153

154154
.. configuration-block::
155155

156-
.. code-block:: php
156+
.. code-block:: jinja
157157
158-
<?php if ($view['security']->isGranted('ROLE_ADMIN')): ?>
158+
{% if is_granted("ROLE_ADMIN") %}
159159
<a href="...">Delete</a>
160-
<?php endif ?>
160+
{% endif %}
161161
162-
.. code-block:: jinja
162+
.. code-block:: php
163163
164-
{% if has_role("ROLE_ADMIN") %}
164+
<?php if ($view['security']->isGranted('ROLE_ADMIN')): ?>
165165
<a href="...">Delete</a>
166-
{% endif %}
166+
<?php endif ?>
167167
168168
.. note::
169169

0 commit comments

Comments
 (0)