#552: admin grant source through the API, honest revoke affordance (v0.6.205) #558
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-552a"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the silent no-op found in the mockup audit: on a directory account whose admin role comes from the admin group, Remove admin was offered, wrote a revocation to
admins.json, and changed nothing — the group kept granting it.Root cause (traced before fixing):
adminNames()flattened four grant sources — config allow-list, dashboard grant, local flag, IdP group — intomap[string]bool, so the grant source was discarded at the API boundary and neither the page nor the endpoint could tell a revocable grant from one the directory owns. Fixing the button alone would have been a symptom fix.Fix, both halves (the house pattern the last-admin guard already uses — server refuses and client disables):
AccessAdmin.Source(group/config/local/grant) from a singleadminSources()lookup;adminNames()stays as a thin wrapper so existing callers and tests are untouched. A person holding several sources keeps the strongest, since that's what decides whether revoking here would do anything.directoryAdminSetrefuses such a revocation with 409 naming the owner. An unreadable directory proves nothing, so it doesn't block.TDD: three tests written first and watched fail — source empty, and the revoke returning 200 where 409 was required (the bug, reproduced). The third pins that dashboard grants stay revocable, guarding against over-reach. All green, full suite green, fence gate + node checks clean. i18n ×4.