[BUGFIX] Disable 'SwitchUser' link if user is already in su mode 83/46983/2
authorMarkus Hoelzle <typo3@markus-hoelzle.de>
Tue, 1 Mar 2016 11:29:35 +0000 (12:29 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 1 Mar 2016 14:49:26 +0000 (15:49 +0100)
If you switch the user although you are in the su mode,
and you switch back you are the user from the su mode.

Resolves: #73797
Releases: master, 7.6
Change-Id: Idc10d6afbead80f79f4b51f49a4c52eab7c23456
Reviewed-on: https://review.typo3.org/46983
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/beuser/Classes/ViewHelpers/SwitchUserViewHelper.php

index 839c2c7..c773f57 100644 (file)
@@ -56,7 +56,7 @@ class SwitchUserViewHelper extends AbstractViewHelper implements CompilableInter
     {
         $backendUser = $arguments['backendUser'];
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
-        if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid'] || !$backendUser->isActive()) {
+        if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid'] || !$backendUser->isActive() || $GLOBALS['BE_USER']->user['ses_backuserid']) {
             return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
         }
         $title = LocalizationUtility::translate('switchBackMode', 'beuser');