Self-service spaces: create + member management brokered to the IdP (#94) #98
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/self-service-spaces"
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?
Implements #94 (route A, greenlit 2026-08-03). Cairn is the UI; Keycloak stays the single source of truth.
Server
internal/spaces: Keycloak Admin API broker —Create(write group<name>+ read-only group<name>-ro(#64) + owner recorded as group attributecairnSpaceOwner+ creator joined as write member),Members,SetMember(role switch joins target group, leaves the other — never both),RemoveMember(both groups). Client-credentials token cache, same service-account client key custody uses.internal/api/spaces.go:POST /api/v1/spaces(any authenticated user),GET/POST /api/v1/spaces/{name}/members,DELETE .../members/{user}— member management owner-or-admin only; owner can never be demoted/removed. Name validation rejects the-rosuffix, hidden names, path separators. Audit events:space-create,space-member-set,space-member-remove.main.gogated on the Keycloak encryption config; the backend/spaces/<name>dir is created via the unscoped stack at creation, which also fixes the admin-visibility gap found in dogfood (admins see the raw backend, and the boot probe no longer 404s once a space exists).UI
Tests:
internal/spacesfake-Keycloak suite (create + groups + owner attr + creator join, duplicate → conflict, role switch no-dupe, removal, unknown user/space). Full repo suite green; JS syntax checked.