navigation MDL-24990 Wrapped link to assign roles in categories within proper capabil...
authorSam Hemelryk <sam@moodle.com>
Thu, 11 Nov 2010 08:58:46 +0000 (08:58 +0000)
committerSam Hemelryk <sam@moodle.com>
Thu, 11 Nov 2010 08:58:46 +0000 (08:58 +0000)
lib/navigationlib.php

index 318d1de..c7ad1e7 100644 (file)
@@ -3511,8 +3511,10 @@ class settings_navigation extends navigation_node {
         }
 
         // Assign local roles
-        $assignurl = new moodle_url('/'.$CFG->admin.'/roles/assign.php', array('contextid'=>$this->context->id));
-        $categorynode->add(get_string('assignroles', 'role'), $assignurl, self::TYPE_SETTING);
+        if (has_capability('moodle/role:assign', $this->context)) {
+            $assignurl = new moodle_url('/'.$CFG->admin.'/roles/assign.php', array('contextid'=>$this->context->id));
+            $categorynode->add(get_string('assignroles', 'role'), $assignurl, self::TYPE_SETTING);
+        }
 
         // Override roles
         if (has_capability('moodle/role:review', $this->context) or count(get_overridable_roles($this->context))>0) {