]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Tweak allowed resources for normal (not admin) users
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 27 Dec 2015 17:05:39 +0000 (18:05 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 27 Dec 2015 17:06:03 +0000 (18:06 +0100)
gui/baculum/protected/Pages/Home.page
gui/baculum/protected/Pages/Home.php
gui/baculum/protected/Pages/Monitor.php
gui/baculum/protected/Pages/RestoreWizard.php

index 068f060e006f55ae56964ab70c5a4bea0d056aae..05f6c124c1b6e3cb250c2b5cce80aa3be1e5eafa 100644 (file)
@@ -45,7 +45,7 @@
                                        <p><span><%[ Most often used: ]%></span><span id="jobs_most"></span></p>
                                        <p><span><%[ Execution count most used: ]%></span><span id="jobs_most_count"></span> <%[ times ]%></p>
                                </fieldset>
-                               <fieldset class="dashboard_field">
+                               <fieldset class="dashboard_field"<%=$this->User->getIsAdmin() === false ? ' style="display: none;"' : ''%>>
                                        <legend><%[ Database ]%></legend>
                                        <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/database.png" alt="" />
                                        <p><span><%[ Database type: ]%></span><span><%=$this->dbtype%></span></p>
@@ -68,7 +68,7 @@
                                        <legend><%[ Restore Wizard ]%></legend>
                                        <a class="big" href="<%=$this->Service->constructUrl('RestoreWizard')%>" style="line-height: 73px; margin: 0 45px"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/restore.png" alt="" /><%[ Perform Restore ]%></a>
                                </fieldset>
-                               <fieldset class="dashboard_field">
+                               <fieldset class="dashboard_field"<%=$this->User->getIsAdmin() === false ? ' style="display: none;"' : ''%>>
                                        <legend><%[ Configuration Wizard ]%></legend>
                                        <a class="big" href="<%=$this->Service->constructUrl('ConfigurationWizard')%>" style="line-height: 73px; margin: 0 45px"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/setting.png" alt="" /><%[ Baculum Settings ]%></a>
                                </fieldset>
        <div id="console">
                <a id="clear_bvfs_cache" href="javascript: void(0)"><com:TActiveImageButton ID="ClearBvfsCache" OnCallback="clearBvfsCache" Attributes.onclick="return (confirm('<%=Prado::localize('This action will clear bvfs cache that was created during preparing restore files. There is not recommended use this action during restore job working. Are you sure?')%>'));" ImageUrl="<%=$this->getPage()->getTheme()->getBaseUrl()%>/trash_icon.png" AlternateText="<%[ clear bvfs cache ]%>" /><com:TLabel ForControl="ClearBvfsCache"><%[ clear bvfs cache ]%></com:TLabel></a>
                <a id="logging" href="javascript:void(0)"><com:TActiveCheckBox ID="Logging" OnCallback="setDebug" Attributes.onclick="return (this.checked === false || confirm('<%=Prado::localize('Debug files enable possibility to save most of actions executed on Baculum WebGUI. Debug functionality should be enabled if is happening shomething wrong with Baculum or something that looks like a bug. Logs can be useful for detecting a problems in Baculum working. After confirmation this message Baculum debug files will be continuously saving in /protected/Data/ directory. Are you sure?')%>'));" /><com:TLabel ForControl="Logging"><%[ Enable debug ]%></com:TLabel></a>
-               <a id="volumes_tools_launcher" href="javascript:void(0)"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/tape_tools_icon.png" alt="<%[ volumes tools ]%>" /><span><%[ volumes tools ]%></span></a>
+               <a id="volumes_tools_launcher" href="javascript:void(0)" <%=$this->User->getIsAdmin() === false ? ' style="display: none;"' : ''%>><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/tape_tools_icon.png" alt="<%[ volumes tools ]%>" /><span><%[ volumes tools ]%></span></a>
                <a id="console_launcher" href="javascript:void(0)"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/console_icon.png" alt="<%[ Bacula console ]%>" /><span><%[ show console ]%></span></a>
                <com:Application.Portlets.VolumesTools ID="VolumesTools" />
                <com:Application.Portlets.Console ID="Console" />
index 8de3dbc4ff44803480c34ce031138b2c76e99f7b..ff829d5c990e05fe497a7de54e4766593621700a 100644 (file)
@@ -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();
index 0fd4cf1b276c5ab9dfea9af8e2c9302e6280c553..c0f5851f632617535d625ed6f642c62c73fb2e84 100644 (file)
@@ -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();
 
index df595889fe8c3fafcb95733ed17075fc1b57ff1b..a4a4eb6009dac2438732a819386f2d83218e72ac 100644 (file)
@@ -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());