]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Add content parameter to filesets endpoint
authorMarcin Haba <marcin.haba@bacula.pl>
Tue, 19 Dec 2023 09:38:44 +0000 (10:38 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Thu, 18 Jan 2024 09:22:37 +0000 (10:22 +0100)
gui/baculum/protected/API/Pages/API/FileSets.php
gui/baculum/protected/API/openapi_baculum.json

index 55cc9c0791934cea42f6aba40a28de50e4c7c813..ffe5a3e286c8733a6ef2e6e8757fa5b955ab7eac 100644 (file)
@@ -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;
index 4c19179e8f038b1d8d3a623f7fac16210cd959e4..69541a70f5f0e006ecddec55dec882e3a4601142 100644 (file)
                                                "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"
                                                }
                                        },
                                        {
                                                "$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:.-_ ]+"
+                                               }
                                        }
                                ]
                        }