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:
964964 .. code-block :: html+jinja
965965
966966 {% 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())'
968968 )) %}
969969 <a href="...">Delete</a>
970970 {% endif %}
971971
972972 .. code-block :: html+php
973973
974974 <?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())'
976976 ))): ?>
977977 <a href="...">Delete</a>
978978 <?php endif; ?>
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ accepts an :class:`Symfony\\Component\\ExpressionLanguage\\Expression` object::
1818 public function indexAction()
1919 {
2020 $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())'
2222 ));
2323
2424 // ...
You can’t perform that action at this time.
0 commit comments