Skip to content
Browse files

More restrictions on enrol/unenrol of meta courses. Thanks to Bug #4057

  • Loading branch information...
1 parent ace9977 commit 498ef90f7b9be57bf261d148a70b72658c9e8dc9 patrickslee committed
Showing with 4 additions and 4 deletions.
  1. +1 −1 blocks/admin/block_admin.php
  2. +2 −2 course/importstudents.php
  3. +1 −1 course/unenrol.php
View
2 blocks/admin/block_admin.php
@@ -189,7 +189,7 @@ function load_content_for_course() {
$this->content->items[]='<a href="'.$CFG->changepassword.'">'.get_string('changepassword').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
}
- if ($CFG->allowunenroll) {
+ if ($CFG->allowunenroll && !$course->metacourse) {
$this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
}
View
4 course/importstudents.php
@@ -27,8 +27,8 @@
redirect("$CFG->wwwroot/course/student.php?id=$course->id");
}
- if (!isadmin()) {
- error("You must be an admin");
+ if (!isadmin() || !isteacheredit($course->id)) {
+ error("You must be an admin or a teacher of this course");
}
View
2 course/unenrol.php
@@ -24,7 +24,7 @@
error("You must be a teacher with editing rights to do this");
}
- if ($user->id == $USER->id and !$CFG->allowunenroll) {
+ if ($user->id == $USER->id and !$CFG->allowunenroll or $course->metacourse) {
error("You are not allowed to unenroll");
}

0 comments on commit 498ef90

Please sign in to comment.
Something went wrong with that request. Please try again.