MDL-35144 Categories - Allow editing by custom roles
authorDamyon Wiese <damyon@moodle.com>
Thu, 11 Apr 2013 06:07:46 +0000 (14:07 +0800)
committerDamyon Wiese <damyon@moodle.com>
Thu, 11 Apr 2013 06:10:29 +0000 (14:10 +0800)
Users with category:manage or course:create should be able to edit
the course/category.php page.

course/category.php

index 6ede36b..88ba4bf 100644 (file)
@@ -61,6 +61,12 @@ $context = $PAGE->context;
 // And the object has been loaded for us no need for another DB call
 $category = $PAGE->category;
 
+// This needs to match caps checked in can_edit_in_category below.
+$PAGE->set_other_editing_capability(array(
+    'moodle/category:manage',
+    'moodle/course:create'
+));
+
 $canedit = can_edit_in_category($category->id);
 if ($canedit) {
     if ($categoryedit !== -1) {