all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [yew-devel] [PATCH yew-comp] auth edit ldap: fix updating a realm to use anonymous search
@ 2025-12-09 14:03 Shannon Sterz
  2025-12-16 16:57 ` [yew-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread

* [yew-devel] applied: [PATCH yew-comp] auth edit ldap: fix updating a realm to use anonymous search
  2025-12-09 14:03 [yew-devel] [PATCH yew-comp] auth edit ldap: fix updating a realm to use anonymous search Shannon Sterz
@ 2025-12-16 16:57 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-12-16 16:57 UTC (permalink / raw)
  To: yew-devel, Shannon Sterz

On Tue, 09 Dec 2025 15:03:17 +0100, Shannon Sterz wrote:
> previously this didn't work as the fields were still presnent in the
> submitted data.
> 
> 

Applied, thanks!

[1/1] auth edit ldap: fix updating a realm to use anonymous search
      commit: cdd0ecab01c04e3c057f0e83fe1ea5ce6e1332b7


_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-16 16:57 UTC | newest]

Thread overview: 2+ messages (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
2025-12-16 16:57 ` [yew-devel] applied: " Thomas Lamprecht

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal