[pbs-devel] [PATCH v5 proxmox-backup 06/31] api types: implement remote acl path method for sync job

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Oct 25 13:44:30 CEST 2024


On October 18, 2024 10:42 am, Christian Ebner wrote:
> 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 4:
> - no changes
> 
> changes since version 3:
> - not present in previous version
> 
>  pbs-api-types/src/jobs.rs | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/pbs-api-types/src/jobs.rs b/pbs-api-types/src/jobs.rs
> index 868702bc0..3971dd49f 100644
> --- a/pbs-api-types/src/jobs.rs
> +++ b/pbs-api-types/src/jobs.rs
> @@ -594,6 +594,19 @@ impl SyncJobConfig {
>              None => vec!["datastore", &self.store],
>          }
>      }
> +
> +    pub fn remote_acl_path(&self) -> Option<Vec<&str>> {
> +        let remote = self.remote.as_ref()?;
> +        let mut remote_acl_path = vec!["remote", remote, &self.remote_store];

this could/should use BackupNamespace::acl_path

> +
> +        if let Some(namespace) = self.remote_ns.as_ref() {
> +            if !namespace.is_root() {
> +                let comp: Vec<&str> = namespace.components().collect();
> +                remote_acl_path.extend(comp);
> +            }
> +        }
> +        Some(remote_acl_path)
> +    }
>  }
>  
>  #[api(
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 




More information about the pbs-devel mailing list