MDL-35429 restore: fixed downloading of automated backup files

This commit is contained in:
Jake Dallimore 2017-09-20 16:42:28 +08:00
parent f2faf9fae6
commit 521d900f06
2 changed files with 5 additions and 2 deletions

View File

@ -338,7 +338,9 @@ class file_info_context_course extends file_info {
}
}
$downloadable = has_capability('moodle/site:config', $this->context);
// Automated backup files are only downloadable if the user has both 'backup:downloadfile and 'restore:userinfo'.
$downloadable = has_capability('moodle/backup:downloadfile', $this->context) &&
has_capability('moodle/restore:userinfo', $this->context);
$uploadable = false;
$urlbase = $CFG->wwwroot.'/pluginfile.php';

View File

@ -4623,7 +4623,8 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null, $offlin
// Backup files that were generated by the automated backup systems.
require_login($course);
require_capability('moodle/site:config', $context);
require_capability('moodle/backup:downloadfile', $context);
require_capability('moodle/restore:userinfo', $context);
$filename = array_pop($args);
$filepath = $args ? '/'.implode('/', $args).'/' : '/';