* [yew-devel] [PATCH yew-comp] auth edit ldap: fix updating a realm to use anonymous search
@ 2025-12-09 14:03 Shannon Sterz
0 siblings, 0 replies; only message in thread
From: Shannon Sterz @ 2025-12-09 14:03 UTC (permalink / raw)
To: yew-devel
previously this didn't work as the fields were still presnent in the
submitted data.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
this came up when looking into anonymous search with ad realms [1]. note
that it's not clear what the issue in question there ist. for now it
still looks like a configuration issue that might involve that
"automagic" nature of how our Rust-based AD support determines the
base-dn.
[1]: https://forum.proxmox.com/threads/pdm-1-0-1-unable-to-add-ad-realm-with-anonymous-search.177766/
src/auth_edit_ldap.rs | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/auth_edit_ldap.rs b/src/auth_edit_ldap.rs
index 5a2a906..eb8b98b 100644
--- a/src/auth_edit_ldap.rs
+++ b/src/auth_edit_ldap.rs
@@ -160,7 +160,7 @@ async fn update_item(form_ctx: FormContext, base_url: String) -> Result<(), Erro
let data = format_sync_and_default_options(&mut data);
- let data = delete_empty_values(
+ let mut data = delete_empty_values(
&data,
&[
"server2",
@@ -176,6 +176,26 @@ async fn update_item(form_ctx: FormContext, base_url: String) -> Result<(), Erro
true,
);
+ let anonymous_search = form_ctx
+ .read()
+ .get_field_value("anonymous_search")
+ .and_then(|v| v.as_bool())
+ .unwrap_or(false);
+
+ if anonymous_search {
+ if let Some(data) = data.as_object_mut() {
+ data.remove("bind-dn");
+ data.remove("password");
+ }
+
+ if let Some(vec) = data["delete"].as_array_mut() {
+ vec.push("bind-dn".into());
+ vec.push("password".into());
+ } else {
+ data["delete"] = ["bind-dn", "password"].into();
+ }
+ }
+
let name = form_ctx.read().get_field_text("realm");
let url = format!("{base_url}/{}", percent_encode_component(&name));
--
2.47.3
_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-09 14:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-09 14:03 [yew-devel] [PATCH yew-comp] auth edit ldap: fix updating a realm to use anonymous search Shannon Sterz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.