MDL-12373 - More instances of links to the participants list being shown in the navigation bar to people without the necessary capability.
I have not copied and pasted the same code into lots of different places. That sucks. We really need to refactor this into a function that builds the navigation up to, and including the user's name. However, I don't have time now. A list of the places touched by this bug (MDL-12373) will at least give a complete list of places that such a refactoring would have to touch.
This commit is contained in:
+10
-2
@@ -48,10 +48,18 @@
|
||||
|
||||
|
||||
/// output HTML
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
$coursecontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
|
||||
} else {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // Course context
|
||||
}
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
|
||||
|
||||
$strnotes = get_string('notes', 'notes');
|
||||
$nav = array();
|
||||
$nav[] = array('name' => get_string('participants'), 'link' => $CFG->wwwroot . '/user/index.php?id=' . $course->id, 'type' => 'misc');
|
||||
if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
|
||||
$nav[] = array('name' => get_string('participants'), 'link' => $CFG->wwwroot . '/user/index.php?id=' . $course->id, 'type' => 'misc');
|
||||
}
|
||||
if ($userid) {
|
||||
$nav[] = array('name' => fullname($user), 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id. '&course=' . $course->id, 'type' => 'misc');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user