}
}
- $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';
// 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).'/' : '/';