Skip to content

Commit 34f2209

Browse files
committed
minor #17512 [Security] User in expression cannot be "anon" (HypeMC)
This PR was merged into the 6.0 branch. Discussion ---------- [Security] User in expression cannot be "anon" Since Symfony 6.0, the `TokenInterface::getUser()` method [always returns an instance of `UserInterface` or `null`](https://github.com/symfony/symfony/blob/aee9ea5be25036706cb7dfd3047d48dad0f8e892/UPGRADE-6.0.md?plain=1#L242), and since the [`ExpressionVoter` fetches the user from the token](https://github.com/symfony/symfony/blob/aee9ea5be25036706cb7dfd3047d48dad0f8e892/src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php#L82), it shouldn't be possible for it to be `anon` any more. Commits ------- cb091de [Security] User in expression cannot be "anon"
2 parents d76b7c1 + cb091de commit 34f2209

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

security/expressions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ syntax, see :doc:`/components/expression_language/syntax`.
4444
Inside the expression, you have access to a number of variables:
4545

4646
``user``
47-
The user object (or the string ``anon`` if you're not authenticated).
47+
An instance of :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface` that represents the current user
48+
or ``null`` if you're not authenticated.
4849
``role_names``
4950
An array with the string representation of the roles the user has. This array
5051
includes any roles granted indirectly via the :ref:`role hierarchy <security-role-hierarchy>` but it

0 commit comments

Comments
 (0)