Skip to content

Commit

Permalink
MDL-65354 core: rename course:browse cap to category:browsecourses
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Apr 18, 2019
1 parent bef0fe2 commit d26749b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions lang/en/deprecated.txt
Expand Up @@ -153,3 +153,4 @@ hidedockpanel,core_block
undockall,core_block
undockblock,core_block
undockitem,core_block
course:browse,core_role
5 changes: 4 additions & 1 deletion lang/en/role.php
Expand Up @@ -98,6 +98,7 @@
$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';
Expand Down Expand Up @@ -154,7 +155,6 @@
$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';
Expand Down Expand Up @@ -495,3 +495,6 @@
$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';
4 changes: 2 additions & 2 deletions lib/db/access.php
Expand Up @@ -733,10 +733,10 @@
'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,
Expand Down
15 changes: 15 additions & 0 deletions lib/db/upgrade.php
Expand Up @@ -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;
}
3 changes: 2 additions & 1 deletion lib/upgrade.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -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.

Expand Down

0 comments on commit d26749b

Please sign in to comment.