Skip to content

Commit

Permalink
MDL-53483 tool_lp: Normalise the names of capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
gauts authored and Frederic Massart committed Apr 18, 2016
1 parent a4f1b03 commit 44e8cba
Show file tree
Hide file tree
Showing 20 changed files with 202 additions and 170 deletions.
174 changes: 87 additions & 87 deletions admin/tool/lp/classes/api.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/tool/lp/classes/form/framework_autocomplete.php
Expand Up @@ -106,7 +106,7 @@ public function setValue($value) {
list($insql, $inparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED, 'param');
$frameworks = competency_framework::get_records_select("id $insql", $inparams, 'shortname');
foreach ($frameworks as $framework) {
if (!has_any_capability(array('tool/lp:competencyread', 'tool/lp:competencymanage'), $framework->get_context())) {
if (!has_any_capability(array('tool/lp:competencyview', 'tool/lp:competencymanage'), $framework->get_context())) {
continue;
} else if ($this->onlyvisible && !$framework->get_visible()) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/classes/output/template_cohorts_table.php
Expand Up @@ -62,7 +62,7 @@ public function __construct($uniqueid, \tool_lp\template $template) {

// This object should not be used without the right permissions.
if (!$template->can_read()) {
throw new required_capability_exception($template->get_context(), 'tool/lp:templateread', 'nopermissions', '');
throw new required_capability_exception($template->get_context(), 'tool/lp:templateview', 'nopermissions', '');
}

// Set protected properties.
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/classes/output/template_plans_table.php
Expand Up @@ -62,7 +62,7 @@ public function __construct($uniqueid, \tool_lp\template $template) {

// This object should not be used without the right permissions.
if (!$template->can_read()) {
throw new required_capability_exception($template->get_context(), 'tool/lp:templateread', 'nopermissions', '');
throw new required_capability_exception($template->get_context(), 'tool/lp:templateview', 'nopermissions', '');
}

// Set protected properties.
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/classes/template.php
Expand Up @@ -133,7 +133,7 @@ public function can_read() {
* @return bool
*/
public static function can_read_context($context) {
return has_capability('tool/lp:templateread', $context) || self::can_manage_context($context);
return has_capability('tool/lp:templateview', $context) || self::can_manage_context($context);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/classes/user_evidence.php
Expand Up @@ -187,7 +187,7 @@ public static function can_manage_user($evidenceuserid) {
public static function can_read_user($evidenceuserid) {
$context = context_user::instance($evidenceuserid);

$capabilities = array('tool/lp:userevidenceread');
$capabilities = array('tool/lp:userevidenceview');

return has_any_capability($capabilities, $context) || self::can_manage_user($evidenceuserid);
}
Expand Down
8 changes: 4 additions & 4 deletions admin/tool/lp/db/access.php
Expand Up @@ -36,7 +36,7 @@
'manager' => CAP_ALLOW
)
),
'tool/lp:competencyread' => array(
'tool/lp:competencyview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
Expand Down Expand Up @@ -78,7 +78,7 @@
),
'clonepermissionsfrom' => 'moodle/course:isincompletionreports'
),
'tool/lp:coursecompetencyread' => array(
'tool/lp:coursecompetencyview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
Expand Down Expand Up @@ -229,7 +229,7 @@
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:templateread' => array(
'tool/lp:templateview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
Expand All @@ -252,7 +252,7 @@
),
'clonepermissionsfrom' => 'moodle/block:view'
),
'tool/lp:userevidenceread' => array(
'tool/lp:userevidenceview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
Expand Down
68 changes: 34 additions & 34 deletions admin/tool/lp/db/services.php
Expand Up @@ -45,7 +45,7 @@
'classpath' => '',
'description' => 'Load a summary of a competency framework.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_duplicate_competency_framework' => array(
Expand Down Expand Up @@ -81,7 +81,7 @@
'classpath' => '',
'description' => 'Load a list of a competency frameworks.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_count_competency_frameworks' => array(
Expand All @@ -90,7 +90,7 @@
'classpath' => '',
'description' => 'Count a list of a competency frameworks.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_competency_framework_viewed' => array(
Expand All @@ -99,7 +99,7 @@
'classpath' => '',
'description' => 'Log event competency framework viewed',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_data_for_competency_frameworks_manage_page' => array(
Expand All @@ -108,7 +108,7 @@
'classpath' => '',
'description' => 'Load the data for the competency frameworks manage page template',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_create_competency' => array(
Expand All @@ -126,7 +126,7 @@
'classpath' => '',
'description' => 'Load a summary of a competency.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_competency_viewed' => array(
Expand All @@ -135,7 +135,7 @@
'classpath' => '',
'description' => 'Log event competency viewed',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_delete_competency' => array(
Expand All @@ -162,7 +162,7 @@
'classpath' => '',
'description' => 'Load competency data for summary template.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_list_competencies' => array(
Expand All @@ -171,7 +171,7 @@
'classpath' => '',
'description' => 'Load a list of a competencies.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_list_competencies_in_template' => array(
Expand All @@ -180,7 +180,7 @@
'classpath' => '',
'description' => 'Load a list of a competencies for a given template.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_count_competencies' => array(
Expand All @@ -189,7 +189,7 @@
'classpath' => '',
'description' => 'Count a list of a competencies.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_count_competencies_in_template' => array(
Expand All @@ -198,7 +198,7 @@
'classpath' => '',
'description' => 'Count a list of a competencies for a given template.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_search_competencies' => array(
Expand All @@ -207,7 +207,7 @@
'classpath' => '',
'description' => 'Search a list of a competencies.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_data_for_competencies_manage_page' => array(
Expand All @@ -216,7 +216,7 @@
'classpath' => '',
'description' => 'Load the data for the competencies manage page template',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_set_parent_competency' => array(
Expand Down Expand Up @@ -252,7 +252,7 @@
'classpath' => '',
'description' => 'List the competencies in a course',
'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyread',
'capabilities' => 'tool/lp:coursecompetencyview',
'ajax' => true,
),
'tool_lp_list_courses_using_competency' => array(
Expand All @@ -261,7 +261,7 @@
'classpath' => '',
'description' => 'List the courses using a competency',
'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyread',
'capabilities' => 'tool/lp:coursecompetencyview',
'ajax' => true,
),
'tool_lp_count_competencies_in_course' => array(
Expand All @@ -270,7 +270,7 @@
'classpath' => '',
'description' => 'List the competencies in a course',
'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyread',
'capabilities' => 'tool/lp:coursecompetencyview',
'ajax' => true,
),
'tool_lp_count_courses_using_competency' => array(
Expand All @@ -279,7 +279,7 @@
'classpath' => '',
'description' => 'List the courses using a competency',
'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyread',
'capabilities' => 'tool/lp:coursecompetencyview',
'ajax' => true,
),
'tool_lp_add_competency_to_course' => array(
Expand Down Expand Up @@ -333,7 +333,7 @@
'classpath' => '',
'description' => 'Load the data for the course competencies page template.',
'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyread',
'capabilities' => 'tool/lp:coursecompetencyview',
'ajax' => true,
),
'tool_lp_data_for_template_competencies_page' => array(
Expand All @@ -342,7 +342,7 @@
'classpath' => '',
'description' => 'Load the data for the template competencies page template.',
'type' => 'read',
'capabilities' => 'tool/lp:templateread',
'capabilities' => 'tool/lp:templateview',
'ajax' => true,
),
'tool_lp_reorder_course_competency' => array(
Expand Down Expand Up @@ -387,7 +387,7 @@
'classpath' => '',
'description' => 'Load a summary of a learning plan template.',
'type' => 'read',
'capabilities' => 'tool/lp:templateread',
'capabilities' => 'tool/lp:templateview',
'ajax' => true,
),
'tool_lp_delete_template' => array(
Expand All @@ -414,7 +414,7 @@
'classpath' => '',
'description' => 'Load a list of a learning plan templates.',
'type' => 'read',
'capabilities' => 'tool/lp:templateread',
'capabilities' => 'tool/lp:templateview',
'ajax' => true,
),
'tool_lp_list_templates_using_competency' => array(
Expand All @@ -423,7 +423,7 @@
'classpath' => '',
'description' => 'Load a list of a learning plan templates for a given competency.',
'type' => 'read',
'capabilities' => 'tool/lp:templateread',
'capabilities' => 'tool/lp:templateview',
'ajax' => true,
),
'tool_lp_count_templates' => array(
Expand All @@ -432,7 +432,7 @@
'classpath' => '',
'description' => 'Count a list of a learning plan templates.',
'type' => 'read',
'capabilities' => 'tool/lp:templateread',
'capabilities' => 'tool/lp:templateview',
'ajax' => true,
),
'tool_lp_count_templates_using_competency' => array(
Expand All @@ -441,7 +441,7 @@
'classpath' => '',
'description' => 'Count a list of a learning plan templates for a given competency.',
'type' => 'read',
'capabilities' => 'tool/lp:templateread',
'capabilities' => 'tool/lp:templateview',
'ajax' => true,
),
'tool_lp_data_for_templates_manage_page' => array(
Expand All @@ -450,7 +450,7 @@
'classpath' => '',
'description' => 'Load the data for the learning plan templates manage page template',
'type' => 'read',
'capabilities' => 'tool/lp:templateread',
'capabilities' => 'tool/lp:templateview',
'ajax' => true,
),
'tool_lp_create_plan' => array(
Expand Down Expand Up @@ -630,7 +630,7 @@
'classpath' => '',
'description' => 'Check if a template has related data',
'type' => 'read',
'capabilities' => 'tool/lp:templateread',
'capabilities' => 'tool/lp:templateview',
'ajax' => true,
),
'tool_lp_get_scale_values' => array(
Expand Down Expand Up @@ -666,7 +666,7 @@
'classpath' => '',
'description' => 'Load the data for the related competencies template.',
'type' => 'read',
'capabilities' => 'tool/lp:competencyread',
'capabilities' => 'tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_search_users' => array(
Expand Down Expand Up @@ -695,7 +695,7 @@
'classpath' => '',
'description' => 'Read an evidence of prior learning.',
'type' => 'read',
'capabilities' => 'tool/lp:userevidenceread',
'capabilities' => 'tool/lp:userevidenceview',
'ajax' => true,
),
'tool_lp_delete_user_evidence' => array(
Expand All @@ -713,7 +713,7 @@
'classpath' => '',
'description' => 'Load the data for the user evidence list page template',
'type' => 'read',
'capabilities' => 'tool/lp:userevidenceread',
'capabilities' => 'tool/lp:userevidenceview',
'ajax' => true,
),
'tool_lp_data_for_user_evidence_page' => array(
Expand All @@ -722,7 +722,7 @@
'classpath' => '',
'description' => 'Load the data for the user evidence page template',
'type' => 'read',
'capabilities' => 'tool/lp:userevidenceread',
'capabilities' => 'tool/lp:userevidenceview',
'ajax' => true,
),
'tool_lp_create_user_evidence_competency' => array(
Expand All @@ -731,7 +731,7 @@
'classpath' => '',
'description' => 'Create an evidence of prior learning relationship with a competency.',
'type' => 'read',
'capabilities' => 'tool/lp:userevidencemanageown, tool/lp:competencyread',
'capabilities' => 'tool/lp:userevidencemanageown, tool/lp:competencyview',
'ajax' => true,
),
'tool_lp_delete_user_evidence_competency' => array(
Expand Down Expand Up @@ -869,7 +869,7 @@
'classpath' => '',
'description' => 'Load a summary of a user competency.',
'type' => 'read',
'capabilities' => 'tool/lp:coursecompetencyread',
'capabilities' => 'tool/lp:coursecompetencyview',
'ajax' => true,
),
'tool_lp_unlink_plan_from_template' => array(
Expand All @@ -887,7 +887,7 @@
'classpath' => '',
'description' => 'Log event template viewed',
'type' => 'read',
'capabilities' => 'tool/lp:templateread',
'capabilities' => 'tool/lp:templateview',
'ajax' => true,
),
'tool_lp_request_review_of_user_evidence_linked_competencies' => array(
Expand Down

0 comments on commit 44e8cba

Please sign in to comment.