2005-11-12 Sebastian Kurfuerst <sebastian@garbage-group.de>
authorSebastian Kurfürst <sebastian.kurfuerst@typo3.org>
Sat, 12 Nov 2005 19:50:52 +0000 (19:50 +0000)
committerSebastian Kurfürst <sebastian.kurfuerst@typo3.org>
Sat, 12 Nov 2005 19:50:52 +0000 (19:50 +0000)
* New feature 1573: switch back to admin user after user switch
(SU-mode)

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@860 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/beuser/class.tx_beuser_switchbackuser.php [new file with mode: 0644]
typo3/sysext/beuser/ext_localconf.php [new file with mode: 0644]

diff --git a/typo3/sysext/beuser/class.tx_beuser_switchbackuser.php b/typo3/sysext/beuser/class.tx_beuser_switchbackuser.php
new file mode 100644 (file)
index 0000000..c11d96e
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Backend user switchback
+ *
+ * @author     Sebastian Kurfuerst <sebastian@garbage-group.de>
+ */
+
+class tx_beuser_switchbackuser {
+       function switchBack($params, $that)     {
+               if($that->session_table == 'be_sessions' && $that->user['uid'] && $that->user['ses_backuserid']) {
+                       $updateData = array(
+                               'ses_userid' => $that->user['ses_backuserid'],
+                               'ses_backuserid' => 0
+                               );
+                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_sessions', 'ses_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->id, 'be_sessions').' AND ses_name=\'be_typo_user\' AND ses_userid='.intval($GLOBALS['BE_USER']->user['uid']),$updateData);
+
+                       header('Location: '.t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'].'index.php'.($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']?'':'?commandLI=1')));
+                       exit;
+                       //$GLOBALS['TYPO4
+               }
+       }
+}
+
+?>
diff --git a/typo3/sysext/beuser/ext_localconf.php b/typo3/sysext/beuser/ext_localconf.php
new file mode 100644 (file)
index 0000000..85c3d91
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+if (!defined ('TYPO3_MODE'))   die ('Access denied.');
+
+require_once(t3lib_extMgm::extPath('beuser').'class.tx_beuser_switchbackuser.php');
+
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_feuserauth.php']['logoff_pre_processing'][] = 'tx_beuser_switchbackuser->switchBack';
+?>