From face152176904c2a3586932f9c7f073acf16c143 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Mon, 17 Oct 2016 16:07:16 +0800 Subject: [PATCH] MDL-51347 core_notes: check view notes capability by course context --- notes/index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/notes/index.php b/notes/index.php index 8bff3392321..d9f97758211 100644 --- a/notes/index.php +++ b/notes/index.php @@ -185,12 +185,13 @@ if ($courseid != SITEID) { $ccontext = context_course::instance($c->id); $cfullname = format_string($c->fullname, true, array('context' => $ccontext)); $header = '' . $cfullname . ''; - if (has_capability('moodle/notes:manage', context_course::instance($c->id))) { + $viewcoursenotes = has_capability('moodle/notes:view', $ccontext); + if (has_capability('moodle/notes:manage', $ccontext)) { $addid = $c->id; } else { $addid = 0; } - note_print_notes($header, $addid, $view, $c->id, $userid, NOTES_STATE_PUBLIC, 0); + note_print_notes($header, $addid, $viewcoursenotes, $c->id, $userid, NOTES_STATE_PUBLIC, 0); } } } -- 2.43.0