Commit 450498bf authored by Dongsheng Cai's avatar Dongsheng Cai Committed by Eloy Lafuente
Browse files

MDL-21671, site level categroy manage capability when edit category, credits to Vadim Dvorovenko

parent 6fe79e7f
......@@ -14,11 +14,17 @@ class editcategory_form extends moodleform {
$editoroptions = $this->_customdata['editoroptions'];
// get list of categories to use as parents, with site as the first one
$options = array(get_string('top'));
$options = array();
if (has_capability('moodle/category:manage', get_system_context()) || $category->parent == 0) {
$options[0] = get_string('top');
}
$parents = array();
if ($category->id) {
// Editing an existing category.
make_categories_list($options, $parents, 'moodle/category:manage', $category->id);
if (empty($options[$category->parent])) {
$options[$category->parent] = get_field('course_categories', 'name', 'id', $category->parent);
}
$strsubmit = get_string('savechanges');
} else {
// Making a new category
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment