MDL-45760 make sure to check permission before setting header
This commit is contained in:
committed by
Dan Poltawski
parent
6eaf5ec8e3
commit
2ca9e09dab
+5
-4
@@ -15,6 +15,10 @@ $userid = optional_param('user', 0, PARAM_INT);
|
||||
$filtertype = optional_param('filtertype', '', PARAM_ALPHA);
|
||||
$filterselect = optional_param('filterselect', 0, PARAM_INT);
|
||||
|
||||
if (empty($CFG->enablenotes)) {
|
||||
print_error('notesdisabled', 'notes');
|
||||
}
|
||||
|
||||
$url = new moodle_url('/notes/index.php');
|
||||
if ($courseid != SITEID) {
|
||||
$url->param('course', $courseid);
|
||||
@@ -67,6 +71,7 @@ if ($course->id == SITEID) {
|
||||
} else {
|
||||
$coursecontext = context_course::instance($course->id); // Course context
|
||||
}
|
||||
require_capability('moodle/notes:view', $coursecontext);
|
||||
$systemcontext = context_system::instance(); // SYSTEM context
|
||||
|
||||
// Trigger event.
|
||||
@@ -76,10 +81,6 @@ $event = \core\event\notes_viewed::create(array(
|
||||
));
|
||||
$event->trigger();
|
||||
|
||||
if (empty($CFG->enablenotes)) {
|
||||
print_error('notesdisabled', 'notes');
|
||||
}
|
||||
|
||||
$strnotes = get_string('notes', 'notes');
|
||||
if ($userid) {
|
||||
$PAGE->set_context(context_user::instance($user->id));
|
||||
|
||||
Reference in New Issue
Block a user