File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -964,15 +964,15 @@ You can also use expressions inside your templates:
964
964
.. code-block :: html+jinja
965
965
966
966
{% if is_granted(expression(
967
- '"ROLE_ADMIN" in roles or (user and user.isSuperAdmin())'
967
+ '"ROLE_ADMIN" in roles or (not is_anonymous() and user.isSuperAdmin())'
968
968
)) %}
969
969
<a href="...">Delete</a>
970
970
{% endif %}
971
971
972
972
.. code-block :: html+php
973
973
974
974
<?php if ($view['security']->isGranted(new Expression(
975
- '"ROLE_ADMIN" in roles or (user and user.isSuperAdmin())'
975
+ '"ROLE_ADMIN" in roles or (not is_anonymous() and user.isSuperAdmin())'
976
976
))): ?>
977
977
<a href="...">Delete</a>
978
978
<?php endif; ?>
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ accepts an :class:`Symfony\\Component\\ExpressionLanguage\\Expression` object::
18
18
public function indexAction()
19
19
{
20
20
$this->denyAccessUnlessGranted(new Expression(
21
- '"ROLE_ADMIN" in roles or (user and user.isSuperAdmin())'
21
+ '"ROLE_ADMIN" in roles or (not is_anonymous() and user.isSuperAdmin())'
22
22
));
23
23
24
24
// ...
You can’t perform that action at this time.
0 commit comments