From 449346098c216a212ced55d3f1655a283ce6ba4a Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Sun, 27 Dec 2015 18:05:39 +0100 Subject: [PATCH] baculum: Tweak allowed resources for normal (not admin) users --- gui/baculum/protected/Pages/Home.page | 6 +++--- gui/baculum/protected/Pages/Home.php | 6 ++++-- gui/baculum/protected/Pages/Monitor.php | 4 +++- gui/baculum/protected/Pages/RestoreWizard.php | 6 +++++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gui/baculum/protected/Pages/Home.page b/gui/baculum/protected/Pages/Home.page index 068f060e00..05f6c124c1 100644 --- a/gui/baculum/protected/Pages/Home.page +++ b/gui/baculum/protected/Pages/Home.page @@ -45,7 +45,7 @@

<%[ Most often used: ]%>

<%[ Execution count most used: ]%> <%[ times ]%>

-
+
User->getIsAdmin() === false ? ' style="display: none;"' : ''%>> <%[ Database ]%>

<%[ Database type: ]%><%=$this->dbtype%>

@@ -68,7 +68,7 @@ <%[ Restore Wizard ]%> <%[ Perform Restore ]%>
-
+
User->getIsAdmin() === false ? ' style="display: none;"' : ''%>> <%[ Configuration Wizard ]%> <%[ Baculum Settings ]%>
@@ -285,7 +285,7 @@
<%[ clear bvfs cache ]%> <%[ Enable debug ]%> - <%[ volumes tools ]%><%[ volumes tools ]%> + User->getIsAdmin() === false ? ' style="display: none;"' : ''%>><%[ volumes tools ]%><%[ volumes tools ]%> <%[ Bacula console ]%><%[ show console ]%> diff --git a/gui/baculum/protected/Pages/Home.php b/gui/baculum/protected/Pages/Home.php index 8de3dbc4ff..ff829d5c99 100644 --- a/gui/baculum/protected/Pages/Home.php +++ b/gui/baculum/protected/Pages/Home.php @@ -38,7 +38,7 @@ class Home extends BaculumPage public $jobs_states = null; - public $dbtype = null; + public $dbtype = ''; public $windowIds = array('Storage', 'Client', 'Volume', 'Pool', 'Job', 'JobRun'); @@ -75,7 +75,9 @@ class Home extends BaculumPage $this->Director->dataSource = array_combine($directors, $directors); $this->Director->SelectedValue = $_SESSION['director']; $this->Director->dataBind(); - $this->dbtype = $this->getModule('configuration')->getDbNameByType($appConfig['db']['type']); + if ($this->User->getIsAdmin() === true) { + $this->dbtype = $this->getModule('configuration')->getDbNameByType($appConfig['db']['type']); + } $this->setJobsStates(); $this->setJobs(); $this->setClients(); diff --git a/gui/baculum/protected/Pages/Monitor.php b/gui/baculum/protected/Pages/Monitor.php index 0fd4cf1b27..c0f5851f63 100644 --- a/gui/baculum/protected/Pages/Monitor.php +++ b/gui/baculum/protected/Pages/Monitor.php @@ -38,7 +38,9 @@ class Monitor extends BaculumPage { $_SESSION['monitor_data']['clients'] = $this->getModule('api')->get(array('clients'))->output; $_SESSION['monitor_data']['pools'] = $this->getModule('api')->get(array('pools'))->output; $_SESSION['monitor_data']['jobtotals'] = $this->getModule('api')->get(array('jobs', 'totals'))->output; - $_SESSION['monitor_data']['dbsize'] = $this->getModule('api')->get(array('dbsize'))->output; + if ($this->User->getIsAdmin() === true) { + $_SESSION['monitor_data']['dbsize'] = $this->getModule('api')->get(array('dbsize'))->output; + } $runningJobStates = $this->Application->getModule('misc')->getRunningJobStates(); diff --git a/gui/baculum/protected/Pages/RestoreWizard.php b/gui/baculum/protected/Pages/RestoreWizard.php index df595889fe..a4a4eb6009 100644 --- a/gui/baculum/protected/Pages/RestoreWizard.php +++ b/gui/baculum/protected/Pages/RestoreWizard.php @@ -45,9 +45,13 @@ class RestoreWizard extends BaculumPage const BVFS_PATH_PREFIX = 'b2'; + public function onPreInit($param) { + parent::onPreInit($param); + $this->Application->getModule('users')->loginUser(); + } + public function onInit($param) { parent::onInit($param); - $this->Application->getModule('users')->loginUser(); if(!$this->IsPostBack && !$this->IsCallBack) { $this->setBrowserFiles(array()); $this->setFileVersions(array()); -- 2.39.5