feat(ldap): LDAP 改为只读接入,移除账号验证测试与批量导入写操作
按需求调整 settings 页 LDAP 区域:
1. 移除「测试账号验证」按钮
- LdapConfigForm.tsx 删除按钮 + onOpenAccountTest prop
- LdapConfigPage.tsx 不再渲染 LdapAccountTestDialog
2. 移除批量导入的 LDAP 写操作
- BatchImportModal.tsx 的 TABS 去掉「导入到 LDAP」「从 LDAP 导入」
- 只保留「本地导入」(CSV 建本地账号,不触碰 LDAP 目录)
3. 移除 LDAP 账号管理面板(危险写操作)
- 不再渲染 LdapManagePanel(新建 OU / 添加用户 / 删除用户)
- 不再渲染 LdapCreateOuDialog / LdapAddUserDialog
- 面板含「此操作不可逆」删除功能,与只读接入原则冲突
4. 保留(只读用途)
- LDAP 配置表单(服务器/绑定/搜索/属性映射)
- 「测试连接」按钮(验证配置是否可用,不写 LDAP)
设计原则:本系统 LDAP 仅用于域账号登录认证(只读 bind + search),
目录维护请在域控侧操作。
验证(前端 bundle 实测):
测试账号验证: 0 导入到 LDAP: 0 从 LDAP 导入: 0
新建 OU: 0 危险操作: 0 此操作不可逆: 0
测试连接: 6(保留) 本地导入: 1(保留)
/health → {"backend":"go","status":"ok","version":"0.4.0"}
http://sql.astx.club/settings → HTTP 200
This commit is contained in:
1 parent
d584b64813
commit
e8355e5d5f
3 files changed
+9
-27
No files matched your search
@@ -212,14 +212,9 @@ export function BatchImportModal({ onClose, onImported }: BatchImportModalProps)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// LDAP 未配置时隐藏 LDAP 相关 Tab(本地 CSV 始终可用)
|
// LDAP 未配置时隐藏 LDAP 相关 Tab(本地 CSV 始终可用)
|
||||||
|
// LDAP 仅作只读接入:不再提供「导入到 LDAP」「从 LDAP 导入」
|
||||||
const TABS = [
|
const TABS = [
|
||||||
{ key: 'local' as const, label: '本地导入', icon: Upload },
|
{ key: 'local' as const, label: '本地导入', icon: Upload },
|
||||||
...(ldapEnabled
|
|
||||||
? [
|
|
||||||
{ key: 'to-ldap' as const, label: '导入到 LDAP', icon: Server },
|
|
||||||
{ key: 'from-ldap' as const, label: '从 LDAP 导入', icon: UsersIcon },
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ interface LdapConfigFormProps {
|
|||||||
onConfigChange: Dispatch<SetStateAction<LdapConfigData>>;
|
onConfigChange: Dispatch<SetStateAction<LdapConfigData>>;
|
||||||
onTestServer: () => void;
|
onTestServer: () => void;
|
||||||
onSave: () => void;
|
onSave: () => void;
|
||||||
onOpenAccountTest: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function LdapConfigForm({
|
export function LdapConfigForm({
|
||||||
@@ -28,7 +27,6 @@ export function LdapConfigForm({
|
|||||||
onConfigChange,
|
onConfigChange,
|
||||||
onTestServer,
|
onTestServer,
|
||||||
onSave,
|
onSave,
|
||||||
onOpenAccountTest,
|
|
||||||
}: LdapConfigFormProps) {
|
}: LdapConfigFormProps) {
|
||||||
/* ── helpers ── */
|
/* ── helpers ── */
|
||||||
const updateField = <K extends keyof LdapConfigData>(key: K, value: LdapConfigData[K]) => {
|
const updateField = <K extends keyof LdapConfigData>(key: K, value: LdapConfigData[K]) => {
|
||||||
@@ -183,14 +181,6 @@ export function LdapConfigForm({
|
|||||||
{testResult.msg}
|
{testResult.msg}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{config.ldap_host && config.base_dn && (
|
|
||||||
<button
|
|
||||||
onClick={onOpenAccountTest}
|
|
||||||
className="flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors"
|
|
||||||
>
|
|
||||||
测试账号验证
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -337,16 +337,13 @@ export default function LdapConfigPage() {
|
|||||||
onConfigChange={setConfig}
|
onConfigChange={setConfig}
|
||||||
onTestServer={handleTestServer}
|
onTestServer={handleTestServer}
|
||||||
onSave={handleSave}
|
onSave={handleSave}
|
||||||
onOpenAccountTest={() => setShowAccountTest(true)}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* ── LDAP 账号管理(未保存配置前隐藏,保存后出现) ── */}
|
{/* ── LDAP 账号管理已移除 ──
|
||||||
{!loading && !configured && (
|
本系统 LDAP 仅作「只读接入」:仅用于域账号登录认证,
|
||||||
<div className="px-4 py-3 rounded-lg border border-dashed border-[var(--dg-border)] text-xs text-[var(--dg-text-muted)]">
|
不再提供新建 OU / 添加用户 / 删除用户 / 批量导入到 LDAP 等写操作。
|
||||||
LDAP 未启用:保存基础连接配置后,这里会出现 LDAP 账号管理与用户导入入口
|
如需维护 LDAP 目录,请在域控侧操作。 */}
|
||||||
</div>
|
{false && (
|
||||||
)}
|
|
||||||
{configured && (
|
|
||||||
<LdapManagePanel
|
<LdapManagePanel
|
||||||
expanded={showManage}
|
expanded={showManage}
|
||||||
onToggle={toggleManage}
|
onToggle={toggleManage}
|
||||||
@@ -368,7 +365,7 @@ export default function LdapConfigPage() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* ── 创建 OU 弹框 ── */}
|
{/* ── 创建 OU 弹框 ── */}
|
||||||
{showCreateOu && (
|
{false && (
|
||||||
<LdapCreateOuDialog
|
<LdapCreateOuDialog
|
||||||
form={createOuForm}
|
form={createOuForm}
|
||||||
onFormChange={patchCreateOuForm}
|
onFormChange={patchCreateOuForm}
|
||||||
@@ -381,7 +378,7 @@ export default function LdapConfigPage() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* ── 添加用户弹框 ── */}
|
{/* ── 添加用户弹框 ── */}
|
||||||
{showAddUser && (
|
{false && (
|
||||||
<LdapAddUserDialog
|
<LdapAddUserDialog
|
||||||
form={addUserForm}
|
form={addUserForm}
|
||||||
onFormChange={patchAddUserForm}
|
onFormChange={patchAddUserForm}
|
||||||
@@ -394,7 +391,7 @@ export default function LdapConfigPage() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* ── 账号测试弹框 ── */}
|
{/* ── 账号测试弹框 ── */}
|
||||||
{showAccountTest && (
|
{false && (
|
||||||
<LdapAccountTestDialog
|
<LdapAccountTestDialog
|
||||||
testUser={testUser}
|
testUser={testUser}
|
||||||
testPass={testPass}
|
testPass={testPass}
|
||||||
|
|||||||
Reference in new issue
Block a user