Fix for bug 2114 that was losing track of the Real user when loginas
was used by a logged-in user
This commit is contained in:
+8
-5
@@ -4,9 +4,10 @@
|
||||
require_once("../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
require_variable($id); // course id
|
||||
require_variable($id); // course id
|
||||
optional_variable($user); // login as this user
|
||||
optional_variable($return); // return to being the real user again
|
||||
optional_variable($return); // return to the page we came from
|
||||
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course ID was incorrect");
|
||||
@@ -16,7 +17,7 @@
|
||||
require_login($course->id);
|
||||
}
|
||||
|
||||
if ($return and $USER->realuser) {
|
||||
if ($USER->realuser) { /// Reset user back to their real self
|
||||
$USER = get_user_info_from_db("id", $USER->realuser);
|
||||
$USER->loggedin = true;
|
||||
$USER->site = $CFG->wwwroot;
|
||||
@@ -30,8 +31,10 @@
|
||||
unset($SESSION->oldtimeaccess);
|
||||
}
|
||||
|
||||
redirect($_SERVER["HTTP_REFERER"]);
|
||||
exit;
|
||||
if ($return) { /// That's all we wanted to do, so let's go back
|
||||
redirect($_SERVER["HTTP_REFERER"]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// $user must be defined to go on
|
||||
|
||||
Reference in New Issue
Block a user