[pbs-devel] [PATCH proxmox-backup 01/17] pbs-config: add delete_authid to ACL-tree

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Jan 4 11:23:08 CET 2023


On Tue, Jan 03, 2023 at 03:22:52PM +0100, Lukas Wagner wrote:
> From: Hannes Laimer <h.laimer at proxmox.com>
> 
> ... allows the deletion of an authid from the whole tree. Needed
> for removing deleted users/tokens.

And you probably want a way to include all tokens for a user.

> 
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> ---
>  pbs-config/src/acl.rs | 71 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 71 insertions(+)
> 
> diff --git a/pbs-config/src/acl.rs b/pbs-config/src/acl.rs
> index 89a54dfc..a4a79755 100644
> --- a/pbs-config/src/acl.rs
> +++ b/pbs-config/src/acl.rs
> @@ -280,6 +280,13 @@ impl AclTreeNode {
>          roles.remove(role);
>      }
>  
> +    fn delete_authid(&mut self, auth_id: &Authid) {
> +        for (_name, node) in self.children.iter_mut() {

^ This can use `values_mut()`.

> +            node.delete_authid(auth_id);
> +        }
> +        self.users.remove(auth_id);
> +    }
> +
>      fn insert_group_role(&mut self, group: String, role: String, propagate: bool) {
>          let map = self.groups.entry(group).or_default();
>          if role == ROLE_NAME_NO_ACCESS {





More information about the pbs-devel mailing list