Merge branch 'MDL-76940-400' of https://github.com/laurentdavid/moodle into MOODLE_400_STABLE

This commit is contained in:
Sara Arjona
2023-03-09 10:54:57 +01:00
2 changed files with 16 additions and 0 deletions
@@ -297,3 +297,14 @@ Feature: Course index depending on role
| large | be | Close | not be | Open | be |
| tablet | not be | Open | not be | Open | not be |
| mobile | not be | Open | not be | Open | not be |
@javascript
Scenario: Course index is refreshed when we change role.
When I am on the "C1" "Course" page logged in as "teacher1"
And I turn editing mode on
And I hide section "1"
And I turn editing mode off
And I should see "Topic 1" in the "courseindex-content" "region"
And I follow "Switch role to..." in the user menu
And I press "Student"
Then I should not see "Topic 1" in the "courseindex-content" "region"
+5
View File
@@ -4273,6 +4273,11 @@ function role_switch($roleid, context $context) {
load_all_capabilities();
}
// Make sure that course index is refreshed.
if ($coursecontext = $context->get_course_context()) {
core_courseformat\base::session_cache_reset(get_course($coursecontext->instanceid));
}
// Add the switch RA
if ($roleid == 0) {
unset($USER->access['rsw'][$context->path]);