Permalink
Browse files

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

Namely get_num_tracked_users and is_tracked_user()
  • Loading branch information...
1 parent 10ad21d commit c208efa04cc670b0e583a34fcedc0ef2dcb14061 @srynot4sale srynot4sale committed Jan 11, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/completionlib.php
View
4 lib/completionlib.php
@@ -1021,7 +1021,7 @@ public function get_activities($modinfo=null) {
* @return bool
*/
public function is_tracked_user($userid) {
- return is_enrolled(context_course::instance($this->course->id), $userid, '', true);
+ return is_enrolled(context_course::instance($this->course->id), $userid, 'moodle/course:isincompletionreports', true);
}
/**
@@ -1038,7 +1038,7 @@ public function get_num_tracked_users($where = '', $whereparams = array(), $grou
global $DB;
list($enrolledsql, $enrolledparams) = get_enrolled_sql(
- context_course::instance($this->course->id), '', $groupid, true);
+ context_course::instance($this->course->id), 'moodle/course:isincompletionreports', $groupid, true);
$sql = 'SELECT COUNT(eu.id) FROM (' . $enrolledsql . ') eu JOIN {user} u ON u.id = eu.id';
if ($where) {
$sql .= " WHERE $where";

0 comments on commit c208efa

Please sign in to comment.