bcbb94500d
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
4.0 KiB
4.0 KiB
status
| status |
|---|
| complete |
Quick Task 260707-csw: LDAP AD Anbindung — Zugangsdaten aus XWiki vorbefuellen und Import-Filter fuer Benutzer/Gruppen
What shipped
- AD connection prefill —
admin/ldappage now defaults a brand-new config form to the CTL Active Directory values extracted fromuser-files/xwiki.cfg(serverbalios.ctl.local:3268, base DNdc=ctl,dc=local, AD person search filter, down-level bind-DN hint). Password stays blank. Editing an existing config still shows its real saved values (unchanged behavior). - Selective group/OU import filter — new
groupFilterDns String[]column onLdapConfig(additive migration, empty array = current "import everyone" behavior).GET /ldap/groupsdiscovers AD groups/OUs under the base DN; admin can select from the discovered list or add DNs manually; selection persists viaPATCH /ldap/configand is editable any time post-setup.syncUsersForTenantnow restricts its directory search to members of selected groups (via escapedmemberOfclauses) or users under selected OUs (extra search bases), for both manual sync and the scheduled cron sync. - Bugfix caught during manual testing (not in original plan):
CreateLdapConfigDto's optional fields (searchFilter,syncIntervalMin,isActive,groupFilterDns) had TS class-field default initializers. NestJS'sValidationPipeapplies those defaults viaplainToInstanceeven when the field is absent from the request body, so any partial PATCH silently reset the other fields to hardcoded defaults. Caught live: saving the group filter alone resetsearchFilterback to(objectClass=person), clobbering the AD-specific filter. Fixed by removing the initializers — the service layer's own?? defaultfallback already covers create-time defaults. - Pre-existing i18n gap fixed (user-approved scope addition): the
admin.ldapmessage block referenced by the page (t('title'),t('connectionTitle'),t('serverUrl'), etc.) did not exist inde.json/en.jsonat all, so the whole page rendered raw translation keys instead of text. Backfilled the full set of keys the page actually uses, in addition to the new group-filter keys.
Verification performed
prisma validate,prisma generate, APItype-check, APIbuild— all green.- Web
type-checkgreen; both message JSON files parse. - Migration applied live via container restart (
Applying migration 20260707090000_add_ldap_group_filter), confirmed idempotent entrypoint (prisma migrate deploy). - End-to-end manual test via Playwright against the running dev stack:
- Fresh
/admin/ldappage load shows AD-prefilled connection form, password blank. - Created a config (test bind DN/password — dev environment, no live AD reachable from this sandbox), confirmed default field mappings (
displayName,mail,sAMAccountName) are AD-correct. - Added a group DN manually, saved the filter, reloaded the page — filter persisted.
- Verified via direct DB query (
SELECT ... FROM "LdapConfig") thatgroupFilterDnspersisted correctly and, after the DTO fix, thatsearchFilter/syncIntervalMin/isActiveare no longer clobbered by a groupFilterDns-only PATCH.
- Fresh
Known limitations / follow-ups for the user
- Not tested against a live AD server —
balios.ctl.localis not reachable from this environment.GET /ldap/groupsdiscovery and thememberOf-filtered sync are implemented per the plan's design and pass all static checks, but have not been exercised against real Active Directory data. Recommend testingtestConnection,Gruppen/OUs suchen, and a real sync once this is deployed somewhere with network access to the CTL AD. - The dev database now has one
LdapConfigtest row (server/base DN are the real CTL AD values; bind DN/password are placeholdersctl\testservice/testpassword) with one filter DN saved. Replace the bind credentials with the real service-account before relying on this in a real environment. - The i18n backfill only covers keys this page actually calls — it does not audit the rest of the app for similar gaps.