MDL-77645 course: ensure active enrolments are considered for drawer.

Otherwise the enrolment index page tries to load the course index
drawer, which doesn't exist at this point and triggers exceptions in
the editor module.

Co-authored-by: Tim Volckmann <tim.volckmann@mastersolution.com>
This commit is contained in:
Paul Holden 2023-07-12 14:03:59 +01:00
parent f29f757f5f
commit 0202597261
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
2 changed files with 9 additions and 1 deletions

View File

@ -3751,7 +3751,7 @@ function core_course_drawer(): string {
}
// Show course index to users can access the course only.
if (!can_access_course($PAGE->course)) {
if (!can_access_course($PAGE->course, null, '', true)) {
return '';
}

View File

@ -102,3 +102,11 @@ Feature: Restricting access to course lists
And I follow "Biology Y1"
And I should see "You cannot enrol yourself in this course."
And I log out
@javascript
Scenario: Browse courses as a user who has a disabled enrolment in them
Given the following "course enrolments" exist:
| user | course | role | status |
| usere | ENG1 | student | 1 |
When I am on the "ENG1" course page logged in as usere
Then I should see "You cannot enrol yourself in this course."