category editing MDL-21671 MOODLE_19_STABLE check capability when parent category changed

This commit is contained in:
Dongsheng Cai
2010-12-20 19:23:46 +01:00
committed by Eloy Lafuente (stronk7)
parent 5b6519cb42
commit 009fca2bb4
+2
View File
@@ -61,6 +61,8 @@ if ($mform->is_cancelled()) {
// Update an existing category.
$newcategory->id = $category->id;
if ($newcategory->parent != $category->parent) {
// check category manage capability if parent changed
require_capability('moodle/category:manage', get_category_or_system_context((int)$newcategory->parent));
$parent_cat = get_record('course_categories', 'id', $newcategory->parent);
move_category($newcategory, $parent_cat);
}