[pbs-devel] [PATCH v6 proxmox-backup 07/29] api types: implement remote acl path method for sync job

Christian Ebner c.ebner at proxmox.com
Thu Oct 31 13:14:57 CET 2024


Add `remote_acl_path` method which generates the acl path from the sync
job configuration. This helper allows to easily generate the acl path
from a given sync job config for privilege checks.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 5:
- use BackupNamespace::remote_acl_path helper

 pbs-api-types/src/jobs.rs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/pbs-api-types/src/jobs.rs b/pbs-api-types/src/jobs.rs
index 868702bc0..bf7a6bd5a 100644
--- a/pbs-api-types/src/jobs.rs
+++ b/pbs-api-types/src/jobs.rs
@@ -594,6 +594,14 @@ impl SyncJobConfig {
             None => vec!["datastore", &self.store],
         }
     }
+
+    pub fn remote_acl_path(&self) -> Option<Vec<&str>> {
+        let remote = self.remote.as_ref()?;
+        match &self.remote_ns {
+            Some(remote_ns) => Some(remote_ns.remote_acl_path(remote, &self.remote_store)),
+            None => Some(vec!["remote", remote, &self.remote_store]),
+        }
+    }
 }
 
 #[api(
-- 
2.39.5





More information about the pbs-devel mailing list