mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
Fix for access to users at site level MDL-6810
This commit is contained in:
parent
793a8c3af7
commit
e020c546c7
1 changed files with 7 additions and 2 deletions
|
@ -33,7 +33,11 @@
|
|||
require_login($course->id);
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // Course context
|
||||
if ($course->id == SITEID) {
|
||||
$coursecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); // SYSTEM context
|
||||
} else {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // Course context
|
||||
}
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id); // User context
|
||||
|
||||
|
||||
|
@ -44,7 +48,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (!$currentuser && !has_capability('moodle/course:view', $coursecontext, $user->id, false)) {
|
||||
if (!$currentuser && $course->id != SITEID &&
|
||||
!has_capability('moodle/course:view', $coursecontext, $user->id, false)) {
|
||||
print_error('usernotavailable');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue