From: Marcin Haba Date: Mon, 24 Apr 2023 07:57:59 +0000 (+0200) Subject: baculum: Add enabled flag filter to volumes endpoint X-Git-Tag: Release-13.0.3~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84a350518afad393a1c9c631f101dd8691bf9fdc;p=thirdparty%2Fbacula.git baculum: Add enabled flag filter to volumes endpoint --- diff --git a/gui/baculum/protected/API/Pages/API/Volumes.php b/gui/baculum/protected/API/Pages/API/Volumes.php index 4eb975965..e75628d85 100644 --- a/gui/baculum/protected/API/Pages/API/Volumes.php +++ b/gui/baculum/protected/API/Pages/API/Volumes.php @@ -36,14 +36,25 @@ class Volumes extends BaculumAPIServer { $limit = $this->Request->contains('limit') && $misc->isValidInteger($this->Request['limit']) ? (int)$this->Request['limit'] : 0; $offset = $this->Request->contains('offset') && $misc->isValidInteger($this->Request['offset']) ? (int)$this->Request['offset'] : 0; $voltype = $this->Request->contains('voltype') && $misc->isValidVolType($this->Request['voltype']) ? $this->Request['voltype'] : null; + $enabled = null; + if ($this->Request->contains('enabled') && $misc->isValidBoolean($this->Request['enabled'])) { + $enabled = $misc->isValidBooleanTrue($this->Request['enabled']) ? 1 : 0; + } + + $params = $props = []; - $props = []; if (is_string($voltype)) { $props['voltype'] = $voltype; } + if (is_int($enabled)) { + $params['Media.Enabled'][] = [ + 'vals' => $enabled, + ]; + } + $result = $this->getModule('volume')->getVolumes( - [], + $params, $props, $limit, $offset