From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 47F9A1FF137 for ; Tue, 31 Mar 2026 11:57:27 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9410C172D4; Tue, 31 Mar 2026 11:57:53 +0200 (CEST) From: Shan Shaji To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager 3/3] ui: acl: extend permission paths to allow specific remote access Date: Tue, 31 Mar 2026 11:57:30 +0200 Message-ID: <20260331095730.75329-4-s.shaji@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260331095730.75329-1-s.shaji@proxmox.com> References: <20260331095730.75329-1-s.shaji@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774951013315 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.135 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: P3YF3UECY6CQTQWZFDQJOPDK4Y6SPNMI X-Message-ID-Hash: P3YF3UECY6CQTQWZFDQJOPDK4Y6SPNMI X-MailFrom: s.shaji@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: previously, users were not able to assign permissions to specific remotes. Resolved this by listing the remote Ids and extending the permission paths to include specific remote paths. Signed-off-by: Shan Shaji --- .../configuration/permission_path_selector.rs | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/ui/src/configuration/permission_path_selector.rs b/ui/src/configuration/permission_path_selector.rs index 91d8072..ad99177 100644 --- a/ui/src/configuration/permission_path_selector.rs +++ b/ui/src/configuration/permission_path_selector.rs @@ -8,7 +8,7 @@ use pwt::{prelude::*, AsyncPool}; use pwt_macros::{builder, widget}; -use crate::pdm_client; +use crate::{pdm_client, RemoteList}; static PREDEFINED_PATHS: &[&str] = &[ "/", @@ -67,8 +67,18 @@ impl PdmPermissionPathSelector { Ok(paths) } - async fn get_paths() -> Result, Error> { - let paths = Self::get_view_paths().await?; + async fn get_paths(remote_list: Option) -> Result, Error> { + let mut paths = Self::get_view_paths().await?; + + if let Some(remotes) = remote_list { + let mut remote_paths = remotes + .0 + .iter() + .map(|remote| format!("/resource/{}", remote.id)) + .collect(); + paths.append(&mut remote_paths); + } + Ok(paths) } } @@ -83,10 +93,14 @@ impl Component for PdmPermissionPathSelector { .map(|i| AttrValue::from(*i)) .collect(); - let link = ctx.link().clone(); + let result = ctx.link().context(Callback::from(|_: RemoteList| {})); + let remote_list = result.map(|(remote_list, _)| remote_list); + let async_pool = AsyncPool::new(); + let link = ctx.link().clone(); + async_pool.spawn(async move { - let paths = Self::get_paths().await; + let paths = Self::get_paths(remote_list).await; match paths { Ok(paths) => link.send_message(Msg::Prefetched(paths)), Err(_) => link.send_message(Msg::PrefetchFailed), -- 2.47.3