From 4a0ef03e8a36485fea3cbd3838999a1f98025e5a Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Fri, 23 Apr 2010 09:15:04 +0000 Subject: [PATCH] MDL-21781 protect cohorts created by external systesm - we can not edit them with our UIs --- cohort/assign.php | 9 ++++++++- cohort/edit.php | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cohort/assign.php b/cohort/assign.php index 6258cbef0d3..a4557d3334f 100644 --- a/cohort/assign.php +++ b/cohort/assign.php @@ -39,8 +39,15 @@ require_capability('moodle/cohort:assign', $context); $PAGE->set_url('/cohort/assign.php', array('id'=>$id)); $PAGE->set_Context($context); +$returnurl = new moodle_url('/cohort/index.php', array('contextid'=>$cohort->contextid)); + +if (!empty($cohort->component)) { + // we can not manually edit cohorts that were created by external systems, sorry + redirect($returnurl); +} + if (optional_param('cancel', false, PARAM_BOOL)) { - redirect(new moodle_url('/cohort/index.php', array('contextid'=>$cohort->contextid))); + redirect($returnurl); } if ($context->contextlevel == CONTEXT_COURSECAT) { diff --git a/cohort/edit.php b/cohort/edit.php index fa03108c937..c1e190ee05b 100644 --- a/cohort/edit.php +++ b/cohort/edit.php @@ -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); -- 2.43.0