diff options
author | Simon Rettberg | 2017-12-15 21:37:08 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-12-15 21:37:08 +0100 |
commit | e41a8074713861bdd8c6ef34d4f3465864bf4cd4 (patch) | |
tree | 6c62391ce7e1d7944889dc675c0e8ab26cf2dfe6 /modules-available/backup/page.inc.php | |
parent | [roomplanner] Fix deleting PCs after loading room plan (diff) | |
parent | [backup] added permissions to create and restore backups (diff) | |
download | slx-admin-e41a8074713861bdd8c6ef34d4f3465864bf4cd4.tar.gz slx-admin-e41a8074713861bdd8c6ef34d4f3465864bf4cd4.tar.xz slx-admin-e41a8074713861bdd8c6ef34d4f3465864bf4cd4.zip |
Merge branch 'permission-manager' of openslx.org:openslx-ng/slx-admin into permission-manager
Diffstat (limited to 'modules-available/backup/page.inc.php')
-rw-r--r-- | modules-available/backup/page.inc.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modules-available/backup/page.inc.php b/modules-available/backup/page.inc.php index 77d677c7..26182ca3 100644 --- a/modules-available/backup/page.inc.php +++ b/modules-available/backup/page.inc.php @@ -11,21 +11,21 @@ class Page_Backup extends Page protected function doPreprocess() { User::load(); - if (!User::hasPermission('superadmin')) { + if (!User::isLoggedIn()) { Message::addError('main.no-permission'); Util::redirect('?do=Main'); } $this->action = Request::post('action'); - if ($this->action === 'backup') { + if ($this->action === 'backup' && User::hasPermission("create")) { $this->backup(); - } elseif ($this->action === 'restore') { + } elseif ($this->action === 'restore' && User::hasPermission("restore")) { $this->restore(); } } protected function doRender() { - if ($this->action === 'restore') { + if ($this->action === 'restore' && User::hasPermission("restore")) { Render::addTemplate('restore', $this->templateData); } else { $lastBackup = (int)Property::get(self::LAST_BACKUP_PROP, 0); @@ -34,7 +34,9 @@ class Page_Backup extends Page } else { $lastBackup = date('d.m.Y', $lastBackup); } - Render::addTemplate('_page', ['last_backup' => $lastBackup]); + Render::addTemplate('_page', ['last_backup' => $lastBackup, + "createAllowed" => User::hasPermission("create"), + "restoreAllowed" => User::hasPermission("restore")]); } } |