diff --git a/backup/restore.php b/backup/restore.php index 47f20c94efa..0224a304cc7 100644 --- a/backup/restore.php +++ b/backup/restore.php @@ -55,7 +55,8 @@ if (empty($to)) { error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); } else { - if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) { + if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to)) + && !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) { error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); } } diff --git a/backup/restore_execute.html b/backup/restore_execute.html index 64be901a545..3406d7777cb 100644 --- a/backup/restore_execute.html +++ b/backup/restore_execute.html @@ -26,7 +26,8 @@ if (empty($to)) { error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); } else { - if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) { + if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to)) + && !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) { error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); } } diff --git a/backup/restore_precheck.html b/backup/restore_precheck.html index 777e24c2105..2f213a4ec92 100644 --- a/backup/restore_precheck.html +++ b/backup/restore_precheck.html @@ -18,7 +18,8 @@ if (empty($to)) { error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); } else { - if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) { + if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to)) + && !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) { error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); } }