back-to-admin feature
bernd

bernd commited on 2008-09-22 19:56:03
Zeige 4 geänderte Dateien mit 32 Einfügungen und 0 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1159 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -46,6 +46,13 @@ a img {
46 46
   border: 0px;
47 47
 }
48 48
 
49
+p.admininfo {
50
+  margin: 3px;
51
+  margin-bottom: 1.5em;
52
+  padding: 0.5em;
53
+  border: 1px solid red;
54
+  background-color: #fdd;
55
+}
49 56
 
50 57
 p.userinfo {
51 58
   margin: 3px;
... ...
@@ -151,6 +151,12 @@ echo '<p class="userinfo">Angemeldet als:<br />';
151 151
   }
152 152
   echo '</p>';
153 153
 }
154
+
155
+if (isset($_SESSION['admin_user'])) {
156
+  echo '<p class="admininfo">';
157
+  echo '<a href="'.$prefix.'go/su/back_to_admin">Zurück zu »'.$_SESSION['admin_user'].'«</a>';
158
+  echo '</p>';
159
+}
154 160
 ?>
155 161
 
156 162
 </div>
... ...
@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+require_once('inc/debug.php');
4
+
5
+if (isset($_SESSION['admin_user']) ) {
6
+  $admin_user = $_SESSION['admin_user'];
7
+  $role = find_role($admin_user, '', True);
8
+  if ($role & ROLE_SYSADMIN) {
9
+    setup_session($role, $admin_user);
10
+    unset($_SESSION['admin_user']);
11
+    header('Location: '.$prefix.'go/su/su');
12
+    die();
13
+  }
14
+}
15
+system_failure('Unprivilleged action');
16
+
17
+
... ...
@@ -12,6 +12,7 @@ if (isset($_GET['type']))
12 12
 {
13 13
   check_form_token('su_su_ajax', $_GET['formtoken']);
14 14
   $role = NULL;
15
+  $admin_user = $_SESSION['userinfo']['username'];
15 16
   if ($_GET['type'] == 'customer') {
16 17
     $role = find_role($_GET['id'], '', True);
17 18
     setup_session($role, $_GET['id']);
... ...
@@ -21,6 +22,7 @@ if (isset($_GET['type']))
21 22
   } else {
22 23
     system_failure('unknown type');
23 24
   }
25
+  $_SESSION['admin_user'] = $admin_user;
24 26
 
25 27
   header('Location: ../../go/index/index');
26 28
   die();
27 29