MDL-53700 competency: Migrate capabilities to core

This commit is contained in:
Frederic Massart 2016-04-04 14:49:50 +08:00
parent 1f7699533c
commit b90e2205b4
42 changed files with 791 additions and 821 deletions

File diff suppressed because it is too large Load diff

View file

@ -488,7 +488,7 @@ class competency_framework extends persistent {
* @return bool * @return bool
*/ */
public static function can_manage_context($context) { public static function can_manage_context($context) {
return has_capability('tool/lp:competencymanage', $context); return has_capability('moodle/competency:competencymanage', $context);
} }
/** /**
@ -507,7 +507,7 @@ class competency_framework extends persistent {
* @return bool * @return bool
*/ */
public static function can_read_context($context) { public static function can_read_context($context) {
return has_capability('tool/lp:competencyview', $context) || self::can_manage_context($context); return has_capability('moodle/competency:competencyview', $context) || self::can_manage_context($context);
} }
} }

View file

@ -88,7 +88,7 @@ class course_competency_settings extends persistent {
public static function can_read($courseid) { public static function can_read($courseid) {
$context = context_course::instance($courseid); $context = context_course::instance($courseid);
$capabilities = array('tool/lp:coursecompetencyview'); $capabilities = array('moodle/competency:coursecompetencyview');
return has_any_capability($capabilities, $context); return has_any_capability($capabilities, $context);
} }
@ -102,7 +102,7 @@ class course_competency_settings extends persistent {
public static function can_manage_course($courseid) { public static function can_manage_course($courseid) {
$context = context_course::instance($courseid); $context = context_course::instance($courseid);
$capabilities = array('tool/lp:coursecompetencyconfigure'); $capabilities = array('moodle/competency:coursecompetencyconfigure');
return has_any_capability($capabilities, $context); return has_any_capability($capabilities, $context);
} }

View file

@ -54,7 +54,7 @@ class competency_framework_exporter extends persistent_exporter {
$filters = array('competencyframeworkid' => $this->persistent->get_id()); $filters = array('competencyframeworkid' => $this->persistent->get_id());
$context = $this->persistent->get_context(); $context = $this->persistent->get_context();
return array( return array(
'canmanage' => has_capability('tool/lp:competencymanage', $context), 'canmanage' => has_capability('moodle/competency:competencymanage', $context),
'competenciescount' => api::count_competencies($filters), 'competenciescount' => api::count_competencies($filters),
'contextname' => $context->get_context_name(), 'contextname' => $context->get_context_name(),
'contextnamenoprefix' => $context->get_context_name(false) 'contextnamenoprefix' => $context->get_context_name(false)

View file

@ -96,8 +96,8 @@ class course_competency_statistics_exporter extends exporter {
'proficientcompetencypercentageformatted' => $proficientcompetencypercentageformatted, 'proficientcompetencypercentageformatted' => $proficientcompetencypercentageformatted,
'leastproficient' => $competencies, 'leastproficient' => $competencies,
'leastproficientcount' => count($competencies), 'leastproficientcount' => count($competencies),
'canbegradedincourse' => has_capability('tool/lp:coursecompetencygradable', $this->related['context']), 'canbegradedincourse' => has_capability('moodle/competency:coursecompetencygradable', $this->related['context']),
'canmanagecoursecompetencies' => has_capability('tool/lp:coursecompetencymanage', $this->related['context']) 'canmanagecoursecompetencies' => has_capability('moodle/competency:coursecompetencymanage', $this->related['context'])
); );
} }
} }

View file

