File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -2585,6 +2585,18 @@ want to include extra details only for users that have a ``ROLE_SALES_ADMIN`` ro
2585
2585
// ...
2586
2586
}
2587
2587
2588
+ .. tip ::
2589
+
2590
+ Using ``isGranted() `` checks authorization against the currently logged in user. If you need to check
2591
+ against a user that is not the one logged in or if checking authorization when the user session is not
2592
+ available in a CLI context (example: message queue, cronjob) ``isGrantedForUser() `` can be used to set the
2593
+ target user explicitly.
2594
+
2595
+ .. versionadded :: 7.3
2596
+
2597
+ The :method: `Symfony\\ Bundle\\ SecurityBundle\\ Security::isGrantedForUser `
2598
+ method was introduced in Symfony 7.3.
2599
+
2588
2600
If you're using the :ref: `default services.yaml configuration <service-container-services-load-example >`,
2589
2601
Symfony will automatically pass the ``security.helper `` to your service
2590
2602
thanks to autowiring and the ``Security `` type-hint.
You can’t perform that action at this time.
0 commit comments