MDL-12373 - If you can see your user profile, but don't have moodle/course:viewparticipants, you get a link in the nav bar that takes you to an error message - this was repeated in other parts of the user profile that I had not noticed when I fixed this before.
This commit is contained in:
+8
-1
@@ -50,6 +50,11 @@
|
||||
redirect($CFG->wwwroot . "/user/view.php?course={$course->id}");
|
||||
}
|
||||
|
||||
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);
|
||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
|
||||
@@ -145,7 +150,9 @@
|
||||
$userfullname = fullname($user, true);
|
||||
|
||||
$navlinks = array();
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc');
|
||||
if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc');
|
||||
}
|
||||
$navlinks[] = array('name' => $userfullname,
|
||||
'link' => "view.php?id=$user->id&course=$course->id",
|
||||
'type' => 'misc');
|
||||
|
||||
+12
-3
@@ -17,16 +17,23 @@
|
||||
}
|
||||
require_login($course->id);
|
||||
|
||||
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);
|
||||
|
||||
if ($id == -1) {
|
||||
// creating new user
|
||||
require_capability('moodle/user:create', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/user:create', $systemcontext);
|
||||
$user = new object();
|
||||
$user->id = -1;
|
||||
$user->auth = 'manual';
|
||||
$user->confirmed = 1;
|
||||
} else {
|
||||
// editing existing user
|
||||
require_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/user:update', $systemcontext);
|
||||
if (!$user = get_record('user', 'id', $id)) {
|
||||
error('User ID was incorrect');
|
||||
}
|
||||
@@ -178,7 +185,9 @@
|
||||
$userfullname = fullname($user, true);
|
||||
|
||||
$navlinks = array();
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc');
|
||||
if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc');
|
||||
}
|
||||
$navlinks[] = array('name' => $userfullname,
|
||||
'link' => "view.php?id=$user->id&course=$course->id",
|
||||
'type' => 'misc');
|
||||
|
||||
@@ -18,8 +18,9 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/course:bulkmessaging', get_context_instance(CONTEXT_COURSE, $id));
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $id); // Course context
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
|
||||
require_capability('moodle/course:bulkmessaging', $coursecontext);
|
||||
|
||||
if (empty($SESSION->emailto)) {
|
||||
$SESSION->emailto = array();
|
||||
@@ -63,7 +64,9 @@
|
||||
}
|
||||
|
||||
$navlinks = array();
|
||||
$navlinks[] = array('name' => get_string('participants'), 'link' => "index.php?id=$course->id", 'type' => 'misc');
|
||||
if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
|
||||
$navlinks[] = array('name' => get_string('participants'), 'link' => "index.php?id=$course->id", 'type' => 'misc');
|
||||
}
|
||||
$navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user