Skip to content

Commit

Permalink
minor #20544 [Security] Remove mention of is_granted_ $field argume…
Browse files Browse the repository at this point in the history
…nt (smnandre)

This PR was merged into the 7.3 branch.

Discussion
----------

[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.

Commits
-------

693b758 [Security] Remove mention of is_granted_ `$field` argument
  • Loading branch information
javiereguiluz committed Jan 8, 2025
2 parents e7b22c9 + 693b758 commit 66c0fd4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions reference/twig_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,12 @@ is_granted

.. code-block:: twig
{{ is_granted(role, object = null, field = null) }}
{{ is_granted(role, object = null) }}
``role``
**type**: ``string``
``object`` *(optional)*
**type**: ``object``
``field`` *(optional)*
**type**: ``string``

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

Expand All @@ -183,16 +181,14 @@ is_granted_for_user

.. code-block:: twig
{{ is_granted_for_user(user, attribute, subject = null, field = null) }}
{{ is_granted_for_user(user, attribute, subject = null) }}
``user``
**type**: ``object``
``attribute``
**type**: ``string``
``subject`` *(optional)*
**type**: ``object``
``field`` *(optional)*
**type**: ``string``

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

Expand Down

0 comments on commit 66c0fd4

Please sign in to comment.