mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-14 07:05:47 +00:00
api types: add remote acl path method for BackupNamespace
Add a `remote_acl_path` helper method for creating acl paths for remote namespaces, to be used by the priv checks on remote datastore namespaces for e.g. the sync job in push direction. Factor out the common path extension into a dedicated method. Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
7bffb9fe92
commit
48809ab0db
@ -722,9 +722,7 @@ impl BackupNamespace {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn acl_path<'a>(&'a self, store: &'a str) -> Vec<&'a str> {
|
||||
let mut path: Vec<&str> = vec!["datastore", store];
|
||||
|
||||
fn acl_path_extend<'a>(&'a self, mut path: Vec<&'a str>) -> Vec<&'a str> {
|
||||
if self.is_root() {
|
||||
path
|
||||
} else {
|
||||
@ -733,6 +731,14 @@ impl BackupNamespace {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn acl_path<'a>(&'a self, store: &'a str) -> Vec<&'a str> {
|
||||
self.acl_path_extend(vec!["datastore", store])
|
||||
}
|
||||
|
||||
pub fn remote_acl_path<'a>(&'a self, remote: &'a str, store: &'a str) -> Vec<&'a str> {
|
||||
self.acl_path_extend(vec!["remote", remote, store])
|
||||
}
|
||||
|
||||
/// Check whether this namespace contains another namespace.
|
||||
///
|
||||
/// If so, the depth is returned.
|
||||
|
Loading…
Reference in New Issue
Block a user