Closed t-schroeder closed 3 months ago
The error looks the same as the one described in #58 from a user's perspective.
I've debugged this problem and noticed the redirect is performed in course/view.php#L114 and the manipulation of the global $section
variable that happens in lib.php#L102 and lib.php#L151 causes it to want to display the unavailable section again on each redirect causing another redirect.
I've supplied a fix that a) disables unavailable tabs in this case and b) ensures that even if someone visits the URL of such a tab with the above mentioned capability combination e.g. through a role switch it won't cause infinite redirects.
We use a role for tutors that has the capability
moodle/course:viewhiddensections
but doesn't havemoodle/course:ignoreavailabilityrestrictions
. Then we have a course that has a section with a date access restriction, so the section only becomes available once a certain date is reached or passed. When a tutor clicks on the section there are infinite redirects.