From 9dda75efdbdde441b889d33a5e9363efa8bc2dc0 Mon Sep 17 00:00:00 2001 From: logan Date: Thu, 28 May 2026 14:30:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20LDAP=E5=AF=BC=E5=85=A5=E5=BC=B9=E6=A1=86?= =?UTF-8?q?OU=E5=88=97=E8=A1=A8=E5=92=8C=E7=94=A8=E6=88=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=A7=A3=E6=9E=90=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: 后端 ou-list/user-list API 直接返回数组, 前端错误地从 res.ous/res.users 取值 - loadLdapOus: Array.isArray(res) 兼容处理 - loadLdapUsers: Array.isArray(res) 兼容处理 - LDAP用户显示字段: cn/uid/mail 替代 nickname/username/email --- frontend/src/pages/UsersPage.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/UsersPage.tsx b/frontend/src/pages/UsersPage.tsx index e00330e..13cc73e 100644 --- a/frontend/src/pages/UsersPage.tsx +++ b/frontend/src/pages/UsersPage.tsx @@ -960,7 +960,7 @@ function BatchImportModal({ onClose, onImported }: { onClose: () => void; onImpo setLdapLoading(true); try { const res = await ldapApi.listOus() as any; - setLdapOus(res?.ous || []); + setLdapOus(Array.isArray(res) ? res : (res?.ous || res?.data || [])); } catch { toast('error', '加载 LDAP OU 失败'); } finally { setLdapLoading(false); } }; @@ -969,7 +969,7 @@ function BatchImportModal({ onClose, onImported }: { onClose: () => void; onImpo setLdapLoading(true); try { const res = await ldapApi.listUsers({ base_dn: baseDn }) as any; - setLdapUsers(res?.users || []); + setLdapUsers(Array.isArray(res) ? res : (res?.users || res?.data || [])); } catch { toast('error', '加载 LDAP 用户失败'); } finally { setLdapLoading(false); } }; @@ -1201,9 +1201,9 @@ function BatchImportModal({ onClose, onImported }: { onClose: () => void; onImpo {ldapUsers.map(u => ( ))}