@ -106,7 +106,7 @@ class framework_autocomplete extends MoodleQuickForm_autocomplete {
list($insql, $inparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED, 'param'); list($insql, $inparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED, 'param');
$frameworks = competency_framework::get_records_select("id $insql", $inparams, 'shortname'); $frameworks = competency_framework::get_records_select("id $insql", $inparams, 'shortname');
foreach ($frameworks as $framework) { foreach ($frameworks as $framework) {
if (!has_any_capability(array('tool/lp:competencyview', 'tool/lp:competencymanage'), $framework->get_context())) { if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'), $framework->get_context())) {
continue; continue;
} else if ($this->onlyvisible && !$framework->get_visible()) { } else if ($this->onlyvisible && !$framework->get_visible()) {
continue; continue;

View file

@ -75,7 +75,7 @@ class plan extends persistent {
// There is only one status to select from. // There is only one status to select from.
$mform->addElement('static', 'staticstatus', get_string('status', 'tool_lp'), current($status)); $mform->addElement('static', 'staticstatus', get_string('status', 'tool_lp'), current($status));
} else { } else {
throw new required_capability_exception($context, 'tool/lp:planmanage', 'nopermissions', ''); throw new required_capability_exception($context, 'moodle/competency:planmanage', 'nopermissions', '');
} }
// Disable short forms. // Disable short forms.

View file

@ -44,7 +44,7 @@ class template_plans extends moodleform {
$options = array( $options = array(
'ajax' => 'tool_lp/form-user-selector', 'ajax' => 'tool_lp/form-user-selector',
'multiple' => true, 'multiple' => true,
'data-capability' => 'tool/lp:planmanage' 'data-capability' => 'moodle/competency:planmanage'
); );
$mform->addElement('autocomplete', 'users', get_string('selectuserstocreateplansfor', 'tool_lp'), array(), $options); $mform->addElement('autocomplete', 'users', get_string('selectuserstocreateplansfor', 'tool_lp'), array(), $options);
$mform->addElement('submit', 'submit', get_string('createplans', 'tool_lp')); $mform->addElement('submit', 'submit', get_string('createplans', 'tool_lp'));

View file

@ -78,8 +78,8 @@ class course_competencies_page implements renderable, templatable {
$this->context = context_course::instance($courseid); $this->context = context_course::instance($courseid);
$this->courseid = $courseid; $this->courseid = $courseid;
$this->coursecompetencylist = api::list_course_competencies($courseid); $this->coursecompetencylist = api::list_course_competencies($courseid);
$this->canmanagecoursecompetencies = has_capability('tool/lp:coursecompetencymanage', $this->context); $this->canmanagecoursecompetencies = has_capability('moodle/competency:coursecompetencymanage', $this->context);
$this->canconfigurecoursecompetencies = has_capability('tool/lp:coursecompetencyconfigure', $this->context); $this->canconfigurecoursecompetencies = has_capability('moodle/competency:coursecompetencyconfigure', $this->context);
$this->coursecompetencysettings = api::read_course_competency_settings($courseid); $this->coursecompetencysettings = api::read_course_competency_settings($courseid);
$this->coursecompetencystatistics = new course_competency_statistics($courseid); $this->coursecompetencystatistics = new course_competency_statistics($courseid);
@ -88,7 +88,7 @@ class course_competencies_page implements renderable, templatable {
$this->canmanagecompetencyframeworks = false; $this->canmanagecompetencyframeworks = false;
$contexts = array_reverse($this->context->get_parent_contexts(true)); $contexts = array_reverse($this->context->get_parent_contexts(true));
foreach ($contexts as $context) { foreach ($contexts as $context) {
$canmanage = has_capability('tool/lp:competencymanage', $context); $canmanage = has_capability('moodle/competency:competencymanage', $context);
if ($canmanage) { if ($canmanage) {
$this->manageurl = new moodle_url('/admin/tool/lp/competencyframeworks.php', $this->manageurl = new moodle_url('/admin/tool/lp/competencyframeworks.php',
array('pagecontextid' => $context->id)); array('pagecontextid' => $context->id));
@ -113,7 +113,7 @@ class course_competencies_page implements renderable, templatable {
$data->competencies = array(); $data->competencies = array();
$contextcache = array(); $contextcache = array();
$gradable = is_enrolled($this->context, $USER, 'tool/lp:coursecompetencygradable'); $gradable = is_enrolled($this->context, $USER, 'moodle/competency:coursecompetencygradable');
if ($gradable) { if ($gradable) {
$usercompetencycourses = api::list_user_competencies_in_course($this->courseid, $USER->id); $usercompetencycourses = api::list_user_competencies_in_course($this->courseid, $USER->id);
$data->gradableuserid = $USER->id; $data->gradableuserid = $USER->id;

View file

@ -79,7 +79,7 @@ class manage_competencies_page implements renderable, templatable {
); );
$this->navigation[] = $addpage; $this->navigation[] = $addpage;
$this->canmanage = has_capability('tool/lp:competencymanage', $framework->get_context()); $this->canmanage = has_capability('moodle/competency:competencymanage', $framework->get_context());
} }
/** /**

View file

@ -61,7 +61,7 @@ class template_cohorts_table extends table_sql {
// This object should not be used without the right permissions. // This object should not be used without the right permissions.
if (!$template->can_read()) { if (!$template->can_read()) {
throw new \required_capability_exception($template->get_context(), 'tool/lp:templateview', 'nopermissions', ''); throw new \required_capability_exception($template->get_context(), 'moodle/competency:templateview', 'nopermissions', '');
} }
// Set protected properties. // Set protected properties.

View file

@ -78,8 +78,8 @@ class template_competencies_page implements renderable, templatable {
$this->template = $template; $this->template = $template;
$this->templatestatistics = new template_statistics($template->get_id()); $this->templatestatistics = new template_statistics($template->get_id());
$this->competencies = api::list_competencies_in_template($template); $this->competencies = api::list_competencies_in_template($template);
$this->canmanagecompetencyframeworks = has_capability('tool/lp:competencymanage', $this->pagecontext); $this->canmanagecompetencyframeworks = has_capability('moodle/competency:competencymanage', $this->pagecontext);
$this->canmanagetemplatecompetencies = has_capability('tool/lp:templatemanage', $this->pagecontext); $this->canmanagetemplatecompetencies = has_capability('moodle/competency:templatemanage', $this->pagecontext);
$this->manageurl = new moodle_url('/admin/tool/lp/competencyframeworks.php', $this->manageurl = new moodle_url('/admin/tool/lp/competencyframeworks.php',
array('pagecontextid' => $this->pagecontext->id)); array('pagecontextid' => $this->pagecontext->id));
} }

View file

@ -61,7 +61,7 @@ class template_plans_table extends table_sql {
// This object should not be used without the right permissions. // This object should not be used without the right permissions.
if (!$template->can_read()) { if (!$template->can_read()) {
throw new \required_capability_exception($template->get_context(), 'tool/lp:templateview', 'nopermissions', ''); throw new \required_capability_exception($template->get_context(), 'moodle/competency:templateview', 'nopermissions', '');
} }
// Set protected properties. // Set protected properties.

View file

@ -85,7 +85,7 @@ class user_competency_course_navigation implements renderable, templatable {
$data->baseurl = $this->baseurl; $data->baseurl = $this->baseurl;
$data->groupselector = ''; $data->groupselector = '';
if (has_capability('tool/lp:coursecompetencymanage', $context)) { if (has_capability('moodle/competency:coursecompetencymanage', $context)) {
$course = $DB->get_record('course', array('id' => $this->courseid)); $course = $DB->get_record('course', array('id' => $this->courseid));
$currentgroup = groups_get_course_group($course, true); $currentgroup = groups_get_course_group($course, true);
if ($currentgroup !== false) { if ($currentgroup !== false) {
@ -97,7 +97,7 @@ class user_competency_course_navigation implements renderable, templatable {
$showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol); $showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol);
$showonlyactiveenrol = $showonlyactiveenrol || !has_capability('moodle/course:viewsuspendedusers', $context); $showonlyactiveenrol = $showonlyactiveenrol || !has_capability('moodle/course:viewsuspendedusers', $context);
$users = get_enrolled_users($context, 'tool/lp:coursecompetencygradable', $currentgroup, $users = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup,
'u.*', null, 0, 0, $showonlyactiveenrol); 'u.*', null, 0, 0, $showonlyactiveenrol);
$data->users = array(); $data->users = array();

View file

@ -364,9 +364,9 @@ class plan extends persistent {
public static function can_comment_user($planuserid) { public static function can_comment_user($planuserid) {
global $USER; global $USER;
$capabilities = array('tool/lp:plancomment'); $capabilities = array('moodle/competency:plancomment');
if ($USER->id == $planuserid) { if ($USER->id == $planuserid) {
$capabilities[] = 'tool/lp:plancommentown'; $capabilities[] = 'moodle/competency:plancommentown';
} }
return has_any_capability($capabilities, context_user::instance($planuserid)); return has_any_capability($capabilities, context_user::instance($planuserid));
@ -382,9 +382,9 @@ class plan extends persistent {
global $USER; global $USER;
$context = context_user::instance($planuserid); $context = context_user::instance($planuserid);
$capabilities = array('tool/lp:planmanage'); $capabilities = array('moodle/competency:planmanage');
if ($context->instanceid == $USER->id) { if ($context->instanceid == $USER->id) {
$capabilities[] = 'tool/lp:planmanageown'; $capabilities[] = 'moodle/competency:planmanageown';
} }
return has_any_capability($capabilities, $context); return has_any_capability($capabilities, $context);
@ -400,9 +400,9 @@ class plan extends persistent {
global $USER; global $USER;
$context = context_user::instance($planuserid); $context = context_user::instance($planuserid);
$capabilities = array('tool/lp:planmanagedraft'); $capabilities = array('moodle/competency:planmanagedraft');
if ($context->instanceid == $USER->id) { if ($context->instanceid == $USER->id) {
$capabilities[] = 'tool/lp:planmanageowndraft'; $capabilities[] = 'moodle/competency:planmanageowndraft';
} }
return has_any_capability($capabilities, $context); return has_any_capability($capabilities, $context);
@ -429,9 +429,9 @@ class plan extends persistent {
global $USER; global $USER;
$context = context_user::instance($planuserid); $context = context_user::instance($planuserid);
$capabilities = array('tool/lp:planview'); $capabilities = array('moodle/competency:planview');
if ($context->instanceid == $USER->id) { if ($context->instanceid == $USER->id) {
$capabilities[] = 'tool/lp:planviewown'; $capabilities[] = 'moodle/competency:planviewown';
} }
return has_any_capability($capabilities, $context) return has_any_capability($capabilities, $context)
@ -448,9 +448,9 @@ class plan extends persistent {
global $USER; global $USER;
$context = context_user::instance($planuserid); $context = context_user::instance($planuserid);
$capabilities = array('tool/lp:planviewdraft'); $capabilities = array('moodle/competency:planviewdraft');
if ($context->instanceid == $USER->id) { if ($context->instanceid == $USER->id) {
$capabilities[] = 'tool/lp:planviewowndraft'; $capabilities[] = 'moodle/competency:planviewowndraft';
} }
return has_any_capability($capabilities, $context) return has_any_capability($capabilities, $context)
@ -466,9 +466,9 @@ class plan extends persistent {
public static function can_request_review_user($planuserid) { public static function can_request_review_user($planuserid) {
global $USER; global $USER;
$capabilities = array('tool/lp:planrequestreview'); $capabilities = array('moodle/competency:planrequestreview');
if ($USER->id == $planuserid) { if ($USER->id == $planuserid) {
$capabilities[] = 'tool/lp:planrequestreviewown'; $capabilities[] = 'moodle/competency:planrequestreviewown';
} }
return has_any_capability($capabilities, context_user::instance($planuserid)); return has_any_capability($capabilities, context_user::instance($planuserid));
@ -483,7 +483,7 @@ class plan extends persistent {
* @return bool * @return bool
*/ */
public static function can_review_user($planuserid) { public static function can_review_user($planuserid) {
return has_capability('tool/lp:planreview', context_user::instance($planuserid)) return has_capability('moodle/competency:planreview', context_user::instance($planuserid))
|| self::can_manage_user($planuserid); || self::can_manage_user($planuserid);
} }

View file

@ -114,7 +114,7 @@ class template extends persistent {
* @return bool * @return bool
*/ */
public static function can_manage_context($context) { public static function can_manage_context($context) {
return has_capability('tool/lp:templatemanage', $context); return has_capability('moodle/competency:templatemanage', $context);
} }
/** /**
@ -133,7 +133,7 @@ class template extends persistent {
* @return bool * @return bool
*/ */
public static function can_read_context($context) { public static function can_read_context($context) {
return has_capability('tool/lp:templateview', $context) || self::can_manage_context($context); return has_capability('moodle/competency:templateview', $context) || self::can_manage_context($context);
} }
/** /**

View file

@ -335,9 +335,9 @@ class user_competency extends persistent {
public static function can_comment_user($userid) { public static function can_comment_user($userid) {
global $USER; global $USER;
$capabilities = array('tool/lp:usercompetencycomment'); $capabilities = array('moodle/competency:usercompetencycomment');
if ($USER->id == $userid) { if ($USER->id == $userid) {
$capabilities[] = 'tool/lp:usercompetencycommentown'; $capabilities[] = 'moodle/competency:usercompetencycommentown';
} }
if (has_any_capability($capabilities, context_user::instance($userid))) { if (has_any_capability($capabilities, context_user::instance($userid))) {
@ -354,7 +354,7 @@ class user_competency extends persistent {
* @return bool * @return bool
*/ */
public static function can_grade_user($userid) { public static function can_grade_user($userid) {
$ratecap = 'tool/lp:competencygrade'; $ratecap = 'moodle/competency:competencygrade';
return has_capability($ratecap, context_user::instance($userid)); return has_capability($ratecap, context_user::instance($userid));
} }
@ -366,7 +366,7 @@ class user_competency extends persistent {
* @return bool * @return bool
*/ */
public static function can_grade_user_in_course($userid, $courseid) { public static function can_grade_user_in_course($userid, $courseid) {
$ratecap = 'tool/lp:competencygrade'; $ratecap = 'moodle/competency:competencygrade';
return has_capability($ratecap, context_course::instance($courseid)) return has_capability($ratecap, context_course::instance($courseid))
|| static::can_grade_user($userid); || static::can_grade_user($userid);
} }
@ -390,7 +390,7 @@ class user_competency extends persistent {
* @return bool * @return bool
*/ */
public static function can_read_user_in_course($userid, $courseid) { public static function can_read_user_in_course($userid, $courseid) {
$capability = 'tool/lp:usercompetencyview'; $capability = 'moodle/competency:usercompetencyview';
return has_capability($capability, context_course::instance($courseid)) return has_capability($capability, context_course::instance($courseid))
|| static::can_read_user($userid); || static::can_read_user($userid);
} }
@ -402,7 +402,7 @@ class user_competency extends persistent {
* @return bool * @return bool
*/ */
public static function can_read_user($userid) { public static function can_read_user($userid) {
$capability = 'tool/lp:usercompetencyview'; $capability = 'moodle/competency:usercompetencyview';
return has_capability($capability, context_user::instance($userid)) return has_capability($capability, context_user::instance($userid))
|| plan::can_read_user($userid); || plan::can_read_user($userid);
} }
@ -420,9 +420,9 @@ class user_competency extends persistent {
public static function can_request_review_user($userid) { public static function can_request_review_user($userid) {
global $USER; global $USER;
$capabilities = array('tool/lp:usercompetencyrequestreview'); $capabilities = array('moodle/competency:usercompetencyrequestreview');
if ($USER->id == $userid) { if ($USER->id == $userid) {
$capabilities[] = 'tool/lp:usercompetencyrequestreviewown'; $capabilities[] = 'moodle/competency:usercompetencyrequestreviewown';
} }
if (has_any_capability($capabilities, context_user::instance($userid))) { if (has_any_capability($capabilities, context_user::instance($userid))) {
@ -439,7 +439,7 @@ class user_competency extends persistent {
* @return bool * @return bool
*/ */
public static function can_review_user($userid) { public static function can_review_user($userid) {
$capability = 'tool/lp:usercompetencyreview'; $capability = 'moodle/competency:usercompetencyreview';
return has_capability($capability, context_user::instance($userid)); return has_capability($capability, context_user::instance($userid));
} }

View file

@ -170,9 +170,9 @@ class user_evidence extends persistent {
global $USER; global $USER;
$context = context_user::instance($evidenceuserid); $context = context_user::instance($evidenceuserid);
$capabilities = array('tool/lp:userevidencemanage'); $capabilities = array('moodle/competency:userevidencemanage');
if ($context->instanceid == $USER->id) { if ($context->instanceid == $USER->id) {
$capabilities[] = 'tool/lp:userevidencemanageown'; $capabilities[] = 'moodle/competency:userevidencemanageown';
} }
return has_any_capability($capabilities, $context); return has_any_capability($capabilities, $context);
@ -187,7 +187,7 @@ class user_evidence extends persistent {
public static function can_read_user($evidenceuserid) { public static function can_read_user($evidenceuserid) {
$context = context_user::instance($evidenceuserid); $context = context_user::instance($evidenceuserid);
$capabilities = array('tool/lp:userevidenceview'); $capabilities = array('moodle/competency:userevidenceview');
return has_any_capability($capabilities, $context) || self::can_manage_user($evidenceuserid); return has_any_capability($capabilities, $context) || self::can_manage_user($evidenceuserid);
} }

View file

@ -37,7 +37,7 @@ $framework = \tool_lp\api::read_framework($id);
$context = $framework->get_context(); $context = $framework->get_context();
if (!\tool_lp\competency_framework::can_read_context($context)) { if (!\tool_lp\competency_framework::can_read_context($context)) {
throw new required_capability_exception($context, 'tool/lp:competencyview', 'nopermissions', ''); throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
} }
$title = get_string('competencies', 'tool_lp'); $title = get_string('competencies', 'tool_lp');

View file

@ -35,7 +35,7 @@ require_login();
\tool_lp\api::require_enabled(); \tool_lp\api::require_enabled();
if (!\tool_lp\competency_framework::can_read_context($context)) { if (!\tool_lp\competency_framework::can_read_context($context)) {
throw new required_capability_exception($context, 'tool/lp:competencyview', 'nopermissions', ''); throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
} }
$title = get_string('competencies', 'tool_lp'); $title = get_string('competencies', 'tool_lp');

View file

@ -1,263 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Capabilities.
*
* This files lists capabilities related to tool_lp.
*
* @package tool_lp
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
// Competencies.
'tool/lp:competencymanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
'manager' => CAP_ALLOW
)
),
'tool/lp:competencyview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
'tool/lp:competencygrade' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE, // And CONTEXT_USER.
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
),
// Course competencies.
'tool/lp:coursecompetencymanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:backup'
),
'tool/lp:coursecompetencyconfigure' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:backup'
),
'tool/lp:coursecompetencygradable' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'student' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/course:isincompletionreports'
),
'tool/lp:coursecompetencyview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
// User plans.
'tool/lp:planmanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planmanagedraft' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planmanageown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planmanageowndraft' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planviewdraft' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planviewown' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
'tool/lp:planviewowndraft' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planrequestreview' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
)
),
'tool/lp:planrequestreviewown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
)
),
'tool/lp:planreview' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:plancomment' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:plancommentown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
),
),
// User competencies.
'tool/lp:usercompetencyview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER, // And CONTEXT_COURSE.
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'teacher' => CAP_ALLOW
)
),
'tool/lp:usercompetencyrequestreview' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
)
),
'tool/lp:usercompetencyrequestreviewown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
)
),
'tool/lp:usercompetencyreview' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:usercompetencycomment' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:usercompetencycommentown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
),
),
// Template.
'tool/lp:templatemanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:templateview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
// User evidence.
'tool/lp:userevidencemanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:userevidencemanageown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
'tool/lp:userevidenceview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
);

View file

@ -36,7 +36,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Creates new competency frameworks.', 'description' => 'Creates new competency frameworks.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_read_competency_framework' => array( 'tool_lp_read_competency_framework' => array(
@ -45,7 +45,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a summary of a competency framework.', 'description' => 'Load a summary of a competency framework.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_duplicate_competency_framework' => array( 'tool_lp_duplicate_competency_framework' => array(
@ -54,7 +54,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Duplicate a competency framework.', 'description' => 'Duplicate a competency framework.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_delete_competency_framework' => array( 'tool_lp_delete_competency_framework' => array(
@ -63,7 +63,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Delete a competency framework.', 'description' => 'Delete a competency framework.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_update_competency_framework' => array( 'tool_lp_update_competency_framework' => array(
@ -72,7 +72,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Update a competency framework.', 'description' => 'Update a competency framework.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_list_competency_frameworks' => array( 'tool_lp_list_competency_frameworks' => array(
@ -81,7 +81,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a list of a competency frameworks.', 'description' => 'Load a list of a competency frameworks.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_count_competency_frameworks' => array( 'tool_lp_count_competency_frameworks' => array(
@ -90,7 +90,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Count a list of a competency frameworks.', 'description' => 'Count a list of a competency frameworks.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_competency_framework_viewed' => array( 'tool_lp_competency_framework_viewed' => array(
@ -99,7 +99,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Log event competency framework viewed', 'description' => 'Log event competency framework viewed',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_competency_frameworks_manage_page' => array( 'tool_lp_data_for_competency_frameworks_manage_page' => array(
@ -108,7 +108,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the competency frameworks manage page template', 'description' => 'Load the data for the competency frameworks manage page template',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_create_competency' => array( 'tool_lp_create_competency' => array(
@ -117,7 +117,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Creates new competencies.', 'description' => 'Creates new competencies.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_read_competency' => array( 'tool_lp_read_competency' => array(
@ -126,7 +126,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a summary of a competency.', 'description' => 'Load a summary of a competency.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_competency_viewed' => array( 'tool_lp_competency_viewed' => array(
@ -135,7 +135,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Log event competency viewed', 'description' => 'Log event competency viewed',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_delete_competency' => array( 'tool_lp_delete_competency' => array(
@ -144,7 +144,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Delete a competency.', 'description' => 'Delete a competency.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_update_competency' => array( 'tool_lp_update_competency' => array(
@ -153,7 +153,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Update a competency.', 'description' => 'Update a competency.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_competency_summary' => array( 'tool_lp_data_for_competency_summary' => array(
@ -162,7 +162,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load competency data for summary template.', 'description' => 'Load competency data for summary template.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_list_competencies' => array( 'tool_lp_list_competencies' => array(
@ -171,7 +171,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a list of a competencies.', 'description' => 'Load a list of a competencies.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_list_competencies_in_template' => array( 'tool_lp_list_competencies_in_template' => array(
@ -180,7 +180,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a list of a competencies for a given template.', 'description' => 'Load a list of a competencies for a given template.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_count_competencies' => array( 'tool_lp_count_competencies' => array(
@ -189,7 +189,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Count a list of a competencies.', 'description' => 'Count a list of a competencies.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_count_competencies_in_template' => array( 'tool_lp_count_competencies_in_template' => array(
@ -198,7 +198,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Count a list of a competencies for a given template.', 'description' => 'Count a list of a competencies for a given template.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_search_competencies' => array( 'tool_lp_search_competencies' => array(
@ -207,7 +207,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Search a list of a competencies.', 'description' => 'Search a list of a competencies.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_competencies_manage_page' => array( 'tool_lp_data_for_competencies_manage_page' => array(
@ -216,7 +216,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the competencies manage page template', 'description' => 'Load the data for the competencies manage page template',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_set_parent_competency' => array( 'tool_lp_set_parent_competency' => array(
@ -225,7 +225,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Set a new parent for a competency.', 'description' => 'Set a new parent for a competency.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_move_up_competency' => array( 'tool_lp_move_up_competency' => array(
@ -234,7 +234,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Re-order a competency.', 'description' => 'Re-order a competency.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_move_down_competency' => array( 'tool_lp_move_down_competency' => array(
@ -243,7 +243,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Re-order a competency.', 'description' => 'Re-order a competency.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_list_course_competencies' => array( 'tool_lp_list_course_competencies' => array(
@ -252,7 +252,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'List the competencies in a course', 'description' => 'List the competencies in a course',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyview', 'capabilities' => 'moodle/competency:coursecompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_list_courses_using_competency' => array( 'tool_lp_list_courses_using_competency' => array(
@ -261,7 +261,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'List the courses using a competency', 'description' => 'List the courses using a competency',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyview', 'capabilities' => 'moodle/competency:coursecompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_count_competencies_in_course' => array( 'tool_lp_count_competencies_in_course' => array(
@ -270,7 +270,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'List the competencies in a course', 'description' => 'List the competencies in a course',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyview', 'capabilities' => 'moodle/competency:coursecompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_count_courses_using_competency' => array( 'tool_lp_count_courses_using_competency' => array(
@ -279,7 +279,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'List the courses using a competency', 'description' => 'List the courses using a competency',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyview', 'capabilities' => 'moodle/competency:coursecompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_add_competency_to_course' => array( 'tool_lp_add_competency_to_course' => array(
@ -288,7 +288,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Add the competency to a course', 'description' => 'Add the competency to a course',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:coursecompetencymanage', 'capabilities' => 'moodle/competency:coursecompetencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_add_competency_to_template' => array( 'tool_lp_add_competency_to_template' => array(
@ -297,7 +297,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Add the competency to a template', 'description' => 'Add the competency to a template',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:templatemanage', 'capabilities' => 'moodle/competency:templatemanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_remove_competency_from_course' => array( 'tool_lp_remove_competency_from_course' => array(
@ -306,7 +306,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Remove a competency from a course', 'description' => 'Remove a competency from a course',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:coursecompetencymanage', 'capabilities' => 'moodle/competency:coursecompetencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_set_course_competency_ruleoutcome' => array( 'tool_lp_set_course_competency_ruleoutcome' => array(
@ -315,7 +315,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Modify the ruleoutcome value for course competency', 'description' => 'Modify the ruleoutcome value for course competency',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:coursecompetencymanage', 'capabilities' => 'moodle/competency:coursecompetencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_remove_competency_from_template' => array( 'tool_lp_remove_competency_from_template' => array(
@ -324,7 +324,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Remove a competency from a template', 'description' => 'Remove a competency from a template',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:templatemanage', 'capabilities' => 'moodle/competency:templatemanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_course_competencies_page' => array( 'tool_lp_data_for_course_competencies_page' => array(
@ -333,7 +333,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the course competencies page template.', 'description' => 'Load the data for the course competencies page template.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyview', 'capabilities' => 'moodle/competency:coursecompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_template_competencies_page' => array( 'tool_lp_data_for_template_competencies_page' => array(
@ -342,7 +342,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the template competencies page template.', 'description' => 'Load the data for the template competencies page template.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:templateview', 'capabilities' => 'moodle/competency:templateview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_reorder_course_competency' => array( 'tool_lp_reorder_course_competency' => array(
@ -351,7 +351,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Move a course competency to a new relative sort order.', 'description' => 'Move a course competency to a new relative sort order.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:coursecompetencymanage', 'capabilities' => 'moodle/competency:coursecompetencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_reorder_template_competency' => array( 'tool_lp_reorder_template_competency' => array(
@ -360,7 +360,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Move a template competency to a new relative sort order.', 'description' => 'Move a template competency to a new relative sort order.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:templatemanage', 'capabilities' => 'moodle/competency:templatemanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_create_template' => array( 'tool_lp_create_template' => array(
@ -369,7 +369,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Creates new learning plan templates.', 'description' => 'Creates new learning plan templates.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:templatemanage', 'capabilities' => 'moodle/competency:templatemanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_duplicate_template' => array( 'tool_lp_duplicate_template' => array(
@ -378,7 +378,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Duplicate learning plan template.', 'description' => 'Duplicate learning plan template.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:templatemanage', 'capabilities' => 'moodle/competency:templatemanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_read_template' => array( 'tool_lp_read_template' => array(
@ -387,7 +387,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a summary of a learning plan template.', 'description' => 'Load a summary of a learning plan template.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:templateview', 'capabilities' => 'moodle/competency:templateview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_delete_template' => array( 'tool_lp_delete_template' => array(
@ -396,7 +396,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Delete a learning plan template.', 'description' => 'Delete a learning plan template.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:templatemanage', 'capabilities' => 'moodle/competency:templatemanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_update_template' => array( 'tool_lp_update_template' => array(
@ -405,7 +405,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Update a learning plan template.', 'description' => 'Update a learning plan template.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:templatemanage', 'capabilities' => 'moodle/competency:templatemanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_list_templates' => array( 'tool_lp_list_templates' => array(
@ -414,7 +414,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a list of a learning plan templates.', 'description' => 'Load a list of a learning plan templates.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:templateview', 'capabilities' => 'moodle/competency:templateview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_list_templates_using_competency' => array( 'tool_lp_list_templates_using_competency' => array(
@ -423,7 +423,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a list of a learning plan templates for a given competency.', 'description' => 'Load a list of a learning plan templates for a given competency.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:templateview', 'capabilities' => 'moodle/competency:templateview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_count_templates' => array( 'tool_lp_count_templates' => array(
@ -432,7 +432,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Count a list of a learning plan templates.', 'description' => 'Count a list of a learning plan templates.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:templateview', 'capabilities' => 'moodle/competency:templateview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_count_templates_using_competency' => array( 'tool_lp_count_templates_using_competency' => array(
@ -441,7 +441,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Count a list of a learning plan templates for a given competency.', 'description' => 'Count a list of a learning plan templates for a given competency.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:templateview', 'capabilities' => 'moodle/competency:templateview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_templates_manage_page' => array( 'tool_lp_data_for_templates_manage_page' => array(
@ -450,7 +450,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the learning plan templates manage page template', 'description' => 'Load the data for the learning plan templates manage page template',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:templateview', 'capabilities' => 'moodle/competency:templateview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_create_plan' => array( 'tool_lp_create_plan' => array(
@ -459,7 +459,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Creates a learning plan.', 'description' => 'Creates a learning plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_update_plan' => array( 'tool_lp_update_plan' => array(
@ -468,7 +468,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Updates a learning plan.', 'description' => 'Updates a learning plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_complete_plan' => array( 'tool_lp_complete_plan' => array(
@ -477,7 +477,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Complete learning plan.', 'description' => 'Complete learning plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_reopen_plan' => array( 'tool_lp_reopen_plan' => array(
@ -486,7 +486,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Reopen learning plan.', 'description' => 'Reopen learning plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_read_plan' => array( 'tool_lp_read_plan' => array(
@ -495,7 +495,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a learning plan.', 'description' => 'Load a learning plan.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:planviewown', 'capabilities' => 'moodle/competency:planviewown',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_delete_plan' => array( 'tool_lp_delete_plan' => array(
@ -504,7 +504,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Delete a learning plan.', 'description' => 'Delete a learning plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_list_user_plans' => array( 'tool_lp_list_user_plans' => array(
@ -513,7 +513,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'List a user\'s learning plans.', 'description' => 'List a user\'s learning plans.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:planviewown', 'capabilities' => 'moodle/competency:planviewown',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_plans_page' => array( 'tool_lp_data_for_plans_page' => array(
@ -522,7 +522,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the plans page template', 'description' => 'Load the data for the plans page template',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:planviewown', 'capabilities' => 'moodle/competency:planviewown',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_plan_page' => array( 'tool_lp_data_for_plan_page' => array(
@ -531,7 +531,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the plan page template.', 'description' => 'Load the data for the plan page template.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:planview', 'capabilities' => 'moodle/competency:planview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_list_plan_competencies' => array( 'tool_lp_list_plan_competencies' => array(
@ -540,7 +540,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'List the competencies in a plan', 'description' => 'List the competencies in a plan',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:planviewown', 'capabilities' => 'moodle/competency:planviewown',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_add_competency_to_plan' => array( 'tool_lp_add_competency_to_plan' => array(
@ -549,7 +549,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Add the competency to a learning plan', 'description' => 'Add the competency to a learning plan',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_remove_competency_from_plan' => array( 'tool_lp_remove_competency_from_plan' => array(
@ -558,7 +558,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Remove the competency from a learning plan', 'description' => 'Remove the competency from a learning plan',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_reorder_plan_competency' => array( 'tool_lp_reorder_plan_competency' => array(
@ -567,7 +567,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Move a plan competency to a new relative sort order.', 'description' => 'Move a plan competency to a new relative sort order.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_plan_request_review' => array( 'tool_lp_plan_request_review' => array(
@ -576,7 +576,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Request for a plan to be reviewed.', 'description' => 'Request for a plan to be reviewed.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanagedraft', 'capabilities' => 'moodle/competency:planmanagedraft',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_plan_start_review' => array( 'tool_lp_plan_start_review' => array(
@ -585,7 +585,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Start the review of a plan.', 'description' => 'Start the review of a plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_plan_stop_review' => array( 'tool_lp_plan_stop_review' => array(
@ -594,7 +594,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Stop the review of a plan.', 'description' => 'Stop the review of a plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_plan_cancel_review_request' => array( 'tool_lp_plan_cancel_review_request' => array(
@ -603,7 +603,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Cancel the review of a plan.', 'description' => 'Cancel the review of a plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanagedraft', 'capabilities' => 'moodle/competency:planmanagedraft',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_approve_plan' => array( 'tool_lp_approve_plan' => array(
@ -612,7 +612,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Approve a plan.', 'description' => 'Approve a plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_unapprove_plan' => array( 'tool_lp_unapprove_plan' => array(
@ -621,7 +621,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Unapprove a plan.', 'description' => 'Unapprove a plan.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_template_has_related_data' => array( 'tool_lp_template_has_related_data' => array(
@ -630,7 +630,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Check if a template has related data', 'description' => 'Check if a template has related data',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:templateview', 'capabilities' => 'moodle/competency:templateview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_get_scale_values' => array( 'tool_lp_get_scale_values' => array(
@ -639,7 +639,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Fetch the values for a specific scale', 'description' => 'Fetch the values for a specific scale',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_add_related_competency' => array( 'tool_lp_add_related_competency' => array(
@ -648,7 +648,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Adds a related competency', 'description' => 'Adds a related competency',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_remove_related_competency' => array( 'tool_lp_remove_related_competency' => array(
@ -657,7 +657,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Remove a related competency', 'description' => 'Remove a related competency',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencymanage', 'capabilities' => 'moodle/competency:competencymanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_related_competencies_section' => array( 'tool_lp_data_for_related_competencies_section' => array(
@ -666,7 +666,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the related competencies template.', 'description' => 'Load the data for the related competencies template.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:competencyview', 'capabilities' => 'moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_search_users' => array( 'tool_lp_search_users' => array(
@ -695,7 +695,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Read an evidence of prior learning.', 'description' => 'Read an evidence of prior learning.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:userevidenceview', 'capabilities' => 'moodle/competency:userevidenceview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_delete_user_evidence' => array( 'tool_lp_delete_user_evidence' => array(
@ -704,7 +704,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Delete an evidence of prior learning.', 'description' => 'Delete an evidence of prior learning.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:userevidencemanageown', 'capabilities' => 'moodle/competency:userevidencemanageown',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_user_evidence_list_page' => array( 'tool_lp_data_for_user_evidence_list_page' => array(
@ -713,7 +713,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the user evidence list page template', 'description' => 'Load the data for the user evidence list page template',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:userevidenceview', 'capabilities' => 'moodle/competency:userevidenceview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_user_evidence_page' => array( 'tool_lp_data_for_user_evidence_page' => array(
@ -722,7 +722,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load the data for the user evidence page template', 'description' => 'Load the data for the user evidence page template',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:userevidenceview', 'capabilities' => 'moodle/competency:userevidenceview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_create_user_evidence_competency' => array( 'tool_lp_create_user_evidence_competency' => array(
@ -731,7 +731,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Create an evidence of prior learning relationship with a competency.', 'description' => 'Create an evidence of prior learning relationship with a competency.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:userevidencemanageown, tool/lp:competencyview', 'capabilities' => 'moodle/competency:userevidencemanageown, moodle/competency:competencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_delete_user_evidence_competency' => array( 'tool_lp_delete_user_evidence_competency' => array(
@ -740,7 +740,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Delete an evidence of prior learning relationship with a competency.', 'description' => 'Delete an evidence of prior learning relationship with a competency.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:userevidencemanageown', 'capabilities' => 'moodle/competency:userevidencemanageown',
'ajax' => true, 'ajax' => true,
), ),
@ -751,7 +751,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Cancel a review request.', 'description' => 'Cancel a review request.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:userevidencemanageown', 'capabilities' => 'moodle/competency:userevidencemanageown',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_user_competency_request_review' => array( 'tool_lp_user_competency_request_review' => array(
@ -760,7 +760,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Request a review.', 'description' => 'Request a review.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:userevidencemanageown', 'capabilities' => 'moodle/competency:userevidencemanageown',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_user_competency_start_review' => array( 'tool_lp_user_competency_start_review' => array(
@ -769,7 +769,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Start a review.', 'description' => 'Start a review.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencygrade', 'capabilities' => 'moodle/competency:competencygrade',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_user_competency_stop_review' => array( 'tool_lp_user_competency_stop_review' => array(
@ -778,7 +778,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Stop a review.', 'description' => 'Stop a review.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencygrade', 'capabilities' => 'moodle/competency:competencygrade',
'ajax' => true, 'ajax' => true,
), ),
@ -788,7 +788,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a summary of a user competency.', 'description' => 'Load a summary of a user competency.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:planview', 'capabilities' => 'moodle/competency:planview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_user_competency_viewed' => array( 'tool_lp_user_competency_viewed' => array(
@ -797,7 +797,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Log the user competency viewed event.', 'description' => 'Log the user competency viewed event.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:usercompetencyview', 'capabilities' => 'moodle/competency:usercompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_user_competency_viewed_in_plan' => array( 'tool_lp_user_competency_viewed_in_plan' => array(
@ -806,7 +806,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Log the user competency viewed in plan event.', 'description' => 'Log the user competency viewed in plan event.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:usercompetencyview', 'capabilities' => 'moodle/competency:usercompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_user_competency_viewed_in_course' => array( 'tool_lp_user_competency_viewed_in_course' => array(
@ -815,7 +815,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Log the user competency viewed in course event', 'description' => 'Log the user competency viewed in course event',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:usercompetencyview', 'capabilities' => 'moodle/competency:usercompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_user_competency_plan_viewed' => array( 'tool_lp_user_competency_plan_viewed' => array(
@ -824,7 +824,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Log the user competency plan viewed event.', 'description' => 'Log the user competency plan viewed event.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:usercompetencyview', 'capabilities' => 'moodle/competency:usercompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_grade_competency' => array( 'tool_lp_grade_competency' => array(
@ -833,7 +833,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Grade a competency.', 'description' => 'Grade a competency.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencygrade', 'capabilities' => 'moodle/competency:competencygrade',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_grade_competency_in_plan' => array( 'tool_lp_grade_competency_in_plan' => array(
@ -842,7 +842,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Grade a competency from the user plan page.', 'description' => 'Grade a competency from the user plan page.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencygrade', 'capabilities' => 'moodle/competency:competencygrade',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_user_competency_summary_in_plan' => array( 'tool_lp_data_for_user_competency_summary_in_plan' => array(
@ -851,7 +851,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a summary of a user competency.', 'description' => 'Load a summary of a user competency.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:planview', 'capabilities' => 'moodle/competency:planview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_grade_competency_in_course' => array( 'tool_lp_grade_competency_in_course' => array(
@ -860,7 +860,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Grade a competency from the course page.', 'description' => 'Grade a competency from the course page.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:competencygrade', 'capabilities' => 'moodle/competency:competencygrade',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_data_for_user_competency_summary_in_course' => array( 'tool_lp_data_for_user_competency_summary_in_course' => array(
@ -869,7 +869,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Load a summary of a user competency.', 'description' => 'Load a summary of a user competency.',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyview', 'capabilities' => 'moodle/competency:coursecompetencyview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_unlink_plan_from_template' => array( 'tool_lp_unlink_plan_from_template' => array(
@ -878,7 +878,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Unlink a plan form it template.', 'description' => 'Unlink a plan form it template.',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:planmanage', 'capabilities' => 'moodle/competency:planmanage',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_view_template' => array( 'tool_lp_view_template' => array(
@ -887,7 +887,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Log event template viewed', 'description' => 'Log event template viewed',
'type' => 'read', 'type' => 'read',
'capabilities' => 'tool/lp:templateview', 'capabilities' => 'moodle/competency:templateview',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_request_review_of_user_evidence_linked_competencies' => array( 'tool_lp_request_review_of_user_evidence_linked_competencies' => array(
@ -896,7 +896,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Send user evidence competencies in review', 'description' => 'Send user evidence competencies in review',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:userevidencemanageown', 'capabilities' => 'moodle/competency:userevidencemanageown',
'ajax' => true, 'ajax' => true,
), ),
'tool_lp_update_course_competency_settings' => array( 'tool_lp_update_course_competency_settings' => array(
@ -905,7 +905,7 @@ $functions = array(
'classpath' => '', 'classpath' => '',
'description' => 'Update the course competency settings', 'description' => 'Update the course competency settings',
'type' => 'write', 'type' => 'write',
'capabilities' => 'tool/lp:coursecompetencyconfigure', 'capabilities' => 'moodle/competency:coursecompetencyconfigure',
'ajax' => true, 'ajax' => true,
), ),
); );

View file

@ -41,7 +41,7 @@ if (!empty($id)) {
// We check that we have the permission to edit this framework, in its own context. // We check that we have the permission to edit this framework, in its own context.
require_login(); require_login();
\tool_lp\api::require_enabled(); \tool_lp\api::require_enabled();
require_capability('tool/lp:competencymanage', $context); require_capability('moodle/competency:competencymanage', $context);
// Set up the framework page. // Set up the framework page.
list($pagetitle, $pagesubtitle, $url, $frameworksurl) = tool_lp\page_helper::setup_for_framework($id, list($pagetitle, $pagesubtitle, $url, $frameworksurl) = tool_lp\page_helper::setup_for_framework($id,

View file

@ -62,13 +62,13 @@ $cancreate = \tool_lp\plan::can_manage_user_draft($userid) || \tool_lp\plan::can
// If editing plan, check if user has permissions to edit it. // If editing plan, check if user has permissions to edit it.
if ($plan != null) { if ($plan != null) {
if (!$plan->can_manage()) { if (!$plan->can_manage()) {
throw new required_capability_exception($PAGE->context, 'tool/lp:planmanage', 'nopermissions', ''); throw new required_capability_exception($PAGE->context, 'moodle/competency:planmanage', 'nopermissions', '');
} }
if (!$plan->can_be_edited()) { if (!$plan->can_be_edited()) {
throw new coding_exception('Completed plan can not be edited'); throw new coding_exception('Completed plan can not be edited');
} }
} else if (!$cancreate) { } else if (!$cancreate) {
throw new required_capability_exception($PAGE->context, 'tool/lp:planmanage', 'nopermissions', ''); throw new required_capability_exception($PAGE->context, 'moodle/competency:planmanage', 'nopermissions', '');
} }
$form = new \tool_lp\form\plan($url->out(false), $customdata); $form = new \tool_lp\form\plan($url->out(false), $customdata);

View file

@ -41,7 +41,7 @@ if (!empty($id)) {
// We check that we have the permission to edit this framework, in its own context. // We check that we have the permission to edit this framework, in its own context.
require_login(0, false); require_login(0, false);
\tool_lp\api::require_enabled(); \tool_lp\api::require_enabled();
require_capability('tool/lp:templatemanage', $context); require_capability('moodle/competency:templatemanage', $context);
// We keep the original context in the URLs, so that we remain in the same context. // We keep the original context in the URLs, so that we remain in the same context.
$url = new moodle_url("/admin/tool/lp/edittemplate.php", [ $url = new moodle_url("/admin/tool/lp/edittemplate.php", [

View file

@ -201,37 +201,6 @@ $string['listplanscaption'] = 'List of learning plans';
$string['listtemplatescaption'] = 'List of learning plan templates'; $string['listtemplatescaption'] = 'List of learning plan templates';
$string['loading'] = 'Loading...'; $string['loading'] = 'Loading...';
$string['locatecompetency'] = 'Locate competency'; $string['locatecompetency'] = 'Locate competency';
$string['lp:competencymanage'] = 'Manage competency frameworks';
$string['lp:competencygrade'] = 'Set competency grade';
$string['lp:competencyview'] = 'View competency frameworks';
$string['lp:coursecompetencygradable'] = 'Receive competency marks';
$string['lp:coursecompetencyconfigure'] = 'Configure course competency settings';
$string['lp:coursecompetencymanage'] = 'Manage course competencies';
$string['lp:coursecompetencyview'] = 'View course competencies';
$string['lp:plancomment'] = 'Comment on a learning plan';
$string['lp:plancommentown'] = 'Comment on own learning plan';
$string['lp:planmanage'] = 'Manage learning plans';
$string['lp:planmanagedraft'] = 'Manage draft learning plans';
$string['lp:planmanageown'] = 'Manage own learning plans';
$string['lp:planmanageowndraft'] = 'Manage own draft learning plans';
$string['lp:planrequestreview'] = 'Request the review of a learning plan';
$string['lp:planrequestreviewown'] = 'Request the review of own learning plan';
$string['lp:planreview'] = 'Review a learning plan';
$string['lp:planview'] = 'View all learning plans';
$string['lp:planviewdraft'] = 'View draft learning plans';
$string['lp:planviewown'] = 'View own learning plans';
$string['lp:planviewowndraft'] = 'View own draft learning plans';
$string['lp:templatemanage'] = 'Manage templates';
$string['lp:templateview'] = 'View template';
$string['lp:usercompetencycomment'] = 'Comment on a user competency';
$string['lp:usercompetencycommentown'] = 'Comment on own user competency';
$string['lp:usercompetencyrequestreview'] = 'Request the review of a user competency';
$string['lp:usercompetencyrequestreviewown'] = 'Request the review of own user competency';
$string['lp:usercompetencyreview'] = 'Review a user competency';
$string['lp:usercompetencyview'] = 'View a user competency';
$string['lp:userevidencemanage'] = 'Manage evidence of prior learning';
$string['lp:userevidencemanageown'] = 'Manage own evidence of prior learning';
$string['lp:userevidenceview'] = 'View evidence of prior learning of a user';
$string['managecompetenciesandframeworks'] = 'Manage competencies and frameworks'; $string['managecompetenciesandframeworks'] = 'Manage competencies and frameworks';
$string['messageprovider:user_competency_comment'] = 'Comment posted on a competency.'; $string['messageprovider:user_competency_comment'] = 'Comment posted on a competency.';
$string['messageprovider:plan_comment'] = 'Comment posted on a learning plan.'; $string['messageprovider:plan_comment'] = 'Comment posted on a learning plan.';

View file

@ -31,7 +31,7 @@ $context = context::instance_by_id($pagecontextid);
require_login(0, false); require_login(0, false);
\tool_lp\api::require_enabled(); \tool_lp\api::require_enabled();
if (!\tool_lp\template::can_read_context($context)) { if (!\tool_lp\template::can_read_context($context)) {
throw new required_capability_exception($context, 'tool/lp:templateview', 'nopermissions', ''); throw new required_capability_exception($context, 'moodle/competency:templateview', 'nopermissions', '');
} }
$url = new moodle_url('/admin/tool/lp/learningplans.php', array('pagecontextid' => $pagecontextid)); $url = new moodle_url('/admin/tool/lp/learningplans.php', array('pagecontextid' => $pagecontextid));

View file

@ -438,7 +438,7 @@ function tool_lp_coursemodule_standard_elements($formwrapper, $mform) {
if (!\tool_lp\api::is_enabled()) { if (!\tool_lp\api::is_enabled()) {
return; return;
} else if (!has_capability('tool/lp:coursecompetencymanage', $formwrapper->get_context())) { } else if (!has_capability('moodle/competency:coursecompetencymanage', $formwrapper->get_context())) {
return; return;
} }

View file

@ -37,7 +37,7 @@ if (\tool_lp\api::is_enabled()) {
'toollpcompetencies', 'toollpcompetencies',
get_string('competencyframeworks', 'tool_lp'), get_string('competencyframeworks', 'tool_lp'),
new moodle_url('/admin/tool/lp/competencyframeworks.php', array('pagecontextid' => context_system::instance()->id)), new moodle_url('/admin/tool/lp/competencyframeworks.php', array('pagecontextid' => context_system::instance()->id)),
array('tool/lp:competencymanage') array('moodle/competency:competencymanage')
); );
$ADMIN->add($parentname, $temp); $ADMIN->add($parentname, $temp);
@ -46,7 +46,7 @@ if (\tool_lp\api::is_enabled()) {
'toollplearningplans', 'toollplearningplans',
get_string('templates', 'tool_lp'), get_string('templates', 'tool_lp'),
new moodle_url('/admin/tool/lp/learningplans.php', array('pagecontextid' => context_system::instance()->id)), new moodle_url('/admin/tool/lp/learningplans.php', array('pagecontextid' => context_system::instance()->id)),
array('tool/lp:templatemanage') array('moodle/competency:templatemanage')
); );
$ADMIN->add($parentname, $temp); $ADMIN->add($parentname, $temp);
} }

View file

@ -37,7 +37,7 @@ $canmanagetemplate = $template->can_manage();
$duedatereached = $template->get_duedate() > 0 && $template->get_duedate() < time(); $duedatereached = $template->get_duedate() > 0 && $template->get_duedate() < time();
if (!$canreadtemplate) { if (!$canreadtemplate) {
throw new required_capability_exception($context, 'tool/lp:templateview', 'nopermissions', ''); throw new required_capability_exception($context, 'moodle/competency:templateview', 'nopermissions', '');
} }
// Set up the page. // Set up the page.

View file

@ -35,7 +35,7 @@ $context = $template->get_context();
$canreadtemplate = $template->can_read(); $canreadtemplate = $template->can_read();
$canmanagetemplate = $template->can_manage(); $canmanagetemplate = $template->can_manage();
if (!$canreadtemplate) { if (!$canreadtemplate) {
throw new required_capability_exception($context, 'tool/lp:templateview', 'nopermissions', ''); throw new required_capability_exception($context, 'moodle/competency:templateview', 'nopermissions', '');
} }
// Set up the page. // Set up the page.

View file

@ -35,7 +35,7 @@ $pagecontext = context::instance_by_id($pagecontextid);
$template = \tool_lp\api::read_template($templateid); $template = \tool_lp\api::read_template($templateid);
$context = $template->get_context(); $context = $template->get_context();
if (!$template->can_read()) { if (!$template->can_read()) {
throw new required_capability_exception($context, 'tool/lp:templateview', 'nopermissions', ''); throw new required_capability_exception($context, 'moodle/competency:templateview', 'nopermissions', '');
} }
// Trigger a template viewed event. // Trigger a template viewed event.

View file

@ -80,18 +80,18 @@ class tool_lp_api_testcase extends advanced_testcase {
$sysctx = context_system::instance(); $sysctx = context_system::instance();
$roleallow = create_role('Allow', 'allow', 'Allow read'); $roleallow = create_role('Allow', 'allow', 'Allow read');
assign_capability('tool/lp:competencyview', CAP_ALLOW, $roleallow, $sysctx->id); assign_capability('moodle/competency:competencyview', CAP_ALLOW, $roleallow, $sysctx->id);
role_assign($roleallow, $user->id, $sysctx->id); role_assign($roleallow, $user->id, $sysctx->id);
$roleprevent = create_role('Prevent', 'prevent', 'Prevent read'); $roleprevent = create_role('Prevent', 'prevent', 'Prevent read');
assign_capability('tool/lp:competencyview', CAP_PROHIBIT, $roleprevent, $sysctx->id); assign_capability('moodle/competency:competencyview', CAP_PROHIBIT, $roleprevent, $sysctx->id);
role_assign($roleprevent, $user->id, $cat2ctx->id); role_assign($roleprevent, $user->id, $cat2ctx->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->setUser($user); $this->setUser($user);
$this->assertFalse(has_capability('tool/lp:competencyview', $cat2ctx)); $this->assertFalse(has_capability('moodle/competency:competencyview', $cat2ctx));
$requiredcap = array('tool/lp:competencyview'); $requiredcap = array('moodle/competency:competencyview');
$expected = array(); $expected = array();
$this->assertEquals($expected, api::get_related_contexts($cat2ctx, 'self', $requiredcap)); $this->assertEquals($expected, api::get_related_contexts($cat2ctx, 'self', $requiredcap));
@ -141,18 +141,18 @@ class tool_lp_api_testcase extends advanced_testcase {
$sysctx = context_system::instance(); $sysctx = context_system::instance();
$roleallow = create_role('Allow', 'allow', 'Allow read'); $roleallow = create_role('Allow', 'allow', 'Allow read');
assign_capability('tool/lp:templateview', CAP_ALLOW, $roleallow, $sysctx->id); assign_capability('moodle/competency:templateview', CAP_ALLOW, $roleallow, $sysctx->id);
role_assign($roleallow, $user->id, $sysctx->id); role_assign($roleallow, $user->id, $sysctx->id);
$roleprevent = create_role('Prevent', 'prevent', 'Prevent read'); $roleprevent = create_role('Prevent', 'prevent', 'Prevent read');
assign_capability('tool/lp:templateview', CAP_PROHIBIT, $roleprevent, $sysctx->id); assign_capability('moodle/competency:templateview', CAP_PROHIBIT, $roleprevent, $sysctx->id);
role_assign($roleprevent, $user->id, $cat2ctx->id); role_assign($roleprevent, $user->id, $cat2ctx->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->setUser($user); $this->setUser($user);
$this->assertFalse(has_capability('tool/lp:templateview', $cat2ctx)); $this->assertFalse(has_capability('moodle/competency:templateview', $cat2ctx));
$requiredcap = array('tool/lp:templateview'); $requiredcap = array('moodle/competency:templateview');
$expected = array(); $expected = array();
$this->assertEquals($expected, api::get_related_contexts($cat2ctx, 'self', $requiredcap)); $this->assertEquals($expected, api::get_related_contexts($cat2ctx, 'self', $requiredcap));
@ -417,17 +417,17 @@ class tool_lp_api_testcase extends advanced_testcase {
'shortname' => 'manage' 'shortname' => 'manage'
)); ));
assign_capability('tool/lp:planmanageowndraft', CAP_ALLOW, $manageowndraftrole, $syscontext->id); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $manageowndraftrole, $syscontext->id);
assign_capability('tool/lp:planviewowndraft', CAP_ALLOW, $manageowndraftrole, $syscontext->id); assign_capability('moodle/competency:planviewowndraft', CAP_ALLOW, $manageowndraftrole, $syscontext->id);
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $manageownrole, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $manageownrole, $syscontext->id);
assign_capability('tool/lp:planviewown', CAP_ALLOW, $manageownrole, $syscontext->id); assign_capability('moodle/competency:planviewown', CAP_ALLOW, $manageownrole, $syscontext->id);
assign_capability('tool/lp:planmanagedraft', CAP_ALLOW, $managedraftrole, $syscontext->id); assign_capability('moodle/competency:planmanagedraft', CAP_ALLOW, $managedraftrole, $syscontext->id);
assign_capability('tool/lp:planviewdraft', CAP_ALLOW, $managedraftrole, $syscontext->id); assign_capability('moodle/competency:planviewdraft', CAP_ALLOW, $managedraftrole, $syscontext->id);
assign_capability('tool/lp:planmanage', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planmanage', CAP_ALLOW, $managerole, $syscontext->id);
assign_capability('tool/lp:planview', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planview', CAP_ALLOW, $managerole, $syscontext->id);
$dg->role_assign($manageowndraftrole, $usermanageowndraft->id, $syscontext->id); $dg->role_assign($manageowndraftrole, $usermanageowndraft->id, $syscontext->id);
$dg->role_assign($manageownrole, $usermanageown->id, $syscontext->id); $dg->role_assign($manageownrole, $usermanageown->id, $syscontext->id);
@ -855,9 +855,9 @@ class tool_lp_api_testcase extends advanced_testcase {
$reviewerrole = $dg->create_role(); $reviewerrole = $dg->create_role();
$otheruserrole = $dg->create_role(); $otheruserrole = $dg->create_role();
assign_capability('tool/lp:planmanageowndraft', CAP_ALLOW, $userrole, $syscontext->id); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $userrole, $syscontext->id);
assign_capability('tool/lp:planmanage', CAP_ALLOW, $reviewerrole, $syscontext->id); assign_capability('moodle/competency:planmanage', CAP_ALLOW, $reviewerrole, $syscontext->id);
assign_capability('tool/lp:planviewdraft', CAP_ALLOW, $reviewerrole, $syscontext->id); assign_capability('moodle/competency:planviewdraft', CAP_ALLOW, $reviewerrole, $syscontext->id);
$dg->role_assign($userrole, $user->id, $syscontext->id); $dg->role_assign($userrole, $user->id, $syscontext->id);
$dg->role_assign($reviewerrole, $reviewer->id, $syscontext->id); $dg->role_assign($reviewerrole, $reviewer->id, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
@ -1496,10 +1496,10 @@ class tool_lp_api_testcase extends advanced_testcase {
'name' => 'User manage own', 'name' => 'User manage own',
'shortname' => 'manageown' 'shortname' => 'manageown'
)); ));
assign_capability('tool/lp:planmanageowndraft', CAP_ALLOW, $manageownrole, $syscontext->id); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $manageownrole, $syscontext->id);
assign_capability('tool/lp:planviewowndraft', CAP_ALLOW, $manageownrole, $syscontext->id); assign_capability('moodle/competency:planviewowndraft', CAP_ALLOW, $manageownrole, $syscontext->id);
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $manageownrole, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $manageownrole, $syscontext->id);
assign_capability('tool/lp:planviewown', CAP_ALLOW, $manageownrole, $syscontext->id); assign_capability('moodle/competency:planviewown', CAP_ALLOW, $manageownrole, $syscontext->id);
$dg->role_assign($manageownrole, $user->id, $syscontext->id); $dg->role_assign($manageownrole, $user->id, $syscontext->id);
$this->setUser($user); $this->setUser($user);
@ -1692,8 +1692,8 @@ class tool_lp_api_testcase extends advanced_testcase {
'name' => 'User manage own', 'name' => 'User manage own',
'shortname' => 'manageown' 'shortname' => 'manageown'
)); ));
assign_capability('tool/lp:planmanageowndraft', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $managerole, $syscontext->id);
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $managerole, $syscontext->id);
$dg->role_assign($managerole, $user->id, $syscontext->id); $dg->role_assign($managerole, $user->id, $syscontext->id);
$this->setUser($user); $this->setUser($user);
@ -1741,8 +1741,8 @@ class tool_lp_api_testcase extends advanced_testcase {
'name' => 'User view', 'name' => 'User view',
'shortname' => 'view' 'shortname' => 'view'
)); ));
assign_capability('tool/lp:planviewdraft', CAP_ALLOW, $viewrole, $syscontext->id); assign_capability('moodle/competency:planviewdraft', CAP_ALLOW, $viewrole, $syscontext->id);
assign_capability('tool/lp:planview', CAP_ALLOW, $viewrole, $syscontext->id); assign_capability('moodle/competency:planview', CAP_ALLOW, $viewrole, $syscontext->id);
$dg->role_assign($viewrole, $user->id, $syscontext->id); $dg->role_assign($viewrole, $user->id, $syscontext->id);
$this->setUser($user); $this->setUser($user);
@ -1844,7 +1844,7 @@ class tool_lp_api_testcase extends advanced_testcase {
$user = $dg->create_user(); $user = $dg->create_user();
$role = $dg->create_role(); $role = $dg->create_role();
assign_capability('tool/lp:templatemanage', CAP_ALLOW, $role, $syscontext->id, true); assign_capability('moodle/competency:templatemanage', CAP_ALLOW, $role, $syscontext->id, true);
$dg->role_assign($role, $user->id, $syscontext->id); $dg->role_assign($role, $user->id, $syscontext->id);
$cohortrole = $dg->create_role(); $cohortrole = $dg->create_role();
@ -3819,22 +3819,22 @@ class tool_lp_api_testcase extends advanced_testcase {
$studentrole = array_shift($studentarch); $studentrole = array_shift($studentarch);
$gradablerole = $dg->create_role(); $gradablerole = $dg->create_role();
assign_capability('tool/lp:coursecompetencygradable', CAP_ALLOW, $gradablerole, $sysctx->id); assign_capability('moodle/competency:coursecompetencygradable', CAP_ALLOW, $gradablerole, $sysctx->id);
$notgradablerole = $dg->create_role(); $notgradablerole = $dg->create_role();
assign_capability('tool/lp:coursecompetencygradable', CAP_PROHIBIT, $notgradablerole, $sysctx->id); assign_capability('moodle/competency:coursecompetencygradable', CAP_PROHIBIT, $notgradablerole, $sysctx->id);
$canviewucrole = $dg->create_role(); $canviewucrole = $dg->create_role();
assign_capability('tool/lp:usercompetencyview', CAP_ALLOW, $canviewucrole, $sysctx->id); assign_capability('moodle/competency:usercompetencyview', CAP_ALLOW, $canviewucrole, $sysctx->id);
$cannotviewcomp = $dg->create_role(); $cannotviewcomp = $dg->create_role();
assign_capability('tool/lp:competencyview', CAP_PROHIBIT, $cannotviewcomp, $sysctx->id); assign_capability('moodle/competency:competencyview', CAP_PROHIBIT, $cannotviewcomp, $sysctx->id);
$canmanagecomp = $dg->create_role(); $canmanagecomp = $dg->create_role();
assign_capability('tool/lp:competencymanage', CAP_ALLOW, $canmanagecomp, $sysctx->id); assign_capability('moodle/competency:competencymanage', CAP_ALLOW, $canmanagecomp, $sysctx->id);
$cangraderole = $dg->create_role(); $cangraderole = $dg->create_role();
assign_capability('tool/lp:competencygrade', CAP_ALLOW, $cangraderole, $sysctx->id); assign_capability('moodle/competency:competencygrade', CAP_ALLOW, $cangraderole, $sysctx->id);
// Enrol s1 and s2 as students in course 1. // Enrol s1 and s2 as students in course 1.
$dg->enrol_user($student1->id, $c1->id, $studentrole->id); $dg->enrol_user($student1->id, $c1->id, $studentrole->id);

View file

@ -40,19 +40,19 @@ Feature: Manage plan workflow
And I log in as "admin" And I log in as "admin"
And I set the following system permissions of "User manage own draft plan role" role: And I set the following system permissions of "User manage own draft plan role" role:
| capability | permission | | capability | permission |
| tool/lp:planmanageowndraft | Allow | | moodle/competency:planmanageowndraft | Allow |
And I set the following system permissions of "User manage own plan role" role: And I set the following system permissions of "User manage own plan role" role:
| capability | permission | | capability | permission |
| tool/lp:planmanageowndraft | Allow | | moodle/competency:planmanageowndraft | Allow |
| tool/lp:planmanageown | Allow | | moodle/competency:planmanageown | Allow |
And I set the following system permissions of "Manager all plans role" role: And I set the following system permissions of "Manager all plans role" role:
| capability | permission | | capability | permission |
| tool/lp:planmanage | Allow | | moodle/competency:planmanage | Allow |
| tool/lp:planmanagedraft | Allow | | moodle/competency:planmanagedraft | Allow |
| tool/lp:planmanageowndraft | Allow | | moodle/competency:planmanageowndraft | Allow |
| tool/lp:planview | Allow | | moodle/competency:planview | Allow |
| tool/lp:planreview | Allow | | moodle/competency:planreview | Allow |
| tool/lp:planrequestreview | Allow | | moodle/competency:planrequestreview | Allow |
| block/lp:myaddinstance | Allow | | block/lp:myaddinstance | Allow |
And I log out And I log out

View file

@ -47,12 +47,12 @@ class tool_lp_course_competency_settings_testcase extends advanced_testcase {
$dg = $this->getDataGenerator(); $dg = $this->getDataGenerator();
$lpg = $dg->get_plugin_generator('tool_lp'); $lpg = $dg->get_plugin_generator('tool_lp');
$role = create_role('Settings changer role', 'settingschanger', 'Someone who can change course competency settings'); $role = create_role('Settings changer role', 'settingschanger', 'Someone who can change course competency settings');
assign_capability('tool/lp:coursecompetencyconfigure', CAP_ALLOW, $role, $syscontext->id); assign_capability('moodle/competency:coursecompetencyconfigure', CAP_ALLOW, $role, $syscontext->id);
assign_capability('tool/lp:competencygrade', CAP_ALLOW, $role, $syscontext->id); assign_capability('moodle/competency:competencygrade', CAP_ALLOW, $role, $syscontext->id);
assign_capability('tool/lp:coursecompetencyview', CAP_ALLOW, $role, $syscontext->id); assign_capability('moodle/competency:coursecompetencyview', CAP_ALLOW, $role, $syscontext->id);
assign_capability('tool/lp:planview', CAP_ALLOW, $role, $syscontext->id); assign_capability('moodle/competency:planview', CAP_ALLOW, $role, $syscontext->id);
$gradedrole = create_role('Graded role', 'graded', 'Someone who can be graded'); $gradedrole = create_role('Graded role', 'graded', 'Someone who can be graded');
assign_capability('tool/lp:coursecompetencygradable', CAP_ALLOW, $gradedrole, $syscontext->id); assign_capability('moodle/competency:coursecompetencygradable', CAP_ALLOW, $gradedrole, $syscontext->id);
$c1 = $dg->create_course(); $c1 = $dg->create_course();
$u1 = $dg->create_user(); $u1 = $dg->create_user();

View file

@ -105,39 +105,39 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$authrole = array_pop($userroles); $authrole = array_pop($userroles);
// Reset all default authenticated users permissions. // Reset all default authenticated users permissions.
unassign_capability('tool/lp:competencygrade', $authrole->id); unassign_capability('moodle/competency:competencygrade', $authrole->id);
unassign_capability('tool/lp:competencymanage', $authrole->id); unassign_capability('moodle/competency:competencymanage', $authrole->id);
unassign_capability('tool/lp:competencyview', $authrole->id); unassign_capability('moodle/competency:competencyview', $authrole->id);
unassign_capability('tool/lp:planmanage', $authrole->id); unassign_capability('moodle/competency:planmanage', $authrole->id);
unassign_capability('tool/lp:planmanagedraft', $authrole->id); unassign_capability('moodle/competency:planmanagedraft', $authrole->id);
unassign_capability('tool/lp:planmanageown', $authrole->id); unassign_capability('moodle/competency:planmanageown', $authrole->id);
unassign_capability('tool/lp:planview', $authrole->id); unassign_capability('moodle/competency:planview', $authrole->id);
unassign_capability('tool/lp:planviewdraft', $authrole->id); unassign_capability('moodle/competency:planviewdraft', $authrole->id);
unassign_capability('tool/lp:planviewown', $authrole->id); unassign_capability('moodle/competency:planviewown', $authrole->id);
unassign_capability('tool/lp:planviewowndraft', $authrole->id); unassign_capability('moodle/competency:planviewowndraft', $authrole->id);
unassign_capability('tool/lp:templatemanage', $authrole->id); unassign_capability('moodle/competency:templatemanage', $authrole->id);
unassign_capability('tool/lp:templateview', $authrole->id); unassign_capability('moodle/competency:templateview', $authrole->id);
unassign_capability('moodle/cohort:manage', $authrole->id); unassign_capability('moodle/cohort:manage', $authrole->id);
unassign_capability('tool/lp:coursecompetencyconfigure', $authrole->id); unassign_capability('moodle/competency:coursecompetencyconfigure', $authrole->id);
// Creating specific roles. // Creating specific roles.
$this->creatorrole = create_role('Creator role', 'creatorrole', 'learning plan creator role description'); $this->creatorrole = create_role('Creator role', 'creatorrole', 'learning plan creator role description');
$this->userrole = create_role('User role', 'userrole', 'learning plan user role description'); $this->userrole = create_role('User role', 'userrole', 'learning plan user role description');
assign_capability('tool/lp:competencymanage', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/competency:competencymanage', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('tool/lp:competencycompetencyconfigure', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/competency:competencycompetencyconfigure', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('tool/lp:competencyview', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:competencyview', CAP_ALLOW, $this->userrole, $syscontext->id);
assign_capability('tool/lp:planmanage', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/competency:planmanage', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('tool/lp:planmanagedraft', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/competency:planmanagedraft', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('tool/lp:planview', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/competency:planview', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('tool/lp:planviewdraft', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/competency:planviewdraft', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('tool/lp:templatemanage', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/competency:templatemanage', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('tool/lp:competencygrade', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/competency:competencygrade', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('moodle/cohort:manage', CAP_ALLOW, $this->creatorrole, $syscontext->id); assign_capability('moodle/cohort:manage', CAP_ALLOW, $this->creatorrole, $syscontext->id);
assign_capability('tool/lp:templateview', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:templateview', CAP_ALLOW, $this->userrole, $syscontext->id);
assign_capability('tool/lp:planviewown', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planviewown', CAP_ALLOW, $this->userrole, $syscontext->id);
assign_capability('tool/lp:planviewowndraft', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planviewowndraft', CAP_ALLOW, $this->userrole, $syscontext->id);
role_assign($this->creatorrole, $creator->id, $syscontext->id); role_assign($this->creatorrole, $creator->id, $syscontext->id);
role_assign($this->creatorrole, $catcreator->id, $catcontext->id); role_assign($this->creatorrole, $catcreator->id, $catcontext->id);
@ -1170,7 +1170,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertEquals('nopermissions', $e->errorcode); $this->assertEquals('nopermissions', $e->errorcode);
} }
assign_capability('tool/lp:planmanageowndraft', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $this->userrole, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->setUser($this->user); $this->setUser($this->user);
@ -1190,7 +1190,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertTrue(true); $this->assertTrue(true);
} }
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$plan3 = $this->create_plan(4, $this->user->id, 0, plan::STATUS_ACTIVE, 0); $plan3 = $this->create_plan(4, $this->user->id, 0, plan::STATUS_ACTIVE, 0);
@ -1207,8 +1207,8 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertEquals('nopermissions', $e->errorcode); $this->assertEquals('nopermissions', $e->errorcode);
} }
unassign_capability('tool/lp:planmanageown', $this->userrole, $syscontext->id); unassign_capability('moodle/competency:planmanageown', $this->userrole, $syscontext->id);
unassign_capability('tool/lp:planmanageowndraft', $this->userrole, $syscontext->id); unassign_capability('moodle/competency:planmanageowndraft', $this->userrole, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
try { try {
@ -1230,8 +1230,8 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->setUser($this->user); $this->setUser($this->user);
assign_capability('tool/lp:planmanageowndraft', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $this->userrole, $syscontext->id);
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->setUser($this->user); $this->setUser($this->user);
@ -1252,8 +1252,8 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->setUser($this->user); $this->setUser($this->user);
assign_capability('tool/lp:planmanageowndraft', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $this->userrole, $syscontext->id);
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->setUser($this->user); $this->setUser($this->user);
@ -1319,9 +1319,9 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$plan1->commentarea['canview'] = true; $plan1->commentarea['canview'] = true;
// Prevent the user from seeing their own non-draft plans. // Prevent the user from seeing their own non-draft plans.
assign_capability('tool/lp:plancommentown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:plancommentown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true);
assign_capability('tool/lp:planviewown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planviewown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true);
assign_capability('tool/lp:planviewowndraft', CAP_ALLOW, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planviewowndraft', CAP_ALLOW, $this->userrole, $syscontext->id, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->assertEquals((array)$plan1, external::read_plan($plan1->id)); $this->assertEquals((array)$plan1, external::read_plan($plan1->id));
@ -1340,9 +1340,9 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
} }
// Allow user to see their plan. // Allow user to see their plan.
assign_capability('tool/lp:plancommentown', CAP_ALLOW, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:plancommentown', CAP_ALLOW, $this->userrole, $syscontext->id, true);
assign_capability('tool/lp:planviewown', CAP_ALLOW, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planviewown', CAP_ALLOW, $this->userrole, $syscontext->id, true);
assign_capability('tool/lp:planmanageowndraft', CAP_PROHIBIT, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planmanageowndraft', CAP_PROHIBIT, $this->userrole, $syscontext->id, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$plan1->commentarea['canpost'] = true; $plan1->commentarea['canpost'] = true;
@ -1360,9 +1360,9 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertEquals((array)$plan3, external::read_plan($plan3->id)); $this->assertEquals((array)$plan3, external::read_plan($plan3->id));
// Allow use to manage their own draft plan. // Allow use to manage their own draft plan.
assign_capability('tool/lp:planviewown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planviewown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true);
assign_capability('tool/lp:planmanageown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planmanageown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true);
assign_capability('tool/lp:planmanageowndraft', CAP_ALLOW, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $this->userrole, $syscontext->id, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$plan1->canmanage = true; $plan1->canmanage = true;
@ -1384,9 +1384,9 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
} }
// Allow use to manage their plan. // Allow use to manage their plan.
assign_capability('tool/lp:planviewown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planviewown', CAP_PROHIBIT, $this->userrole, $syscontext->id, true);
assign_capability('tool/lp:planmanageowndraft', CAP_PROHIBIT, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planmanageowndraft', CAP_PROHIBIT, $this->userrole, $syscontext->id, true);
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id, true); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$plan1->canmanage = false; $plan1->canmanage = false;
@ -1423,7 +1423,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertTrue(external::delete_plan($plan1->id)); $this->assertTrue(external::delete_plan($plan1->id));
unassign_capability('tool/lp:planmanage', $this->creatorrole, $syscontext->id); unassign_capability('moodle/competency:planmanage', $this->creatorrole, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
try { try {
@ -1443,7 +1443,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertEquals('nopermissions', $e->errorcode); $this->assertEquals('nopermissions', $e->errorcode);
} }
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->assertTrue(external::delete_plan($plan2->id)); $this->assertTrue(external::delete_plan($plan2->id));
@ -1585,7 +1585,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertEquals(1, external::count_competencies_in_template($template->id)); $this->assertEquals(1, external::count_competencies_in_template($template->id));
// Unassign capability. // Unassign capability.
unassign_capability('tool/lp:templatemanage', $this->creatorrole, $syscontext->id); unassign_capability('moodle/competency:templatemanage', $this->creatorrole, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
// Check we can not add the competency now. // Check we can not add the competency now.
@ -1622,7 +1622,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertEquals(0, external::count_competencies_in_template($template->id)); $this->assertEquals(0, external::count_competencies_in_template($template->id));
// Unassign capability. // Unassign capability.
unassign_capability('tool/lp:templatemanage', $this->creatorrole, $syscontext->id); unassign_capability('moodle/competency:templatemanage', $this->creatorrole, $syscontext->id);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
// Check we can not remove the competency now. // Check we can not remove the competency now.
@ -1848,10 +1848,10 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$cattemplate = $this->create_template(2, false); $cattemplate = $this->create_template(2, false);
// User without permissions to read in system. // User without permissions to read in system.
assign_capability('tool/lp:templateview', CAP_PROHIBIT, $this->userrole, $syscontextid, true); assign_capability('moodle/competency:templateview', CAP_PROHIBIT, $this->userrole, $syscontextid, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->setUser($this->user); $this->setUser($this->user);
$this->assertFalse(has_capability('tool/lp:templateview', context_system::instance())); $this->assertFalse(has_capability('moodle/competency:templateview', context_system::instance()));
try { try {
external::read_template($systemplate->id); external::read_template($systemplate->id);
$this->fail('Invalid permissions'); $this->fail('Invalid permissions');
@ -1866,11 +1866,11 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
} }
// User with permissions to read in a category. // User with permissions to read in a category.
assign_capability('tool/lp:templateview', CAP_PREVENT, $this->userrole, $syscontextid, true); assign_capability('moodle/competency:templateview', CAP_PREVENT, $this->userrole, $syscontextid, true);
assign_capability('tool/lp:templateview', CAP_ALLOW, $this->userrole, $catcontextid, true); assign_capability('moodle/competency:templateview', CAP_ALLOW, $this->userrole, $catcontextid, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->assertFalse(has_capability('tool/lp:templateview', context_system::instance())); $this->assertFalse(has_capability('moodle/competency:templateview', context_system::instance()));
$this->assertTrue(has_capability('tool/lp:templateview', context_coursecat::instance($this->category->id))); $this->assertTrue(has_capability('moodle/competency:templateview', context_coursecat::instance($this->category->id)));
try { try {
external::read_template($systemplate->id); external::read_template($systemplate->id);
$this->fail('Invalid permissions'); $this->fail('Invalid permissions');
@ -1889,9 +1889,9 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertEquals(userdate(0), $result['duedateformatted']); $this->assertEquals(userdate(0), $result['duedateformatted']);
// User with permissions to read in the system. // User with permissions to read in the system.
assign_capability('tool/lp:templateview', CAP_ALLOW, $this->userrole, $syscontextid, true); assign_capability('moodle/competency:templateview', CAP_ALLOW, $this->userrole, $syscontextid, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$this->assertTrue(has_capability('tool/lp:templateview', context_system::instance())); $this->assertTrue(has_capability('moodle/competency:templateview', context_system::instance()));
$result = external::read_template($systemplate->id); $result = external::read_template($systemplate->id);
$result = external_api::clean_returnvalue(external::read_template_returns(), $result); $result = external_api::clean_returnvalue(external::read_template_returns(), $result);
$this->assertEquals($systemplate->id, $result['id']); $this->assertEquals($systemplate->id, $result['id']);
@ -2068,7 +2068,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
// User without permission. // User without permission.
$this->setUser($this->user); $this->setUser($this->user);
assign_capability('tool/lp:templateview', CAP_PROHIBIT, $this->userrole, $syscontextid, true); assign_capability('moodle/competency:templateview', CAP_PROHIBIT, $this->userrole, $syscontextid, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
try { try {
external::list_templates('id', 'ASC', 0, 10, array('contextid' => $syscontextid), 'children', false); external::list_templates('id', 'ASC', 0, 10, array('contextid' => $syscontextid), 'children', false);
@ -2078,8 +2078,8 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
} }
// User with category permissions. // User with category permissions.
assign_capability('tool/lp:templateview', CAP_PREVENT, $this->userrole, $syscontextid, true); assign_capability('moodle/competency:templateview', CAP_PREVENT, $this->userrole, $syscontextid, true);
assign_capability('tool/lp:templateview', CAP_ALLOW, $this->userrole, $catcontextid, true); assign_capability('moodle/competency:templateview', CAP_ALLOW, $this->userrole, $catcontextid, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$result = external::list_templates('id', 'ASC', 0, 10, array('contextid' => $syscontextid), 'children', false); $result = external::list_templates('id', 'ASC', 0, 10, array('contextid' => $syscontextid), 'children', false);
$result = external_api::clean_returnvalue(external::list_templates_returns(), $result); $result = external_api::clean_returnvalue(external::list_templates_returns(), $result);
@ -2088,7 +2088,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertEquals($cat2->id, $result[1]['id']); $this->assertEquals($cat2->id, $result[1]['id']);
// User with system permissions. // User with system permissions.
assign_capability('tool/lp:templateview', CAP_ALLOW, $this->userrole, $syscontextid, true); assign_capability('moodle/competency:templateview', CAP_ALLOW, $this->userrole, $syscontextid, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$result = external::list_templates('id', 'DESC', 0, 3, array('contextid' => $catcontextid), 'parents', false); $result = external::list_templates('id', 'DESC', 0, 3, array('contextid' => $catcontextid), 'parents', false);
$result = external_api::clean_returnvalue(external::list_templates_returns(), $result); $result = external_api::clean_returnvalue(external::list_templates_returns(), $result);
@ -2159,7 +2159,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
// User without permission. // User without permission.
$this->setUser($this->user); $this->setUser($this->user);
assign_capability('tool/lp:templateview', CAP_PROHIBIT, $this->userrole, $syscontextid, true); assign_capability('moodle/competency:templateview', CAP_PROHIBIT, $this->userrole, $syscontextid, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
try { try {
external::count_templates(array('contextid' => $syscontextid), 'children'); external::count_templates(array('contextid' => $syscontextid), 'children');
@ -2169,15 +2169,15 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
} }
// User with category permissions. // User with category permissions.
assign_capability('tool/lp:templateview', CAP_PREVENT, $this->userrole, $syscontextid, true); assign_capability('moodle/competency:templateview', CAP_PREVENT, $this->userrole, $syscontextid, true);
assign_capability('tool/lp:templateview', CAP_ALLOW, $this->userrole, $catcontextid, true); assign_capability('moodle/competency:templateview', CAP_ALLOW, $this->userrole, $catcontextid, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$result = external::count_templates(array('contextid' => $syscontextid), 'children'); $result = external::count_templates(array('contextid' => $syscontextid), 'children');
$result = external_api::clean_returnvalue(external::count_templates_returns(), $result); $result = external_api::clean_returnvalue(external::count_templates_returns(), $result);
$this->assertEquals(3, $result); $this->assertEquals(3, $result);
// User with system permissions. // User with system permissions.
assign_capability('tool/lp:templateview', CAP_ALLOW, $this->userrole, $syscontextid, true); assign_capability('moodle/competency:templateview', CAP_ALLOW, $this->userrole, $syscontextid, true);
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
$result = external::count_templates(array('contextid' => $catcontextid), 'parents'); $result = external::count_templates(array('contextid' => $catcontextid), 'parents');
$result = external_api::clean_returnvalue(external::count_templates_returns(), $result); $result = external_api::clean_returnvalue(external::count_templates_returns(), $result);
@ -2360,8 +2360,8 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
'shortname' => 'manage' 'shortname' => 'manage'
)); ));
assign_capability('tool/lp:planmanage', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planmanage', CAP_ALLOW, $managerole, $syscontext->id);
assign_capability('tool/lp:planview', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planview', CAP_ALLOW, $managerole, $syscontext->id);
$dg->role_assign($managerole, $usermanage->id, $syscontext->id); $dg->role_assign($managerole, $usermanage->id, $syscontext->id);
@ -2422,8 +2422,8 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
'shortname' => 'manage' 'shortname' => 'manage'
)); ));
assign_capability('tool/lp:planmanage', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planmanage', CAP_ALLOW, $managerole, $syscontext->id);
assign_capability('tool/lp:planview', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planview', CAP_ALLOW, $managerole, $syscontext->id);
$dg->role_assign($managerole, $usermanage->id, $syscontext->id); $dg->role_assign($managerole, $usermanage->id, $syscontext->id);
@ -2467,8 +2467,8 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
'shortname' => 'manage' 'shortname' => 'manage'
)); ));
assign_capability('tool/lp:planmanage', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planmanage', CAP_ALLOW, $managerole, $syscontext->id);
assign_capability('tool/lp:planview', CAP_ALLOW, $managerole, $syscontext->id); assign_capability('moodle/competency:planview', CAP_ALLOW, $managerole, $syscontext->id);
$dg->role_assign($managerole, $usermanage->id, $syscontext->id); $dg->role_assign($managerole, $usermanage->id, $syscontext->id);
@ -2663,7 +2663,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
// First we search with no capability assigned. // First we search with no capability assigned.
$this->setUser($ux); $this->setUser($ux);
$result = external::search_users('yyylan', 'tool/lp:planmanage'); $result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(0, $result['users']); $this->assertCount(0, $result['users']);
$this->assertEquals(0, $result['count']); $this->assertEquals(0, $result['count']);
@ -2671,25 +2671,25 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
// Now we assign a different capability. // Now we assign a different capability.
$usercontext = context_user::instance($u1->id); $usercontext = context_user::instance($u1->id);
$systemcontext = context_system::instance(); $systemcontext = context_system::instance();
$customrole = $this->assignUserCapability('tool/lp:planview', $usercontext->id); $customrole = $this->assignUserCapability('moodle/competency:planview', $usercontext->id);
$result = external::search_users('yyylan', 'tool/lp:planmanage'); $result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(0, $result['users']); $this->assertCount(0, $result['users']);
$this->assertEquals(0, $result['count']); $this->assertEquals(0, $result['count']);
// Now we assign a matching capability in the same role. // Now we assign a matching capability in the same role.
$usercontext = context_user::instance($u1->id); $usercontext = context_user::instance($u1->id);
$this->assignUserCapability('tool/lp:planmanage', $usercontext->id, $customrole); $this->assignUserCapability('moodle/competency:planmanage', $usercontext->id, $customrole);
$result = external::search_users('yyylan', 'tool/lp:planmanage'); $result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(1, $result['users']); $this->assertCount(1, $result['users']);
$this->assertEquals(1, $result['count']); $this->assertEquals(1, $result['count']);
// Now assign another role with the same capability (test duplicates). // Now assign another role with the same capability (test duplicates).
role_assign($this->creatorrole, $ux->id, $usercontext->id); role_assign($this->creatorrole, $ux->id, $usercontext->id);
$result = external::search_users('yyylan', 'tool/lp:planmanage'); $result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(1, $result['users']); $this->assertCount(1, $result['users']);
$this->assertEquals(1, $result['count']); $this->assertEquals(1, $result['count']);
@ -2698,7 +2698,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$ux2 = $dg->create_user(); $ux2 = $dg->create_user();
role_assign($this->creatorrole, $ux2->id, $systemcontext->id); role_assign($this->creatorrole, $ux2->id, $systemcontext->id);
$this->setUser($ux2); $this->setUser($ux2);
$result = external::search_users('yyylan', 'tool/lp:planmanage'); $result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(1, $result['users']); $this->assertCount(1, $result['users']);
$this->assertEquals(1, $result['count']); $this->assertEquals(1, $result['count']);
@ -2707,7 +2707,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$ux3 = $dg->create_user(); $ux3 = $dg->create_user();
role_assign($this->creatorrole, $ux3->id, $usercontext->id); role_assign($this->creatorrole, $ux3->id, $usercontext->id);
$this->setUser($ux3); $this->setUser($ux3);
$result = external::search_users('yyylan', 'tool/lp:planmanage'); $result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(1, $result['users']); $this->assertCount(1, $result['users']);
$this->assertEquals(1, $result['count']); $this->assertEquals(1, $result['count']);
@ -2716,15 +2716,15 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->setUser($ux); $this->setUser($ux);
// Now add a prevent override (will change nothing because we still have an ALLOW). // Now add a prevent override (will change nothing because we still have an ALLOW).
assign_capability('tool/lp:planmanage', CAP_PREVENT, $customrole, $usercontext->id); assign_capability('moodle/competency:planmanage', CAP_PREVENT, $customrole, $usercontext->id);
$result = external::search_users('yyylan', 'tool/lp:planmanage'); $result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(1, $result['users']); $this->assertCount(1, $result['users']);
$this->assertEquals(1, $result['count']); $this->assertEquals(1, $result['count']);
// Now change to a prohibit override (should prevent access). // Now change to a prohibit override (should prevent access).
assign_capability('tool/lp:planmanage', CAP_PROHIBIT, $customrole, $usercontext->id); assign_capability('moodle/competency:planmanage', CAP_PROHIBIT, $customrole, $usercontext->id);
$result = external::search_users('yyylan', 'tool/lp:planmanage'); $result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(1, $result['users']); $this->assertCount(1, $result['users']);
$this->assertEquals(1, $result['count']); $this->assertEquals(1, $result['count']);
@ -2814,32 +2814,32 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
// We need to give the user the capability we are searching for on each of the test users. // We need to give the user the capability we are searching for on each of the test users.
$this->setAdminUser(); $this->setAdminUser();
$usercontext = context_user::instance($u1->id); $usercontext = context_user::instance($u1->id);
$dummyrole = $this->assignUserCapability('tool/lp:planmanage', $usercontext->id); $dummyrole = $this->assignUserCapability('moodle/competency:planmanage', $usercontext->id);
$usercontext = context_user::instance($u2->id); $usercontext = context_user::instance($u2->id);
$this->assignUserCapability('tool/lp:planmanage', $usercontext->id, $dummyrole); $this->assignUserCapability('moodle/competency:planmanage', $usercontext->id, $dummyrole);
$usercontext = context_user::instance($u3->id); $usercontext = context_user::instance($u3->id);
$this->assignUserCapability('tool/lp:planmanage', $usercontext->id, $dummyrole); $this->assignUserCapability('moodle/competency:planmanage', $usercontext->id, $dummyrole);
$this->setUser($ux); $this->setUser($ux);
$usercontext = context_user::instance($u1->id); $usercontext = context_user::instance($u1->id);
$this->assignUserCapability('tool/lp:planmanage', $usercontext->id, $dummyrole); $this->assignUserCapability('moodle/competency:planmanage', $usercontext->id, $dummyrole);
$usercontext = context_user::instance($u2->id); $usercontext = context_user::instance($u2->id);
$this->assignUserCapability('tool/lp:planmanage', $usercontext->id, $dummyrole); $this->assignUserCapability('moodle/competency:planmanage', $usercontext->id, $dummyrole);
$usercontext = context_user::instance($u3->id); $usercontext = context_user::instance($u3->id);
$this->assignUserCapability('tool/lp:planmanage', $usercontext->id, $dummyrole); $this->assignUserCapability('moodle/competency:planmanage', $usercontext->id, $dummyrole);
$this->setAdminUser(); $this->setAdminUser();
// No identity fields. // No identity fields.
$CFG->showuseridentity = ''; $CFG->showuseridentity = '';
$result = external::search_users('cats', 'tool/lp:planmanage'); $result = external::search_users('cats', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(0, $result['users']); $this->assertCount(0, $result['users']);
$this->assertEquals(0, $result['count']); $this->assertEquals(0, $result['count']);
// Filter by name. // Filter by name.
$CFG->showuseridentity = ''; $CFG->showuseridentity = '';
$result = external::search_users('dyyylan', 'tool/lp:planmanage'); $result = external::search_users('dyyylan', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(2, $result['users']); $this->assertCount(2, $result['users']);
$this->assertEquals(2, $result['count']); $this->assertEquals(2, $result['count']);
@ -2848,7 +2848,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
// Filter by institution and name. // Filter by institution and name.
$CFG->showuseridentity = 'institution'; $CFG->showuseridentity = 'institution';
$result = external::search_users('bob', 'tool/lp:planmanage'); $result = external::search_users('bob', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(2, $result['users']); $this->assertCount(2, $result['users']);
$this->assertEquals(2, $result['count']); $this->assertEquals(2, $result['count']);
@ -2857,7 +2857,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
// Filter by id number. // Filter by id number.
$CFG->showuseridentity = 'idnumber'; $CFG->showuseridentity = 'idnumber';
$result = external::search_users('cats', 'tool/lp:planmanage'); $result = external::search_users('cats', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(1, $result['users']); $this->assertCount(1, $result['users']);
$this->assertEquals(1, $result['count']); $this->assertEquals(1, $result['count']);
@ -2871,7 +2871,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
// Filter by email. // Filter by email.
$CFG->showuseridentity = 'email'; $CFG->showuseridentity = 'email';
$result = external::search_users('yyy', 'tool/lp:planmanage'); $result = external::search_users('yyy', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(3, $result['users']); $this->assertCount(3, $result['users']);
$this->assertEquals(3, $result['count']); $this->assertEquals(3, $result['count']);
@ -2884,7 +2884,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
// Filter by any. // Filter by any.
$CFG->showuseridentity = 'idnumber,email,phone1,phone2,department,institution'; $CFG->showuseridentity = 'idnumber,email,phone1,phone2,department,institution';
$result = external::search_users('yyy', 'tool/lp:planmanage'); $result = external::search_users('yyy', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(3, $result['users']); $this->assertCount(3, $result['users']);
$this->assertEquals(3, $result['count']); $this->assertEquals(3, $result['count']);
@ -2905,7 +2905,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$this->assertCount(0, $result['users']); $this->assertCount(0, $result['users']);
$this->assertEquals(0, $result['count']); $this->assertEquals(0, $result['count']);
$result = external::search_users('bob', 'tool/lp:planmanage'); $result = external::search_users('bob', 'moodle/competency:planmanage');
$result = external_api::clean_returnvalue(external::search_users_returns(), $result); $result = external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(1, $result['users']); $this->assertCount(1, $result['users']);
$this->assertEquals(1, $result['count']); $this->assertEquals(1, $result['count']);
@ -3066,9 +3066,9 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$compmanager = $this->getDataGenerator()->create_user(); $compmanager = $this->getDataGenerator()->create_user();
$compnoob = $this->getDataGenerator()->create_user(); $compnoob = $this->getDataGenerator()->create_user();
assign_capability('tool/lp:coursecompetencyconfigure', CAP_ALLOW, $roleid, $context->id, true); assign_capability('moodle/competency:coursecompetencyconfigure', CAP_ALLOW, $roleid, $context->id, true);
assign_capability('tool/lp:coursecompetencyview', CAP_ALLOW, $roleid, $context->id, true); assign_capability('moodle/competency:coursecompetencyview', CAP_ALLOW, $roleid, $context->id, true);
assign_capability('tool/lp:coursecompetencyview', CAP_ALLOW, $noobroleid, $context->id, true); assign_capability('moodle/competency:coursecompetencyview', CAP_ALLOW, $noobroleid, $context->id, true);
role_assign($roleid, $compmanager->id, $context->id); role_assign($roleid, $compmanager->id, $context->id);
role_assign($noobroleid, $compnoob->id, $context->id); role_assign($noobroleid, $compnoob->id, $context->id);

View file

@ -48,8 +48,8 @@ class tool_lp_lib_testcase extends advanced_testcase {
$u2 = $dg->create_user(); $u2 = $dg->create_user();
$u3 = $dg->create_user(); $u3 = $dg->create_user();
$reviewerroleid = $dg->create_role(); $reviewerroleid = $dg->create_role();
assign_capability('tool/lp:planview', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true); assign_capability('moodle/competency:planview', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true);
assign_capability('tool/lp:usercompetencycomment', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true); assign_capability('moodle/competency:usercompetencycomment', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true);
$dg->role_assign($reviewerroleid, $u2->id, context_user::instance($u1->id)); $dg->role_assign($reviewerroleid, $u2->id, context_user::instance($u1->id));
$dg->role_assign($reviewerroleid, $u3->id, context_user::instance($u1->id)); $dg->role_assign($reviewerroleid, $u3->id, context_user::instance($u1->id));
accesslib_clear_all_caches_for_unit_testing(); accesslib_clear_all_caches_for_unit_testing();
@ -196,11 +196,11 @@ class tool_lp_lib_testcase extends advanced_testcase {
$u3 = $dg->create_user(); $u3 = $dg->create_user();
$userroleid = $dg->create_role(); $userroleid = $dg->create_role();
$reviewerroleid = $dg->create_role(); $reviewerroleid = $dg->create_role();
assign_capability('tool/lp:planviewowndraft', CAP_ALLOW, $userroleid, context_system::instance()->id, true); assign_capability('moodle/competency:planviewowndraft', CAP_ALLOW, $userroleid, context_system::instance()->id, true);
assign_capability('tool/lp:planviewown', CAP_ALLOW, $userroleid, context_system::instance()->id, true); assign_capability('moodle/competency:planviewown', CAP_ALLOW, $userroleid, context_system::instance()->id, true);
assign_capability('tool/lp:planviewdraft', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true); assign_capability('moodle/competency:planviewdraft', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true);
assign_capability('tool/lp:planmanage', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true); assign_capability('moodle/competency:planmanage', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true);
assign_capability('tool/lp:plancomment', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true); assign_capability('moodle/competency:plancomment', CAP_ALLOW, $reviewerroleid, context_system::instance()->id, true);
$dg->role_assign($userroleid, $u1->id, context_user::instance($u1->id)); $dg->role_assign($userroleid, $u1->id, context_user::instance($u1->id));
$dg->role_assign($reviewerroleid, $u2->id, context_user::instance($u1->id)); $dg->role_assign($reviewerroleid, $u2->id, context_user::instance($u1->id));
$dg->role_assign($reviewerroleid, $u3->id, context_system::instance()); $dg->role_assign($reviewerroleid, $u3->id, context_system::instance());

View file

@ -51,8 +51,8 @@ class tool_lp_plan_testcase extends advanced_testcase {
$u2context = context_user::instance($u2->id); $u2context = context_user::instance($u2->id);
$u3context = context_user::instance($u3->id); $u3context = context_user::instance($u3->id);
assign_capability('tool/lp:planmanage', CAP_ALLOW, $manage, $syscontext->id); assign_capability('moodle/competency:planmanage', CAP_ALLOW, $manage, $syscontext->id);
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $manageown, $u2context->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $manageown, $u2context->id);
role_assign($manage, $u1->id, $syscontext->id); role_assign($manage, $u1->id, $syscontext->id);
role_assign($manageown, $u2->id, $syscontext->id); role_assign($manageown, $u2->id, $syscontext->id);
@ -96,10 +96,10 @@ class tool_lp_plan_testcase extends advanced_testcase {
$u4context = context_user::instance($u4->id); $u4context = context_user::instance($u4->id);
$u5context = context_user::instance($u5->id); $u5context = context_user::instance($u5->id);
assign_capability('tool/lp:planmanage', CAP_ALLOW, $manage, $syscontext->id); assign_capability('moodle/competency:planmanage', CAP_ALLOW, $manage, $syscontext->id);
assign_capability('tool/lp:planmanageown', CAP_ALLOW, $manageown, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $manageown, $syscontext->id);
assign_capability('tool/lp:planmanagedraft', CAP_ALLOW, $managedraft, $syscontext->id); assign_capability('moodle/competency:planmanagedraft', CAP_ALLOW, $managedraft, $syscontext->id);
assign_capability('tool/lp:planmanageowndraft', CAP_ALLOW, $manageowndraft, $syscontext->id); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $manageowndraft, $syscontext->id);
role_assign($manage, $u1->id, $syscontext->id); role_assign($manage, $u1->id, $syscontext->id);
role_assign($manageown, $u2->id, $syscontext->id); role_assign($manageown, $u2->id, $syscontext->id);
@ -159,8 +159,8 @@ class tool_lp_plan_testcase extends advanced_testcase {
$u2context = context_user::instance($u2->id); $u2context = context_user::instance($u2->id);
$u3context = context_user::instance($u3->id); $u3context = context_user::instance($u3->id);
assign_capability('tool/lp:planview', CAP_ALLOW, $read, $syscontext->id); assign_capability('moodle/competency:planview', CAP_ALLOW, $read, $syscontext->id);
assign_capability('tool/lp:planviewown', CAP_ALLOW, $readown, $u2context->id); assign_capability('moodle/competency:planviewown', CAP_ALLOW, $readown, $u2context->id);
role_assign($read, $u1->id, $syscontext->id); role_assign($read, $u1->id, $syscontext->id);
role_assign($readown, $u2->id, $syscontext->id); role_assign($readown, $u2->id, $syscontext->id);
@ -204,11 +204,11 @@ class tool_lp_plan_testcase extends advanced_testcase {
$u4context = context_user::instance($u4->id); $u4context = context_user::instance($u4->id);
$u5context = context_user::instance($u5->id); $u5context = context_user::instance($u5->id);
assign_capability('tool/lp:planview', CAP_ALLOW, $read, $syscontext->id); assign_capability('moodle/competency:planview', CAP_ALLOW, $read, $syscontext->id);
assign_capability('tool/lp:planviewown', CAP_ALLOW, $readown, $syscontext->id); assign_capability('moodle/competency:planviewown', CAP_ALLOW, $readown, $syscontext->id);
assign_capability('tool/lp:planviewdraft', CAP_ALLOW, $readdraft, $syscontext->id); assign_capability('moodle/competency:planviewdraft', CAP_ALLOW, $readdraft, $syscontext->id);
assign_capability('tool/lp:planviewowndraft', CAP_ALLOW, $readowndraft, $syscontext->id); assign_capability('moodle/competency:planviewowndraft', CAP_ALLOW, $readowndraft, $syscontext->id);
assign_capability('tool/lp:planviewown', CAP_PROHIBIT, $readowndraft, $syscontext->id); assign_capability('moodle/competency:planviewown', CAP_PROHIBIT, $readowndraft, $syscontext->id);
role_assign($read, $u1->id, $syscontext->id); role_assign($read, $u1->id, $syscontext->id);
role_assign($readown, $u2->id, $syscontext->id); role_assign($readown, $u2->id, $syscontext->id);

View file

@ -38,14 +38,14 @@ $course = $DB->get_record('course', array('id' => $courseid));
$context = context_course::instance($courseid); $context = context_course::instance($courseid);
$currentgroup = groups_get_course_group($course, true); $currentgroup = groups_get_course_group($course, true);
if (empty($userid)) { if (empty($userid)) {
$gradable = get_enrolled_users($context, 'tool/lp:coursecompetencygradable', $currentgroup, 'u.id', null, 0, 1); $gradable = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup, 'u.id', null, 0, 1);
if (empty($gradable)) { if (empty($gradable)) {
$userid = 0; $userid = 0;
} else { } else {
$userid = array_pop($gradable)->id; $userid = array_pop($gradable)->id;
} }
} else { } else {
$gradable = get_enrolled_users($context, 'tool/lp:coursecompetencygradable', $currentgroup, 'u.id'); $gradable = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup, 'u.id');
if (count($gradable) == 0) { if (count($gradable) == 0) {
$userid = 0; $userid = 0;
} else if (!in_array($userid, array_keys($gradable))) { } else if (!in_array($userid, array_keys($gradable))) {

View file

@ -68,12 +68,12 @@ $customdata = array(
// Check if user has permissions to manage user evidence. // Check if user has permissions to manage user evidence.
if ($userevidence != null) { if ($userevidence != null) {
if (!$userevidence->can_manage()) { if (!$userevidence->can_manage()) {
throw new required_capability_exception($context, 'tool/lp:userevidencemanage', 'nopermissions', ''); throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
} }
$customdata['evidence'] = $userevidence; $customdata['evidence'] = $userevidence;
} else if (!\tool_lp\user_evidence::can_manage_user($userid)) { } else if (!\tool_lp\user_evidence::can_manage_user($userid)) {
throw new required_capability_exception($context, 'tool/lp:userevidencemanage', 'nopermissions', ''); throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
} }
$form = new \tool_lp\form\user_evidence($url->out(false), $customdata); $form = new \tool_lp\form\user_evidence($url->out(false), $customdata);

View file

@ -106,6 +106,37 @@ $string['comment:post'] = 'Post comments';
$string['comment:view'] = 'View comments'; $string['comment:view'] = 'View comments';
$string['community:add'] = 'Use the community block to search hubs and find courses'; $string['community:add'] = 'Use the community block to search hubs and find courses';
$string['community:download'] = 'Download a course from the community block'; $string['community:download'] = 'Download a course from the community block';
$string['competency:competencymanage'] = 'Manage competency frameworks';
$string['competency:competencygrade'] = 'Set competency grade';
$string['competency:competencyview'] = 'View competency frameworks';
$string['competency:coursecompetencygradable'] = 'Receive competency marks';
$string['competency:coursecompetencyconfigure'] = 'Configure course competency settings';
$string['competency:coursecompetencymanage'] = 'Manage course competencies';
$string['competency:coursecompetencyview'] = 'View course competencies';
$string['competency:plancomment'] = 'Comment on a learning plan';
$string['competency:plancommentown'] = 'Comment on own learning plan';
$string['competency:planmanage'] = 'Manage learning plans';
$string['competency:planmanagedraft'] = 'Manage draft learning plans';
$string['competency:planmanageown'] = 'Manage own learning plans';
$string['competency:planmanageowndraft'] = 'Manage own draft learning plans';
$string['competency:planrequestreview'] = 'Request the review of a learning plan';
$string['competency:planrequestreviewown'] = 'Request the review of own learning plan';
$string['competency:planreview'] = 'Review a learning plan';
$string['competency:planview'] = 'View all learning plans';
$string['competency:planviewdraft'] = 'View draft learning plans';
$string['competency:planviewown'] = 'View own learning plans';
$string['competency:planviewowndraft'] = 'View own draft learning plans';
$string['competency:templatemanage'] = 'Manage templates';
$string['competency:templateview'] = 'View template';
$string['competency:usercompetencycomment'] = 'Comment on a user competency';
$string['competency:usercompetencycommentown'] = 'Comment on own user competency';
$string['competency:usercompetencyrequestreview'] = 'Request the review of a user competency';
$string['competency:usercompetencyrequestreviewown'] = 'Request the review of own user competency';
$string['competency:usercompetencyreview'] = 'Review a user competency';
$string['competency:usercompetencyview'] = 'View a user competency';
$string['competency:userevidencemanage'] = 'Manage evidence of prior learning';
$string['competency:userevidencemanageown'] = 'Manage own evidence of prior learning';
$string['competency:userevidenceview'] = 'View evidence of prior learning of a user';
$string['confirmaddadmin'] = 'Do you really want to add user <strong>{$a}</strong> as new site administrator?'; $string['confirmaddadmin'] = 'Do you really want to add user <strong>{$a}</strong> as new site administrator?';
$string['confirmdeladmin'] = 'Do you really want to remove user <strong>{$a}</strong> from the list of site administrators?'; $string['confirmdeladmin'] = 'Do you really want to remove user <strong>{$a}</strong> from the list of site administrators?';
$string['confirmroleprevent'] = 'Do you really want to remove <strong>"{$a->role}"</strong> from the list of allowed roles for capability "{$a->cap}" in context "{$a->context}"?'; $string['confirmroleprevent'] = 'Do you really want to remove <strong>"{$a->role}"</strong> from the list of allowed roles for capability "{$a->cap}" in context "{$a->context}"?';

View file

@ -2056,6 +2056,239 @@ $capabilities = array(
'editingteacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW 'manager' => CAP_ALLOW
) )
) ),
// Competencies.
'moodle/competency:competencymanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
'manager' => CAP_ALLOW
)
),
'moodle/competency:competencyview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
'moodle/competency:competencygrade' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE, // And CONTEXT_USER.
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
),
// Course competencies.
'moodle/competency:coursecompetencymanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:backup'
),
'moodle/competency:coursecompetencyconfigure' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:backup'
),
'moodle/competency:coursecompetencygradable' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'student' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/course:isincompletionreports'
),
'moodle/competency:coursecompetencyview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
// User plans.
'moodle/competency:planmanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:planmanagedraft' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:planmanageown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:planmanageowndraft' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:planview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:planviewdraft' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:planviewown' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
'moodle/competency:planviewowndraft' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:planrequestreview' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
)
),
'moodle/competency:planrequestreviewown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
)
),
'moodle/competency:planreview' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:plancomment' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:plancommentown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
),
),
// User competencies.
'moodle/competency:usercompetencyview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER, // And CONTEXT_COURSE.
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'teacher' => CAP_ALLOW
)
),
'moodle/competency:usercompetencyrequestreview' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
)
),
'moodle/competency:usercompetencyrequestreviewown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
)
),
'moodle/competency:usercompetencyreview' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:usercompetencycomment' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:usercompetencycommentown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
),
),
// Template.
'moodle/competency:templatemanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:templateview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
// User evidence.
'moodle/competency:userevidencemanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'moodle/competency:userevidencemanageown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
'moodle/competency:userevidenceview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
); );