Skip to content

Commit d1d680a

Browse files
committed
minor #50957 [Security] Remove unused code about ROLE_PREVIOUS_ADMIN (lyrixx)
This PR was merged into the 7.0 branch. Discussion ---------- [Security] Remove unused code about ROLE_PREVIOUS_ADMIN | Q | A | ------------- | --- | Branch? | 7.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- e15c98aa61 [Security] Remove dead code about ROLE_PREVIOUS_ADMIN
2 parents 709c44c + 4cdfe71 commit d1d680a

File tree

2 files changed

+0
-5
lines changed

2 files changed

+0
-5
lines changed

Firewall/ContextListener.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,6 @@ private static function hasUserChanged(UserInterface $originalUser, TokenInterfa
302302

303303
$userRoles = array_map('strval', (array) $refreshedUser->getRoles());
304304

305-
if ($refreshedToken instanceof SwitchUserToken) {
306-
$userRoles[] = 'ROLE_PREVIOUS_ADMIN';
307-
}
308-
309305
if (
310306
\count($userRoles) !== \count($refreshedToken->getRoleNames())
311307
|| \count($userRoles) !== \count(array_intersect($userRoles, $refreshedToken->getRoleNames()))

Firewall/SwitchUserListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ private function attemptSwitchUser(Request $request, string $username): ?TokenIn
180180
$this->userChecker->checkPostAuth($user);
181181

182182
$roles = $user->getRoles();
183-
$roles[] = 'ROLE_PREVIOUS_ADMIN';
184183
$originatedFromUri = str_replace('/&', '/?', preg_replace('#[&?]'.$this->usernameParameter.'=[^&]*#', '', $request->getRequestUri()));
185184
$token = new SwitchUserToken($user, $this->firewallName, $roles, $token, $originatedFromUri);
186185

0 commit comments

Comments
 (0)