diff --git a/backup/restorefile.php b/backup/restorefile.php index 7b0fcd29690..be9ae4a8fb7 100644 --- a/backup/restorefile.php +++ b/backup/restorefile.php @@ -79,6 +79,9 @@ if (!check_dir_exists($tmpdir, true, true)) { // choose the backup file from backup files tree if ($action == 'choosebackupfile') { + if ($filearea == 'automated') { + require_capability('moodle/restore:viewautomatedfilearea', $context); + } if ($fileinfo = $browser->get_file_info($filecontext, $component, $filearea, $itemid, $filepath, $filename)) { if (is_a($fileinfo, 'file_info_stored')) { // Use the contenthash rather than copying the file where possible, diff --git a/lang/en/role.php b/lang/en/role.php index 7af4a201029..15407340c90 100644 --- a/lang/en/role.php +++ b/lang/en/role.php @@ -352,7 +352,7 @@ $string['restore:restoretargetimport'] = 'Restore from files targeted as import' $string['restore:rolldates'] = 'Allowed to roll activity configuration dates on restore'; $string['restore:uploadfile'] = 'Upload files to backup areas'; $string['restore:userinfo'] = 'Restore user data'; -$string['restore:viewautomatedfilearea'] = 'View automated backup area'; +$string['restore:viewautomatedfilearea'] = 'Restore courses from automated backups'; $string['risks'] = 'Risks'; $string['roleallowheader'] = 'Allow role:'; $string['roleallowinfo'] = 'Select a role to be added to the list of allowed roles in context "{$a->context}", capability "{$a->cap}":';