MDL-53452 tool_lp: Change can_update to can_update_course

This is more consistent with other persistents.
This commit is contained in:
Damyon Wiese
2016-04-18 10:59:00 +08:00
committed by Frederic Massart
parent 9919b4af62
commit 45bf83cf77
2 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -4893,7 +4893,7 @@ class api {
$pushratingstouserplans = isset($settings->pushratingstouserplans) ? $settings->pushratingstouserplans : false;
// First we do a permissions check.
if (!course_competency_settings::can_update($courseid)) {
if (!course_competency_settings::can_update_course($courseid)) {
$context = context_course::instance($courseid);
throw new required_capability_exception($context, 'tool/lp:coursecompetencyconfigure', 'nopermissions', '');
}
@@ -98,7 +98,7 @@ class course_competency_settings extends persistent {
* @param int $data The course ID.
* @return bool
*/
public static function can_update($courseid) {
public static function can_update_course($courseid) {
$context = context_course::instance($courseid);
$capabilities = array('tool/lp:coursecompetencyconfigure');
@@ -106,6 +106,15 @@ class course_competency_settings extends persistent {
return has_any_capability($capabilities, $context);
}
/**
* Can the current user change competency settings for this course.
*
* @return bool
*/
public function can_update() {
return static::can_update_course($this->get_courseid());
}
/**
* Validate course ID.
*