MDL-76166 auth: Ensure user is in server access logs
This commit is contained in:
@@ -940,6 +940,9 @@ class manager {
|
||||
|
||||
// Init session key.
|
||||
sesskey();
|
||||
|
||||
// Make sure the user is correct in web server access logs.
|
||||
set_access_log_user();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -148,6 +148,10 @@ class core_shutdown_manager {
|
||||
public static function shutdown_handler() {
|
||||
global $DB;
|
||||
|
||||
// Always ensure we know who the user is in access logs even if they
|
||||
// were logged in a weird way midway through the request.
|
||||
set_access_log_user();
|
||||
|
||||
// Custom stuff first.
|
||||
foreach (self::$callbacks as $data) {
|
||||
list($callback, $params) = $data;
|
||||
|
||||
+1
-1
@@ -1876,7 +1876,7 @@ function set_access_log_user() {
|
||||
apache_note('MOODLEUSER', $logname);
|
||||
}
|
||||
|
||||
if ($logmethod == 'header') {
|
||||
if ($logmethod == 'header' && !headers_sent()) {
|
||||
header("X-MOODLEUSER: $logname");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user