summaryrefslogtreecommitdiffstats
path: root/modules-available/backup/page.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/backup/page.inc.php')
-rw-r--r--modules-available/backup/page.inc.php44
1 files changed, 8 insertions, 36 deletions
diff --git a/modules-available/backup/page.inc.php b/modules-available/backup/page.inc.php
index 77d677c7..949cd7f3 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")]);
}
}
@@ -137,35 +139,5 @@ class Page_Backup extends Page
if (isset($task['id']))
$this->templateData['rebootid'] = $task['id'];
}
- private function stopDaemons($parent)
- {
- $task = Taskmanager::submit('SyncdaemonLauncher', array(
- 'operation' => 'stop',
- 'parentTask' => $parent,
- 'failOnParentFail' => false
- ));
- if (isset($task['id'])) {
- $this->templateData['syncid'] = $task['id'];
- $parent = $task['id'];
- }
- $task = Taskmanager::submit('DozmodLauncher', array(
- 'operation' => 'stop',
- 'parentTask' => $parent,
- 'failOnParentFail' => false
- ));
- if (isset($task['id'])) {
- $this->templateData['dmsdid'] = $task['id'];
- $parent = $task['id'];
- }
- $task = Taskmanager::submit('LdadpLauncher', array(
- 'ids' => array(),
- 'parentTask' => $parent,
- 'failOnParentFail' => false
- ));
- if (isset($task['id'])) {
- $this->templateData['ldadpid'] = $task['id'];
- $parent = $task['id'];
- }
- return $parent;
- }
+
}