Skip to content

Commit 50c8227

Browse files
committed
[#5015] Updating the security service name for 2.6 - thanks to Cordoval
1 parent 4d22a78 commit 50c8227

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: cookbook/security/impersonating_user.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ over the user's roles until you find one that a ``SwitchUserRole`` object::
9292

9393
use Symfony\Component\Security\Core\Role\SwitchUserRole;
9494

95-
$securityContext = $this->get('security.context');
95+
$authChecker = $this->get('security.authorization_checker');
9696

97-
if ($securityContext->isGranted('ROLE_PREVIOUS_ADMIN')) {
98-
foreach ($securityContext->getToken()->getRoles() as $role) {
97+
if ($authChecker->isGranted('ROLE_PREVIOUS_ADMIN')) {
98+
foreach ($authChecker->getToken()->getRoles() as $role) {
9999
if ($role instanceof SwitchUserRole) {
100100
$impersonatingUser = $role->getSource()->getUser();
101101
break;

0 commit comments

Comments
 (0)