Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Forbid restricted users from changing enrolments
  • Loading branch information
moodler committed Jul 21, 2004
1 parent 903c6f9 commit 744950f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions course/student.php
Expand Up @@ -59,6 +59,7 @@
/// Add a student if one is specified

if (!empty($add)) {
check_for_restricted_user($USER->username, "$CFG->wwwroot/course/student.php?id=$course->id");
if (! enrol_student($add, $course->id)) {
error("Could not add that student to this course!");
}
Expand All @@ -67,6 +68,7 @@
/// Remove a student if one is specified.

if (!empty($remove)) {
check_for_restricted_user($USER->username, "$CFG->wwwroot/course/student.php?id=$course->id");
if (! unenrol_student($remove, $course->id)) {
error("Could not remove that student from this course!");
}
Expand All @@ -75,6 +77,7 @@
/// Remove all students from specified course

if (!empty($removeall)) {
check_for_restricted_user($USER->username, "$CFG->wwwroot/course/student.php?id=$course->id");
$students = get_course_students($course->id, "u.lastname ASC, u.firstname ASC");
foreach ($students as $student) {
if (! unenrol_student($student->id, $course->id)) {
Expand Down

0 comments on commit 744950f

Please sign in to comment.