feat: LDAP-Test zeigt klickbare Filter-Vorschläge (UCS/AD-Erkennung)
Nach erfolgreichem Verbindungstest werden passende Filter-Vorschläge angezeigt. Erkennt automatisch Univention UCS (posixAccount) vs. Active Directory (sAMAccountName). Klick übernimmt den Filter direkt ins Formular. Vorschläge berücksichtigen mailPrimaryAddress (UCS). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { type LDAPConfig, type LDAPTestResult } from "@/lib/api";
|
||||
import { type LDAPConfig, type LDAPTestResult, type LDAPFilterSuggestion } from "@/lib/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
@@ -303,6 +303,27 @@ export function LDAPTab({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{ldapTestResult.ok && ldapTestResult.filter_suggestions?.length > 0 && (
|
||||
<div className="space-y-2 pt-1">
|
||||
<p className="text-xs font-medium text-muted-foreground">Filter-Vorschläge — klicken zum Übernehmen:</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{ldapTestResult.filter_suggestions.map((s: LDAPFilterSuggestion, i: number) => (
|
||||
<button
|
||||
key={i}
|
||||
type="button"
|
||||
title={s.description}
|
||||
onClick={() => setLdapForm((f) => ({ ...f, user_filter: s.filter }))}
|
||||
className="inline-flex items-center px-2 py-1 rounded text-xs border border-border bg-muted hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer font-mono"
|
||||
>
|
||||
{s.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
<span className="font-mono">%s</span> wird beim Login durch den Benutzernamen ersetzt
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { type TenantLDAPConfig, type LDAPTestResult } from "@/lib/api";
|
||||
import { type TenantLDAPConfig, type LDAPTestResult, type LDAPFilterSuggestion } from "@/lib/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
@@ -314,6 +314,27 @@ export function TenantLDAPTab({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{tenantLdapTestResult.ok && tenantLdapTestResult.filter_suggestions?.length > 0 && (
|
||||
<div className="space-y-2 pt-1">
|
||||
<p className="text-xs font-medium text-muted-foreground">Filter-Vorschläge — klicken zum Übernehmen:</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{tenantLdapTestResult.filter_suggestions.map((s: LDAPFilterSuggestion, i: number) => (
|
||||
<button
|
||||
key={i}
|
||||
type="button"
|
||||
title={s.description}
|
||||
onClick={() => setTenantLdapForm((f) => ({ ...f, user_filter: s.filter }))}
|
||||
className="inline-flex items-center px-2 py-1 rounded text-xs border border-border bg-muted hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer font-mono"
|
||||
>
|
||||
{s.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
<span className="font-mono">%s</span> wird beim Login durch den Benutzernamen ersetzt
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
@@ -30,6 +30,7 @@ export type {
|
||||
LDAPConfig,
|
||||
LDAPTestUser,
|
||||
LDAPTestResult,
|
||||
LDAPFilterSuggestion,
|
||||
} from "./ldap";
|
||||
export {
|
||||
getLDAPConfig,
|
||||
|
||||
@@ -30,6 +30,12 @@ export interface LDAPTestUser {
|
||||
mail: string;
|
||||
}
|
||||
|
||||
export interface LDAPFilterSuggestion {
|
||||
label: string;
|
||||
filter: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface LDAPTestResult {
|
||||
ok: boolean;
|
||||
message: string;
|
||||
@@ -37,6 +43,8 @@ export interface LDAPTestResult {
|
||||
server_info: string;
|
||||
users_found: number;
|
||||
users: LDAPTestUser[];
|
||||
object_classes: string[];
|
||||
filter_suggestions: LDAPFilterSuggestion[];
|
||||
error_detail: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user