From 6051607739e130e4220f092632f3777abe0c5334 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Tue, 9 Oct 2018 16:14:07 +0200 Subject: [PATCH 1/2] Improve is_granted documentation --- reference/twig_reference.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 3aef067c5b2..6989db9a463 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -302,15 +302,19 @@ is_granted {{ is_granted(role, object = null, field = null) }} ``role`` - **type**: ``string`` + **type**: ``string``, ``string[]`` ``object`` *(optional)* **type**: ``object`` ``field`` *(optional)* **type**: ``string`` -Returns ``true`` if the current user has the required role. Optionally, -an object can be pasted to be used by the voter. More information can be -found in :ref:`security-template`. +Returns ``true`` if the current user has the required role, if only one +is passed; if more than one is passed, with an array, the behavior depends +on how the :ref:`authorization ` is configured; +by default, the user has to have at least one of the passed roles. + +Optionally, an object can be pasted to be used by the voter. More information +can be found in :ref:`security-template`. .. note:: From b7382fca671730d2283409a00e46b4e820df35ce Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Tue, 9 Oct 2018 16:30:33 +0200 Subject: [PATCH 2/2] Fix link to reference --- reference/twig_reference.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 6989db9a463..5ea2c995384 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -310,8 +310,8 @@ is_granted Returns ``true`` if the current user has the required role, if only one is passed; if more than one is passed, with an array, the behavior depends -on how the :ref:`authorization ` is configured; -by default, the user has to have at least one of the passed roles. +on how the :ref:`Access Decision Manager ` +is configured; by default, the user has to have at least one of the passed roles. Optionally, an object can be pasted to be used by the voter. More information can be found in :ref:`security-template`.