The portal's Settings/Users page showed design fixtures because the
registry had no membership surface. Two endpoints close that:
- GET /v1/tenants/{id}/members lists the Keycloak organization members
(user id, email, name, org_roles, enabled). A tenant without an
organization answers an empty list, not an error.
- POST /v1/tenants/{id}/invites creates the user if needed, adds the org
member (KC 26: bare user id body), writes the tenant-context
attributes, sends the execute-actions mail and audits user.invited.
Idempotent: an existing member answers 200 with status=member.
User tokens are confined to their own tenant (cross-tenant is a 404) and
need IT_ADMIN or OWNER to invite; service clients are gated per route
group as before. Principal gains the org_roles claim for that check.
Tenants carry admin_email (migration 0006, backfilled from the invite
audit trail) so Settings can show a real contact instead of an em dash.
The members route is registered as GET /v1/tenants/{id}/{sub}: ServeMux
rejects /v1/tenants/{id}/members as conflicting with the by-slug lookup,
because both match /v1/tenants/by-slug/members and neither pattern is
more specific.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB