TYPO3 CMS  TYPO3_6-2
SwitchBackUserHook.php
Go to the documentation of this file.
1 <?php
3 
18 
29 
38  public function switchBack($params, AbstractUserAuthentication $authentication) {
39  if ($this->isAHandledBackendSession($authentication)) {
40  $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
41  $backendUserSessionRepository = $objectManager->get('TYPO3\\CMS\\Beuser\\Domain\\Repository\\BackendUserSessionRepository');
42  $backendUserSessionRepository->switchBackToOriginalUser($authentication);
43  \TYPO3\CMS\Core\Utility\HttpUtility::redirect($GLOBALS['BACK_PATH'] . 'backend.php');
44  }
45  }
46 
54  protected function isAHandledBackendSession(AbstractUserAuthentication $authentication) {
55  if (
56  $authentication->session_table !== 'be_sessions'
57  || !is_array($authentication->user)
58  || !$authentication->user['uid']
59  || !$authentication->user['ses_backuserid']
60  ) {
61  return FALSE;
62  } else {
63  return TRUE;
64  }
65  }
66 
67 }
isAHandledBackendSession(AbstractUserAuthentication $authentication)
static redirect($url, $httpStatus=self::HTTP_STATUS_303)
Definition: HttpUtility.php:76
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
switchBack($params, AbstractUserAuthentication $authentication)