Fix for navigation breaking when students have no view rights on one of the level one categories

This commit is contained in:
PMKuipers 2023-12-06 22:28:11 +01:00
parent 0c459b9a8b
commit c4966de6fd

View File

@ -74,6 +74,12 @@ class webservicehelper {
// Initialize parent if needed.
if ($parent == null) {
$parent = \core_course_category::user_top();
if ($parent == null) {
// If the parent is still null, we do not have a valid user top.
return false;
}
if (has_capability($capability, $parent->get_context())) {
$list[] = $parent;
}