diff options
author | Simon Rettberg | 2018-02-09 16:17:03 +0100 |
---|---|---|
committer | Simon Rettberg | 2018-02-09 16:17:03 +0100 |
commit | 676bb4aebcbb65f6271f062d03aef2a48346f2e3 (patch) | |
tree | 4ebaa48cad5acf9d9087f206018da446cd4a9e62 /modules-available/backup/page.inc.php | |
parent | Permissions: Introduce helper functions for common tasks (diff) | |
download | slx-admin-676bb4aebcbb65f6271f062d03aef2a48346f2e3.tar.gz slx-admin-676bb4aebcbb65f6271f062d03aef2a48346f2e3.tar.xz slx-admin-676bb4aebcbb65f6271f062d03aef2a48346f2e3.zip |
[backup] Use permission helpers
Diffstat (limited to 'modules-available/backup/page.inc.php')
-rw-r--r-- | modules-available/backup/page.inc.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules-available/backup/page.inc.php b/modules-available/backup/page.inc.php index 949cd7f3..14522734 100644 --- a/modules-available/backup/page.inc.php +++ b/modules-available/backup/page.inc.php @@ -16,16 +16,18 @@ class Page_Backup extends Page Util::redirect('?do=Main'); } $this->action = Request::post('action'); - if ($this->action === 'backup' && User::hasPermission("create")) { + if ($this->action === 'backup') { + User::assertPermission("create"); $this->backup(); - } elseif ($this->action === 'restore' && User::hasPermission("restore")) { + } elseif ($this->action === 'restore') { + User::assertPermission("restore"); $this->restore(); } } protected function doRender() { - if ($this->action === 'restore' && User::hasPermission("restore")) { + if ($this->action === 'restore') { // TODO: We're in post mode, redirect with all the taskids first... Render::addTemplate('restore', $this->templateData); } else { $lastBackup = (int)Property::get(self::LAST_BACKUP_PROP, 0); @@ -34,9 +36,9 @@ class Page_Backup extends Page } else { $lastBackup = date('d.m.Y', $lastBackup); } - Render::addTemplate('_page', ['last_backup' => $lastBackup, - "createAllowed" => User::hasPermission("create"), - "restoreAllowed" => User::hasPermission("restore")]); + $params = ['last_backup' => $lastBackup]; + Permission::addGlobalTags($params['perms'], NULL, ['create', 'restore']); + Render::addTemplate('_page', $params); } } |