From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id AC3D01FF141 for ; Fri, 13 Feb 2026 14:19:20 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1280E38D6; Fri, 13 Feb 2026 14:20:08 +0100 (CET) Content-Type: text/plain; charset=UTF-8 Date: Fri, 13 Feb 2026 14:20:01 +0100 Message-Id: To: "Shan Shaji" , Subject: Re: [PATCH datacenter-manager v3 1/6] server: pbs-client: add delete admin token method From: "Lukas Wagner" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260211152016.445817-1-s.shaji@proxmox.com> <20260211152016.445817-2-s.shaji@proxmox.com> In-Reply-To: <20260211152016.445817-2-s.shaji@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1770988798360 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.037 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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 Message-ID-Hash: 4Y5SSIRTUEA4PZRJNJFZV6RJFFNBUOPH X-Message-ID-Hash: 4Y5SSIRTUEA4PZRJNJFZV6RJFFNBUOPH X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi Shan, thanks for the patch! On Wed Feb 11, 2026 at 4:20 PM CET, Shan Shaji wrote: > Inorder to allow deleting the generated token of PBS from PDM, add > method inside the PbsClient to delete the admin token. > > Signed-off-by: Shan Shaji > --- > > changes since v2: No changes > changes since v1: > - Revert the dropping of '/' from the comment. > - Remove unnecessary colon. > =20 > server/src/pbs_client.rs | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/server/src/pbs_client.rs b/server/src/pbs_client.rs > index f4f1f82..31befdd 100644 > --- a/server/src/pbs_client.rs > +++ b/server/src/pbs_client.rs > @@ -260,6 +260,13 @@ impl PbsClient { > Ok(token) > } > =20 > + /// Delete API-Token from the PBS remote. tiny nit: I'd spell it 'API token' > + pub async fn delete_admin_token(&self, userid: &Userid, tokenid: &st= r) -> Result<(), Error> { This function should take &TokenameRef, I think. After all, it's what you have at the callsite before you you turn it into a &str. Also, I think the function should just be called `delete_token`, since nothing of it is specific to the token being an admin token (it can delete *any* token, not just an admin one). That being said, I understand why you named it this way, it's the symmetry with `create_admin_token`. The difference is that `create_admin_token` does indeed create a new token *and* also assigns admin permissions to it. > + let path =3D format!("/api2/extjs/access/users/{userid}/token/{t= okenid}"); Technically, the userid parameter should be percent-encoded - the @ sign in "root@pam" would usually be reserved to separate credentials and the host in a URL, see [1]. Apparently its not an issue with the `create_admin_token` function so far, but still a good practice, even if we don't really have issues with it now. [1] https://docs.mapp.com/docs/url-encoding-and-what-characters-are-valid-i= n-a-uri > + self.0.delete(&path).await?.nodata()?; > + Ok(()) > + } > + > /// Return the status the Proxmox Backup Server instance > pub async fn node_status(&self) -> Result { > let path =3D "/api2/extjs/nodes/localhost/status";