You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ui): bulk + single disable (AD-gated), adminCount-based Privileged
Three wins from the simple-ldap-go v1.12.0 bump:
1. adminCount-based Privileged detection
adminUserDNs no longer maintains a hardcoded English CN allowlist
("admins", "domain admins", …). It now reads the AD-native
User.AdminCount field set by simple-ldap-go v1.12 from the
adminCount=1 attribute AD applies via adminSDHolder to every
protected-group member (Domain Admins, Enterprise Admins,
Administrators, Account Operators, Backup Operators, Server
Operators, Print Operators, Replicator, Schema Admins, Key Admins,
Enterprise Key Admins, Read-Only Domain Controllers, Domain
Controllers). Benefits:
- Catches localised AD directories (Domänen-Admins etc.) the CN
list used to miss.
- No transitive walk needed — AD already bakes the flag in.
- Limitation documented inline on the function: adminCount is
sticky (AD doesn't clear it when a user leaves a protected
group), so a true value means "is OR was privileged", not a
perfect real-time check.
2. Bulk disable for users and computers
Replaces the 501 stubs on /users/bulk?action=disable and
/computers/bulk?action=disable with real AD UAC writes. Backed
by simple-ldap-go v1.12 DisableUserContext / DisableComputerContext
which flip the ACCOUNTDISABLE bit (0x2) via read-modify-write,
preserving every other UAC flag on the entry.
- bulkDisableUsers / bulkDisableComputers dispatch through a shared
bulkUACDisable helper (kind, redirectTo, op func) — same shape
as bulkDeleteByDN, same flash semantics.
- finaliseBulkDisable emits "Disabled N ..." success /
"Failed to disable any of N ..." error /
"Disabled N / M ..." partial flashes. Cache + template cache
refreshed on any success, like bulk delete.
3. AD-gating everywhere
Handler side (bulk_handlers.go): each disable dispatch checks
a.ldapConfig.IsActiveDirectory. Non-AD deployments still hit the
bulkNotImplemented path with the same 501 + message they used
to; the contract doesn't regress.
Template side (users_v2.templ + computers_v2.templ): the Disable
button only renders when vm.IsAD is true. New IsAD field on both
UserDrawerVM and ComputerDrawerVM, populated in their build*VM
functions from a.ldapConfig.IsActiveDirectory.
Tests:
- Unit: TestBulkHandler_Users_DisableDispatchesOnAD and the computers
equivalent exercise the AD gate by flipping
app.ldapConfig.IsActiveDirectory=true and asserting NOT 501, NOT 400.
The pre-existing non-AD stub tests renamed to ..._StubbedOnNonAD
with docstrings that explain the gate behaviour.
- Existing bulk_handlers_test.go + full e2e suite remain green
(71.5 s).
Dep: github.com/netresearch/simple-ldap-go v1.11.0 → v1.12.0.
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
0 commit comments