Fix for navigation breaking when students have no view rights on one of the level one categories
This commit is contained in:
parent
0c459b9a8b
commit
c4966de6fd
1 changed files with 6 additions and 0 deletions
|
@ -74,6 +74,12 @@ class webservicehelper {
|
||||||
// Initialize parent if needed.
|
// Initialize parent if needed.
|
||||||
if ($parent == null) {
|
if ($parent == null) {
|
||||||
$parent = \core_course_category::user_top();
|
$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())) {
|
if (has_capability($capability, $parent->get_context())) {
|
||||||
$list[] = $parent;
|
$list[] = $parent;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue