From: Marcin Haba Date: Tue, 19 Dec 2023 09:38:44 +0000 (+0100) Subject: Add content parameter to filesets endpoint X-Git-Tag: Beta-15.0.1~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a916321a601a98c7ff121d93a75e66cde728194;p=thirdparty%2Fbacula.git Add content parameter to filesets endpoint --- diff --git a/gui/baculum/protected/API/Pages/API/FileSets.php b/gui/baculum/protected/API/Pages/API/FileSets.php index 55cc9c079..ffe5a3e28 100644 --- a/gui/baculum/protected/API/Pages/API/FileSets.php +++ b/gui/baculum/protected/API/Pages/API/FileSets.php @@ -34,6 +34,7 @@ class FileSets extends BaculumAPIServer { public function get() { $misc = $this->getModule('misc'); + $content = $this->Request->contains('content') && $misc->isValidName($this->Request['content']) ? $this->Request['content'] : ''; $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; $result = $this->getModule('bconsole')->bconsoleCommand( @@ -56,6 +57,13 @@ class FileSets extends BaculumAPIServer { 'vals' => $vals ]; + if (!empty($content)) { + $params['FileSet.Content'][] = [ + 'operator' => 'LIKE', + 'vals' => '%' . $content . '%' + ]; + } + $filesets = $this->getModule('fileset')->getFileSets($params, $limit, $offset); $this->output = $filesets; $this->error = FileSetError::ERROR_NO_ERRORS; diff --git a/gui/baculum/protected/API/openapi_baculum.json b/gui/baculum/protected/API/openapi_baculum.json index 4c19179e8..69541a70f 100644 --- a/gui/baculum/protected/API/openapi_baculum.json +++ b/gui/baculum/protected/API/openapi_baculum.json @@ -982,7 +982,7 @@ "name": "enabled", "in": "query", "required": false, - "description": "Enabled clients filter. It does not work with 'name' parameter.", + "description": "Enabled clients filter. It has meaning only if 'output=json'. It is ignored if 'name' parameter is used.", "schema": { "type": "integer" } @@ -5552,6 +5552,16 @@ }, { "$ref": "#/components/parameters/Offset" + }, + { + "name": "content", + "in": "query", + "description": "Content property value. There is possible to provide whole content value or only a part", + "required": false, + "schema": { + "type": "string", + "pattern": "[a-zA-Z0-9:.-_ ]+" + } } ] }