Skip to content

Commit

Permalink
MDL-55135 competencies: fix capabilities managing course competencies
Browse files Browse the repository at this point in the history
Capability check in a course was using global competency capabilities 
moodle/competency:competencyview and  moodle/competency:competencymanage 
instead of the course equivalents. Users outside the course context 
could not manage course competencies.
  • Loading branch information
wjroes committed Feb 18, 2019
1 parent 1249995 commit e42d429
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions competency/classes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -4987,8 +4987,9 @@ public static function get_least_proficient_competencies_for_course($courseid, $
static::require_enabled();
$coursecontext = context_course::instance($courseid);

if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'), $coursecontext)) {
throw new required_capability_exception($coursecontext, 'moodle/competency:competencyview', 'nopermissions', '');
if (!has_any_capability(array('moodle/competency:coursecompetencyview', 'moodle/competency:coursecompetencymanage'),
$coursecontext)) {
throw new required_capability_exception($coursecontext, 'moodle/competency:coursecompetencyview', 'nopermissions', '');
}

return user_competency_course::get_least_proficient_competencies_for_course($courseid, $skip, $limit);
Expand Down

0 comments on commit e42d429

Please sign in to comment.