MDL-21781 protect cohorts created by external systesm - we can not edit them with...
[moodle.git] / cohort / edit.php
index fa03108..c1e190e 100644 (file)
@@ -56,6 +56,11 @@ require_capability('moodle/cohort:manage', $context);
 
 $returnurl = new moodle_url('/cohort/index.php', array('contextid'=>$context->id));
 
+if (!empty($cohort->component)) {
+    // we can not manually edit cohorts that were created by external systems, sorry
+    redirect($returnurl);
+}
+
 $PAGE->set_context($context);
 $PAGE->set_url('/cohort/edit.php', array('contextid'=>$context->id, 'id'=>$cohort->id));
 $PAGE->set_context($context);