TYPO3 CMS  TYPO3_6-2
BackendUserSessionRepository.php
Go to the documentation of this file.
1 <?php
3 
24 
32  public function findByBackendUser(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser) {
33  $sessions = array();
34  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
35  'ses_id AS id, ses_iplock AS ip, ses_tstamp AS timestamp',
36  'be_sessions',
37  'ses_userid = ' . (int)$backendUser->getUid(),
38  '',
39  'ses_tstamp ASC'
40  );
41  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
42  $sessions[] = array(
43  'id' => $row['id'],
44  'ip' => $row['ip'],
45  'timestamp' => $row['timestamp']
46  );
47  }
48  $GLOBALS['TYPO3_DB']->sql_free_result($res);
49  return $sessions;
50  }
51 
58  public function switchBackToOriginalUser(\TYPO3\CMS\Core\Authentication\AbstractUserAuthentication $authentication) {
59  $updateData = array(
60  'ses_userid' => $authentication->user['ses_backuserid'],
61  'ses_backuserid' => 0,
62  );
63  $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
64  'be_sessions',
65  'ses_id = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->id, 'be_sessions') .
66  ' AND ses_name = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::getCookieName(), 'be_sessions') .
67  ' AND ses_userid=' . (int)$GLOBALS['BE_USER']->user['uid'], $updateData
68  );
69  }
70 
71 }
findByBackendUser(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser)
switchBackToOriginalUser(\TYPO3\CMS\Core\Authentication\AbstractUserAuthentication $authentication)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]