From: Shannon Sterz <s.sterz@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [yew-devel] [PATCH yew-comp] auth edit ldap: fix updating a realm to use anonymous search
Date: Tue, 9 Dec 2025 15:03:17 +0100 [thread overview]
Message-ID: <20251209140317.233159-1-s.sterz@proxmox.com> (raw)
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
reply other threads:[~2025-12-09 14:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251209140317.233159-1-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=yew-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 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.