MDL-35429 backup: Only show relevant actions for automated backups

- Users without permission to download or restore won't see the
respective links.
- The 'Manage backup files' button for the 'automated' backup filearea
now requires the same permissions as downloading does for this filearea,
those being 'restore:userinfo' and 'backup:downloadfile'.
This commit is contained in:
Jake Dallimore 2017-10-06 11:12:22 +08:00
parent 54945fa728
commit 5bbea7338d
4 changed files with 119 additions and 13 deletions

View file

@ -42,6 +42,9 @@ $url = new moodle_url('/backup/backupfilesedit.php', array('currentcontext'=>$cu
require_login($course, false, $cm);
require_capability('moodle/restore:uploadfile', $context);
if ($filearea == 'automated' && !can_download_from_backup_filearea($filearea, $context)) {
throw new required_capability_exception($context, 'moodle/backup:downloadfile', 'nopermissions', '');
}
$PAGE->set_url($url);
$PAGE->set_context($context);