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
2368
2368
// ...
2369
2369
}
2370
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
+
2371
2378
If you're using the :ref: `default services.yaml configuration <service-container-services-load-example >`,
2372
2379
Symfony will automatically pass the ``security.helper `` to your service
2373
2380
thanks to autowiring and the ``Security `` type-hint.
You can’t perform that action at this time.
0 commit comments