MDL-35429 restore: capability clarification for automated backups

- added relevant cap check on restorefile.php to improve the error
message when attempting to restore automated backups. This cap is
already responsible for controlling restores from automated areas.
- Restored the 'viewautomatedfilearea' capabilities original lang
string.
This commit is contained in:
Jake Dallimore 2017-09-20 15:52:50 +08:00
parent d8e9a23c48
commit f2faf9fae6
2 changed files with 4 additions and 1 deletions

View File

@ -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,

View File

@ -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}":';