Permalink
Browse files

MDL-34250 navigation: Always look for correct parent context.

Conflicts:
	lib/navigationlib.php
  • Loading branch information...
1 parent bac15e5 commit ffbe597ef1e2299913c15e0ed0f882fd7d950f86 @stronk7 stronk7 committed Aug 28, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/navigationlib.php
View
@@ -1131,7 +1131,13 @@ public function initialise() {
$addedcategories[$category->id] = $categoryparent->add($category->name, $url, self::TYPE_CATEGORY, $category->name, $category->id);
if (!$category->visible) {
- if (!has_capability('moodle/category:viewhiddencategories', get_context_instance(CONTEXT_COURSECAT, $category->parent))) {
+ // Let's decide the context where viewhidden cap checks will happen.
+ if ($category->parent == '0') {
+ $contexttocheck = context_system::instance();
+ } else {
+ $contexttocheck = context_coursecat::instance($category->parent);
+ }
+ if (!has_capability('moodle/category:viewhiddencategories', $contexttocheck)) {
$addedcategories[$category->id]->display = false;
} else {
$addedcategories[$category->id]->hidden = true;

0 comments on commit ffbe597

Please sign in to comment.