Skip to content

Commit

Permalink
MDL-21781 protect cohorts created by external systesm - we can not ed…
Browse files Browse the repository at this point in the history
…it them with our UIs
  • Loading branch information
skodak committed Apr 23, 2010
1 parent e60ff53 commit 4a0ef03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cohort/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@
$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) {
Expand Down
5 changes: 5 additions & 0 deletions cohort/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@

$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);
Expand Down

0 comments on commit 4a0ef03

Please sign in to comment.