Skip to content

Commit 693b758

Browse files
committed
[Security] Remove mention of is_granted_ $field argument
The third argument of is_granted / is_granted_for_user is undocumented (except on this page) (neither on Symfony docs, code, nor on... Symfony ACL Bundle docs). It must be kept and maintained for BC reasons. But it can be missleading/frustrating to show this argument to users, when they cannot use it with a standard/recommended Symfony installation. And if they just test it, the error could lead them to believe the AclBundle needs to be installed to use the `is_granted` function(s). As suggested in symfony/symfony#59282 (comment) I believe "not showing it" is the "best" solution here.
1 parent d688f63 commit 693b758

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

reference/twig_reference.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,12 @@ is_granted
160160

161161
.. code-block:: twig
162162
163-
{{ is_granted(role, object = null, field = null) }}
163+
{{ is_granted(role, object = null) }}
164164
165165
``role``
166166
**type**: ``string``
167167
``object`` *(optional)*
168168
**type**: ``object``
169-
``field`` *(optional)*
170-
**type**: ``string``
171169

172170
Returns ``true`` if the current user has the given role.
173171

@@ -183,16 +181,14 @@ is_granted_for_user
183181

184182
.. code-block:: twig
185183
186-
{{ is_granted_for_user(user, attribute, subject = null, field = null) }}
184+
{{ is_granted_for_user(user, attribute, subject = null) }}
187185
188186
``user``
189187
**type**: ``object``
190188
``attribute``
191189
**type**: ``string``
192190
``subject`` *(optional)*
193191
**type**: ``object``
194-
``field`` *(optional)*
195-
**type**: ``string``
196192

197193
Returns ``true`` if the user is authorized for the specified attribute.
198194

0 commit comments

Comments
 (0)