Skip to content

Commit af161f2

Browse files
committed
Merge branch '6.0' into 6.1
* 6.0: Remove deprecated features [Security] Add deprecation information for is_anonymous
2 parents 5975f5a + cbfac3d commit af161f2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

security/expressions.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ accepts an :class:`Symfony\\Component\\ExpressionLanguage\\Expression` object::
2424
public function index(): Response
2525
{
2626
$this->denyAccessUnlessGranted(new Expression(
27-
'"ROLE_ADMIN" in role_names or (not is_anonymous() and user.isSuperAdmin())'
27+
'"ROLE_ADMIN" in role_names or (is_authenticated() and user.isSuperAdmin())'
2828
));
2929

3030
// ...
@@ -64,10 +64,6 @@ Additionally, you have access to a number of functions inside the expression:
6464
``is_authenticated()``
6565
Returns ``true`` if the user is authenticated via "remember-me" or authenticated
6666
"fully" - i.e. returns true if the user is "logged in".
67-
``is_anonymous()``
68-
Returns ``true`` if the user is anonymous. That is, the firewall confirms that it
69-
does not know this user's identity. This is different from ``IS_AUTHENTICATED_ANONYMOUSLY``,
70-
which is granted to *all* users, including authenticated ones.
7167
``is_remember_me()``
7268
Similar, but not equal to ``IS_AUTHENTICATED_REMEMBERED``, see below.
7369
``is_fully_authenticated()``

0 commit comments

Comments
 (0)