From d35e64f6a68fc245d03630c2fc098fb1bbf3ed74 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Mon, 28 Apr 2014 03:22:20 +0200 Subject: [PATCH] Filtred single results for restricted consoles --- gui/baculum/protected/Pages/API/Client.php | 3 ++- gui/baculum/protected/Pages/API/FileSet.php | 3 ++- gui/baculum/protected/Pages/API/Job.php | 3 ++- gui/baculum/protected/Pages/API/Pool.php | 3 ++- gui/baculum/protected/Pages/API/Storage.php | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gui/baculum/protected/Pages/API/Client.php b/gui/baculum/protected/Pages/API/Client.php index ae8fd24985..69b18e9f51 100644 --- a/gui/baculum/protected/Pages/API/Client.php +++ b/gui/baculum/protected/Pages/API/Client.php @@ -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 { diff --git a/gui/baculum/protected/Pages/API/FileSet.php b/gui/baculum/protected/Pages/API/FileSet.php index 792a34fb06..7c97888a61 100644 --- a/gui/baculum/protected/Pages/API/FileSet.php +++ b/gui/baculum/protected/Pages/API/FileSet.php @@ -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 { diff --git a/gui/baculum/protected/Pages/API/Job.php b/gui/baculum/protected/Pages/API/Job.php index 3aa7a18f9e..9ba247771b 100644 --- a/gui/baculum/protected/Pages/API/Job.php +++ b/gui/baculum/protected/Pages/API/Job.php @@ -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 { diff --git a/gui/baculum/protected/Pages/API/Pool.php b/gui/baculum/protected/Pages/API/Pool.php index bc0b6ab4e0..e1f4828b03 100644 --- a/gui/baculum/protected/Pages/API/Pool.php +++ b/gui/baculum/protected/Pages/API/Pool.php @@ -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 { diff --git a/gui/baculum/protected/Pages/API/Storage.php b/gui/baculum/protected/Pages/API/Storage.php index 931b1c9481..1ac065dac9 100644 --- a/gui/baculum/protected/Pages/API/Storage.php +++ b/gui/baculum/protected/Pages/API/Storage.php @@ -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 { -- 2.39.5