]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add to Bvfs lsdirs and lsfiles API endpoints pathid parameter
authorMarcin Haba <marcin.haba@bacula.pl>
Thu, 28 Jan 2021 06:33:25 +0000 (07:33 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:24 +0000 (09:03 +0100)
gui/baculum/protected/API/Pages/API/BVFSLsDirs.php
gui/baculum/protected/API/Pages/API/BVFSLsFiles.php
gui/baculum/protected/API/openapi_baculum.json

index 28d44f160f6d130c67f0529325eb8ada116e8ac9..04684470addf043b991284faabadd83a92dc2caa 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -36,7 +36,8 @@ class BVFSLsDirs extends ConsoleOutputPage {
                $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
                $offset = $this->Request->contains('offset') ? intval($this->Request['offset']) : 0;
                $jobids = $this->Request->contains('jobids') && $misc->isValidIdsList($this->Request['jobids']) ? $this->Request['jobids'] : null;
-               $path = $this->Request->contains('path') && $misc->isValidPath($this->Request['path']) ? $this->Request['path'] : null;
+               $path = $this->Request->contains('path') && $misc->isValidPath($this->Request['path']) ? $this->Request['path'] : '';
+               $pathid = $this->Request->contains('pathid') ? intval($this->Request['pathid']) : null;
                $out_format = $this->Request->contains('output') && $this->isOutputFormatValid($this->Request['output']) ? $this->Request['output'] : parent::OUTPUT_FORMAT_RAW;
 
                if (is_null($jobids)) {
@@ -54,6 +55,7 @@ class BVFSLsDirs extends ConsoleOutputPage {
                $params = [
                        'jobids' => $jobids,
                        'path' => $path,
+                       'pathid' => $pathid,
                        'offset' => $offset,
                        'limit' => $limit
                ];
@@ -77,10 +79,15 @@ class BVFSLsDirs extends ConsoleOutputPage {
        protected function getRawOutput($params = []) {
                $cmd = [
                        '.bvfs_lsdirs',
-                       'jobid="' . $params['jobids'] . '"',
-                       'path="' . $params['path'] . '"'
+                       'jobid="' . $params['jobids'] . '"'
                ];
 
+               if ($params['pathid']) {
+                       array_push($cmd, 'pathid="' .  $params['pathid'] . '"');
+               } else {
+                       array_push($cmd, 'path="' .  $params['path'] . '"');
+               }
+
                if ($params['offset'] > 0) {
                        array_push($cmd, 'offset="' .  $params['offset'] . '"');
                }
index 9f67c6d968744d45f527767cc5a31a4778703e4d..743e650b121543141ac1983c08e15fba2f953402 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -39,7 +39,8 @@ class BVFSLsFiles extends ConsoleOutputPage {
                $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
                $offset = $this->Request->contains('offset') ? intval($this->Request['offset']) : 0;
                $jobids = $this->Request->contains('jobids') && $misc->isValidIdsList($this->Request['jobids']) ? $this->Request['jobids'] : null;
-               $path = $this->Request->contains('path') && $misc->isValidPath($this->Request['path']) ? $this->Request['path'] : null;
+               $path = $this->Request->contains('path') && $misc->isValidPath($this->Request['path']) ? $this->Request['path'] : '';
+               $pathid = $this->Request->contains('pathid') ? intval($this->Request['pathid']) : null;
                $out_format = $this->Request->contains('output') && $this->isOutputFormatValid($this->Request['output']) ? $this->Request['output'] : parent::OUTPUT_FORMAT_RAW;
 
                if (is_null($jobids)) {
@@ -57,6 +58,7 @@ class BVFSLsFiles extends ConsoleOutputPage {
                $params = [
                        'jobids' => $jobids,
                        'path' => $path,
+                       'pathid' => $pathid,
                        'offset' => $offset,
                        'limit' => $limit
                ];
@@ -80,10 +82,15 @@ class BVFSLsFiles extends ConsoleOutputPage {
        protected function getRawOutput($params = []) {
                $cmd = [
                        '.bvfs_lsfiles',
-                       'jobid="' . $params['jobids'] . '"',
-                       'path="' . $params['path'] . '"'
+                       'jobid="' . $params['jobids'] . '"'
                ];
 
+               if ($params['pathid']) {
+                       array_push($cmd, 'pathid="' .  $params['pathid'] . '"');
+               } else {
+                       array_push($cmd, 'path="' .  $params['path'] . '"');
+               }
+
                if ($params['offset'] > 0) {
                        array_push($cmd, 'offset="' .  $params['offset'] . '"');
                }
index 64bdd83971e72dbd3c422b75df21224fcb1cbc14..1c981320e72a393676536c686c3e1eb0c57da093 100644 (file)
                                        {
                                                "name": "path",
                                                "in": "query",
-                                               "description": "Path to list",
+                                               "description": "Path to list (used instead of pathid parameter)",
                                                "required": true,
                                                "schema": {
                                                        "type": "string"
                                                }
                                        },
+                                       {
+                                               "name": "pathid",
+                                               "in": "query",
+                                               "description": "Path identifier to list path (used instead of path parameter)",
+                                               "required": true,
+                                               "schema": {
+                                                       "type": "integer"
+                                               }
+                                       },
                                        {
                                                "name": "offset",
                                                "in": "query",
                                        {
                                                "name": "path",
                                                "in": "query",
-                                               "description": "Path to list",
+                                               "description": "Path to list (used instead of pathid parameter)",
                                                "required": true,
                                                "schema": {
                                                        "type": "string"
                                                }
                                        },
+                                       {
+                                               "name": "pathid",
+                                               "in": "query",
+                                               "description": "Path identifier to list path (used instead of path parameter)",
+                                               "required": true,
+                                               "schema": {
+                                                       "type": "integer"
+                                               }
+                                       },
                                        {
                                                "name": "offset",
                                                "in": "query",