MDL-65354 core: rename course:browse cap to category:browsecourses

This commit is contained in:
Simey Lameze 2019-04-15 11:58:58 +08:00
parent bef0fe2000
commit d26749b74c
6 changed files with 25 additions and 5 deletions

View File

@ -153,3 +153,4 @@ hidedockpanel,core_block
undockall,core_block
undockblock,core_block
undockitem,core_block
course:browse,core_role

View File

@ -98,6 +98,7 @@ $string['calendar:managegroupentries'] = 'Manage group calendar entries';
$string['calendar:manageownentries'] = 'Manage own calendar entries';
$string['capabilities'] = 'Capabilities';
$string['capability'] = 'Capability';
$string['category:viewcourselist'] = 'View list of courses you are not enrolled in';
$string['category:create'] = 'Create categories';
$string['category:delete'] = 'Delete categories';
$string['category:manage'] = 'Manage categories';
@ -154,7 +155,6 @@ $string['confirmunassignyes'] = 'Remove';
$string['confirmunassignno'] = 'Cancel';
$string['context'] = 'Context';
$string['course:activityvisibility'] = 'Hide/show activities';
$string['course:browse'] = 'View list of courses where user is not enrolled';
$string['course:bulkmessaging'] = 'Send a message to many people';
$string['course:create'] = 'Create courses';
$string['course:creategroupconversations'] = 'Create group conversations';
@ -495,3 +495,6 @@ $string['privacy:metadata:role_capabilities:tableexplanation'] = 'The capabiliti
$string['privacy:metadata:role_capabilities:timemodified'] = 'The date when the capability was created or modified.';
$string['privacy:metadata:role_cohortroles'] = 'Roles to cohort';
$string['course:togglecompletion'] = 'Manually mark activities as complete';
// Deprecated since Moodle 3.7
$string['course:browse'] = 'View list of courses where user is not enrolled';

View File

@ -733,10 +733,10 @@ $capabilities = array(
'clonepermissionsfrom' => 'moodle/category:update'
),
'moodle/course:browse' => array(
'moodle/category:viewcourselist' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'contextlevel' => CONTEXT_COURSECAT,
'archetypes' => array(
'guest' => CAP_ALLOW,
'user' => CAP_ALLOW,

View File

@ -2988,5 +2988,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2019041000.02);
}
if ($oldversion < 2019041300.01) {
$sql = "UPDATE {capabilities}
SET name = ?,
contextlevel = ?
WHERE name = ?";
$DB->execute($sql, ['moodle/category:viewcourselist', CONTEXT_COURSECAT, 'moodle/course:browse']);
$sql = "UPDATE {role_capabilities}
SET capability = ?
WHERE capability = ?";
$DB->execute($sql, ['moodle/category:viewcourselist', 'moodle/course:browse']);
// Main savepoint reached.
upgrade_main_savepoint(true, 2019041300.01);
}
return true;
}

View File

@ -2,7 +2,8 @@ This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 3.7 ===
* The 'moodle/course:browse' has been renamed to a more accurate name 'moodle/category:viewcourselist'.
Also the context level of that capability has changed from course to course category context.
* Nodes in the navigation api can have labels for each group. See set/get_collectionlabel().
* The method core_user::is_real_user() now returns false for userid = 0 parameter
* 'mform1' dependencies (in themes, js...) will stop working because a randomly generated string has been added to the id

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2019041300.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019041300.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.