[pdm-devel] [PATCH datacenter-manager 3/6] ui: main: only render acl context when we are logged in
Shannon Sterz
s.sterz at proxmox.com
Thu Nov 27 16:36:06 CET 2025
otherwise it will only log errors about not being able to load the
current users acls. the request to load the acl tree could also end up
in a race with a login attempt. if the context loading with an invalid
ticket and a log in request end up running in parallel, a user will be
kicked out after logging in if the context is done loading after the
login request.
Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
ui/src/main.rs | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/ui/src/main.rs b/ui/src/main.rs
index 985220c..a06f569 100644
--- a/ui/src/main.rs
+++ b/ui/src/main.rs
@@ -7,6 +7,7 @@ use web_sys::HtmlElement;
//use pbs::utils::init_task_descr_table_pbs;
//use pbs_api_types::NodeStatus;
use yew::prelude::*;
+use yew::virtual_dom::VNode;
use pwt::prelude::*;
use pwt::props::TextRenderFn;
@@ -319,7 +320,7 @@ impl Component for DatacenterManagerApp {
});
let username = self.login_info.as_ref().map(|info| info.userid.to_owned());
- let body = Column::new()
+ let mut body: Html = Column::new()
.class("pwt-viewport")
.with_child(
TopNavBar::new(self.running_tasks.clone())
@@ -343,7 +344,12 @@ impl Component for DatacenterManagerApp {
};
main_view
})
- .with_optional_child(subscription_alert);
+ .with_optional_child(subscription_alert)
+ .into();
+
+ if self.login_info.is_some() && !loading {
+ body = html! { <AclContextProvider>{body}</AclContextProvider> };
+ }
let context = self.remote_list.clone();
let search_context = self.search_provider.clone();
@@ -352,11 +358,9 @@ impl Component for DatacenterManagerApp {
DesktopApp::new(html! {
<ContextProvider<SearchProvider> context={search_context}>
<ContextProvider<RemoteList> {context}>
- <AclContextProvider>
- <ContextProvider<ViewListContext> context={view_list_context}>
- {body}
- </ContextProvider<ViewListContext>>
- </AclContextProvider>
+ <ContextProvider<ViewListContext> context={view_list_context}>
+ {body}
+ </ContextProvider<ViewListContext>>
</ContextProvider<RemoteList>>
</ContextProvider<SearchProvider>>
})
--
2.47.3
More information about the pdm-devel
mailing list