From ad822b36d9be923778bdd95dab2e31256aec2a56 Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 1 Nov 2005 17:25:02 +0000 Subject: [PATCH] fixed access rights of creators during restore SC#177; merged from MOODLE_15_STABLE --- backup/restore_check.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backup/restore_check.html b/backup/restore_check.html index 3069feb2aa1..2848737dcc4 100644 --- a/backup/restore_check.html +++ b/backup/restore_check.html @@ -153,6 +153,9 @@ print_heading(get_string("choosecourse")); print_simple_box_start("center"); foreach ($courses as $course) { + if (!isteacheredit($course->id)) { + continue; + } if (empty($course->visible)) { $optdimmed = ' class="dimmed" '; } else { @@ -167,6 +170,12 @@ } //Checks everything and execute restore } else if ((($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id != 0)) or ($restore->restoreto == 2)) { + //Final access control check + if ($restore->course_id == 0 and !iscreator()) { + error("You need to be a creator or admin to restore into new course!"); + } else if ($restore->course_id != 0 and !isteacheredit($restore->course_id)) { + error("You need to be an edit teacher or admin to restore into selected course!"); + } $show_continue_button = true; //Check if we've selected any mod's user info and restore->users //is set to none. Change it to course and inform.