]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/baculum/protected/API/Pages/API/PoolShow.php
baculum: API endpoints code refactor
[bacula/bacula] / gui / baculum / protected / API / Pages / API / PoolShow.php
index cdfc6bb9656eae5cafedd2917b371df9eaaa9854..ae3af1f836dbf2cf66e41281a933d8f82b1eade2 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
  
 class PoolShow extends BaculumAPIServer {
        public function get() {
-               $poolid = intval($this->Request['id']);
+               $poolid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
                $pool = $this->getModule('pool')->getPoolById($poolid);
-               if(!is_null($pool)) {
-                       $poolShow = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'pool="' . $pool->name . '"'), $this->user);
-                       $this->output = $poolShow->output;
-                       $this->error = (integer)$poolShow->exitcode;
+               if (is_object($pool)) {
+                       $result = $this->getModule('bconsole')->bconsoleCommand(
+                               $this->director,
+                               array('show', 'pool="' . $pool->name . '"')
+                       );
+                       $this->output = $result->output;
+                       $this->error = $result->exitcode;
                } else {
                        $this->output = PoolError::MSG_ERROR_POOL_DOES_NOT_EXISTS;
                        $this->error = PoolError::ERROR_POOL_DOES_NOT_EXISTS;
@@ -35,4 +38,4 @@ class PoolShow extends BaculumAPIServer {
        }
 }
 
-?>
\ No newline at end of file
+?>