MDL-37473 completion: Add missing cap checks to tracked users functions

Namely get_num_tracked_users and is_tracked_user()
This commit is contained in:
Aaron Barnes
2013-01-25 17:08:44 +13:00
parent 9da506c2a3
commit 10a8581f2b
5 changed files with 14 additions and 6 deletions
+8 -1
View File
@@ -45,6 +45,11 @@ if ($courseid) {
require_login($course);
$completion = new completion_info($course);
if (!$completion->is_enabled()) {
throw new moodle_exception('completionnotenabled', 'completion');
} elseif (!$completion->is_tracked_user($USER->id)) {
throw new moodle_exception('nottracked', 'completion');
}
// Check if we are marking a user complete via the completion report
$user = optional_param('user', 0, PARAM_INT);
@@ -136,7 +141,9 @@ if (isguestuser() or !confirm_sesskey()) {
// Now change state
$completion = new completion_info($course);
if (!$completion->is_enabled()) {
die;
throw new moodle_exception('completionnotenabled', 'completion');
} elseif (!$completion->is_tracked_user($USER->id)) {
throw new moodle_exception('nottracked', 'completion');
}
// Check completion state is manual