]> git.sur5r.net Git - bacula/bacula/commitdiff
Filtred single results for restricted consoles
authorMarcin Haba <marcin.haba@bacula.pl>
Mon, 28 Apr 2014 01:22:20 +0000 (03:22 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Mon, 28 Apr 2014 01:22:20 +0000 (03:22 +0200)
gui/baculum/protected/Pages/API/Client.php
gui/baculum/protected/Pages/API/FileSet.php
gui/baculum/protected/Pages/API/Job.php
gui/baculum/protected/Pages/API/Pool.php
gui/baculum/protected/Pages/API/Storage.php

index ae8fd24985f399139e95c7f5476766a91a8aa3ca..69b18e9f51a5fd33b28a3aacc67d12e1ebbf504f 100644 (file)
@@ -22,7 +22,8 @@ class Client extends BaculumAPI {
        public function get() {
                $clientid = intval($this->Request['id']);
                $client = $this->getModule('client')->getClientById($clientid);
-               if(!is_null($client)) {
+               $allowedClients = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.client'), $this->user)->output;
+               if(!is_null($client) && in_array($client->name, $allowedClients)) {
                        $this->output = $client;
                        $this->error = ClientError::ERROR_NO_ERRORS;
                } else {
index 792a34fb060517345dd6bf438a140fde9d2a4040..7c97888a61122953c23640ee8771e7deb1cec79e 100644 (file)
@@ -21,7 +21,8 @@ class FileSet extends BaculumAPI {
        public function get() {
                $filesetid = intval($this->Request['id']);
                $fileset = $this->getModule('fileset')->getFileSetById($filesetid);
-               if(!is_null($fileset)) {
+               $allowedFileSets = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.fileset'), $this->user)->output;
+               if(!is_null($fileset) && in_array($fileset->fileset, $allowedFileSets)) {
                        $this->output = $fileset;
                        $this->error = FileSetError::ERROR_NO_ERRORS;
                } else {
index 3aa7a18f9e7cea0a600848ee2189ccd2afe552c1..9ba247771b47a0205db47fef84d129c24b5ed1c5 100644 (file)
@@ -21,7 +21,8 @@ class Job extends BaculumAPI {
        public function get() {
                $jobid = intval($this->Request['id']);
                $job = $this->getModule('job')->getJobById($jobid);
-               if(!is_null($job)) {
+               $allowedJobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'), $this->user)->output;
+               if(!is_null($job) && in_array($job->name, $allowedJobs)) {
                        $this->output = $job;
                        $this->error = JobError::ERROR_NO_ERRORS;
                } else {
index bc0b6ab4e03d6152d34eb45639071e8d9d154bfa..e1f4828b03d53a14184e2d775eaf6f8991279456 100644 (file)
@@ -21,7 +21,8 @@ class Pool extends BaculumAPI {
        public function get() {
                $poolid = intval($this->Request['id']);
                $pool = $this->getModule('pool')->getPoolById($poolid);
-               if(!is_null($pool)) {
+               $allowedPools = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.pool'), $this->user)->output;
+               if(!is_null($pool) && in_array($pool->name, $allowedPools)) {
                        $this->output = $pool;
                        $this->error = PoolError::ERROR_NO_ERRORS;
                } else {
index 931b1c948166d31349234c0ce26924c4e85d1dc6..1ac065dac938f38afb39efbaa949ac4e79c74954 100644 (file)
@@ -21,7 +21,8 @@ class Storage extends BaculumAPI {
        public function get() {
                $storageid = intval($this->Request['id']);
                $storage = $this->getModule('storage')->getStorageById($storageid);
-               if(!is_null($storage)) {
+               $allowedStorages = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.storage'), $this->user)->output;
+               if(!is_null($storage) && in_array($storage->name, $allowedStorages)) {
                        $this->output = $storage;
                        $this->error =  StorageError::ERROR_NO_ERRORS;
                } else {