8000 minor #10461 Improve is_granted documentation (Jean85) · symfony/symfony-docs@5c52321 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c52321

Browse files
committed
minor #10461 Improve is_granted documentation (Jean85)
This PR was squashed before being merged into the 2.8 branch (closes #10461). Discussion ---------- Improve is_granted documentation This improves the doc for the 'is_granted` Twig function. Under the hood, it calls `AuthorizationChecker::isGranted()` which accepts multiple attributes to be checked, but that's not clear. I've referred to the only other part of the doc where this is clear. Commits ------- 8ba3229 Improve is_granted documentation
2 parents d8c921e + 8ba3229 commit 5c52321

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

reference/twig_reference.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,19 @@ is_granted
302302
{{ is_granted(role, object = null, field = null) }}
303303
304304
``role``
305-
**type**: ``string``
305+
**type**: ``string``, ``string[]``
306306
``object`` *(optional)*
307307
**type**: ``object``
308308
``field`` *(optional)*
309309
**type**: ``string``
310310

311-
Returns ``true`` if the current user has the required role. Optionally,
312-
an object can be pasted to be used by the voter. More information can be
313-
found in :ref:`security-template`.
311+
Returns ``true`` if the current user has the required role, if only one
312+
is passed; if more than one is passed, with an array, the behavior depends
313+
on how the :ref:`Access Decision Manager <components-security-access-decision-manager>`
314+
is configured; by default, the user has to have at least one of the passed roles.
315+
316+
Optionally, an object can be pasted to be used by the voter. More information
317+
can be found in :ref:`security-template`.
314318

315319
.. note::
316320

0 commit comments

Comments
 (0)
0