Skip to content

Commit

Permalink
MDL-51347 core_notes: check view notes capability by course context
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze authored and Mr. Jenkins (CiBoT) committed Nov 10, 2016
1 parent cf0b943 commit face152
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions notes/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@
$ccontext = context_course::instance($c->id);
$cfullname = format_string($c->fullname, true, array('context' => $ccontext));
$header = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $c->id . '">' . $cfullname . '</a>';
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);
}
}
}
Expand Down

0 comments on commit face152

Please sign in to comment.