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 David Monllao committed Oct 17, 2016
1 parent 3142206 commit 4daa276
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 @@ -190,12 +190,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 4daa276

Please sign in to comment.