8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 01afda2 commit 04a091bCopy full SHA for 04a091b
security.rst
@@ -2368,6 +2368,13 @@ want to include extra details only for users that have a ``ROLE_SALES_ADMIN`` ro
2368
// ...
2369
}
2370
2371
+.. tip::
2372
+
2373
+ Using ``isGranted()`` checks authorization against the currently logged in user. If wanting to check
2374
+ against a user that isn't logged in or if checking authorization when the user session is not
2375
+ available (example: message queue, cronjob, command) ``userIsGranted()`` can be used to set the
2376
+ user explicitly.
2377
2378
If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`,
2379
Symfony will automatically pass the ``security.helper`` to your service
2380
thanks to autowiring and the ``Security`` type-hint.
0 commit comments