From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 44F859333E for ; Wed, 4 Jan 2023 11:23:10 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2DCD81D250 for ; Wed, 4 Jan 2023 11:23:10 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 4 Jan 2023 11:23:09 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2BDC844D0F for ; Wed, 4 Jan 2023 11:23:09 +0100 (CET) Date: Wed, 4 Jan 2023 11:23:08 +0100 From: Wolfgang Bumiller To: Lukas Wagner Cc: pbs-devel@lists.proxmox.com Message-ID: <20230104102308.xqusrvng5xw6frwl@casey.proxmox.com> References: <20230103142308.656240-1-l.wagner@proxmox.com> <20230103142308.656240-2-l.wagner@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230103142308.656240-2-l.wagner@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.219 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH proxmox-backup 01/17] pbs-config: add delete_authid to ACL-tree X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2023 10:23:10 -0000 On Tue, Jan 03, 2023 at 03:22:52PM +0100, Lukas Wagner wrote: > From: Hannes Laimer > > ... 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 > --- > 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 {