Skip to content

Commit bc22f16

Browse files
committed
[symfony#3022][symfony#3258] Enhancing example at @ggam's suggestion
1 parent 0cf1828 commit bc22f16

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

book/security.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -1901,14 +1901,16 @@ You can also use expressions inside your templates:
19011901

19021902
.. code-block:: html+jinja
19031903

1904-
{% if is_granted(expression('has_role("ROLE_ADMIN")')) %}
1904+
{% if is_granted(expression(
1905+
'"ROLE_ADMIN" in roles or (user and user.isSuperAdmin())'
1906+
)) %}
19051907
<a href="...">Delete</a>
19061908
{% endif %}
19071909

19081910
.. code-block:: html+php
19091911

19101912
<?php if ($view['security']->isGranted(new Expression(
1911-
'has_role("ROLE_ADMIN")'
1913+
'"ROLE_ADMIN" in roles or (user and user.isSuperAdmin())'
19121914
))): ?>
19131915
<a href="...">Delete</a>
19141916
<?php endif; ?>

0 commit comments

Comments
 (0)