MDL-66377 user: Only allow active users to retrieve files via tokenpluginfile.php

This commit is contained in:
Juan Leyva
2019-11-06 01:26:37 +01:00
committed by Jenkins
parent 167a8dc276
commit c7a5fc2f35
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -3199,6 +3199,8 @@ function require_user_key_login($script, $instance = null, $keyvalue = null) {
print_error('invaliduserid');
}
core_user::require_active_user($user, true, true);
// Emulate normal session.
enrol_check_plugins($user);
\core\session\manager::set_user($user);
+1
View File
@@ -37,6 +37,7 @@ if (0 == strpos($relativepath, '/token/')) {
$relativepath = ltrim($relativepath, '/');
$pathparts = explode('/', $relativepath, 2);
$token = $pathparts[0];
$token = clean_param($token, PARAM_ALPHANUM);
$relativepath = "/{$pathparts[1]}";
}