public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shan Shaji <s.shaji@proxmox.com>
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	[thread overview]
Message-ID: <20260331095730.75329-4-s.shaji@proxmox.com> (raw)
In-Reply-To: <20260331095730.75329-1-s.shaji@proxmox.com>

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 <s.shaji@proxmox.com>
---
 .../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<Vec<String>, Error> {
-        let paths = Self::get_view_paths().await?;
+    async fn get_paths(remote_list: Option<RemoteList>) -> Result<Vec<String>, 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





  parent reply	other threads:[~2026-03-31  9:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31  9:57 [PATCH datacenter-manager 0/3] ui: acl: pre-populate permission path selector Shan Shaji
2026-03-31  9:57 ` [PATCH datacenter-manager 1/3] pdm-client: add `list_views` function to fetch views list Shan Shaji
2026-03-31  9:57 ` [PATCH datacenter-manager 2/3] ui: acl: list granular level permission paths for views Shan Shaji
2026-03-31  9:57 ` Shan Shaji [this message]
2026-03-31 10:06 ` [PATCH datacenter-manager 0/3] ui: acl: pre-populate permission path selector Shannon Sterz
2026-04-01  8:16 ` applied: " Lukas Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260331095730.75329-4-s.shaji@proxmox.com \
    --to=s.shaji@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal