[pbs-devel] [PATCH v5 proxmox-backup 06/31] api types: implement remote acl path method for sync job
Christian Ebner
c.ebner at proxmox.com
Fri Oct 25 14:46:13 CEST 2024
On 10/25/24 13:44, Fabian Grünbichler wrote:
> 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
`BackupNamespace::acl_path` would however add the additional `datastore`
component?
So instead of the pre-existing `/remote/{remote}/{store}` schema for
remote datastore acls, this would create a
`/remote/{remote}/datastore/{store}` for e.g. the root namespace, not
being backwards compatible.
Therefore I did not use the pre-existing helper. Or did you intend for
the helper to be adapted accordingly, by e.g. passing an optional remote?
>> +
>> + 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
>>
>>
>>
>
>
> _______________________________________________
> 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