File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -2368,6 +2368,13 @@ want to include extra details only for users that have a ``ROLE_SALES_ADMIN`` ro
23682368 // ...
23692369 }
23702370
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+
23712378If you're using the :ref: `default services.yaml configuration <service-container-services-load-example >`,
23722379Symfony will automatically pass the ``security.helper `` to your service
23732380thanks to autowiring and the ``Security `` type-hint.
You can’t perform that action at this time.
0 commit comments