Demonstration plan, phase D1 (registry side). The portal's Settings/Users page renders design fixtures today and its "Invite member" button posts to a route that does not exist, because the registry had no membership surface.
GET /v1/tenants/{id}/members lists the tenant's Keycloak organization members — user id, email, first/last name, org_roles, enabled, created_at. A tenant whose organization was never created (sales-led) answers an empty list rather than an error.
POST /v1/tenants/{id}/invites{email, first_name?, last_name?, role?} creates the Keycloak user if missing, adds the organization member (KC 26: the member body is the bare user id), writes the tenant-context user attributes, sends the same execute-actions mail the first admin gets, and audits user.invited with the caller as actor. Idempotent: an existing member answers 200 {status:"member"} and sends no mail; a new one 202 {status:"invited"}.
Scope. A user token may only touch its own tenant — another tenant's id is a 404, never a hint that it exists. Inviting needs the IT_ADMIN or OWNER org role, so Principal now carries the org_roles claim and IsTenantAdmin(). Service clients stay gated by AUTHZ_RULES route groups: members on tenants.read, invites on tenants.write.
admin_email on the tenant (migration 0006, backfilled from the keycloak.invite_sent audit trail, and from keycloak.provision_failed metadata where the first invite failed) so Settings can show a real contact instead of an em dash. The first IT_ADMIN/OWNER invite fills it in when it was empty.
Routing note worth keeping:GET /v1/tenants/{id}/members cannot be registered — Go's ServeMux calls it a conflict with GET /v1/tenants/by-slug/{slug}, since both match /v1/tenants/by-slug/members and neither pattern is more specific. It is registered as GET /v1/tenants/{id}/{sub} instead, which is less specific than the by-slug lookup, so the two coexist; anything but members answers 404.
openapi.yaml documents both endpoints, the OrgMember/Invite schemas, admin_email and a Forbidden response.
Verified locally: go vet ./..., gofmt clean, go test ./... green, CI coverage command at 74.3% (gate 70%).
Demonstration plan, phase D1 (registry side). The portal's Settings/Users page renders design fixtures today and its "Invite member" button posts to a route that does not exist, because the registry had no membership surface.
**`GET /v1/tenants/{id}/members`** lists the tenant's Keycloak organization members — user id, email, first/last name, `org_roles`, `enabled`, `created_at`. A tenant whose organization was never created (sales-led) answers an empty list rather than an error.
**`POST /v1/tenants/{id}/invites`** `{email, first_name?, last_name?, role?}` creates the Keycloak user if missing, adds the organization member (KC 26: the member body is the bare user id), writes the tenant-context user attributes, sends the same execute-actions mail the first admin gets, and audits `user.invited` with the caller as actor. Idempotent: an existing member answers `200 {status:"member"}` and sends no mail; a new one `202 {status:"invited"}`.
**Scope.** A user token may only touch its own tenant — another tenant's id is a 404, never a hint that it exists. Inviting needs the `IT_ADMIN` or `OWNER` org role, so `Principal` now carries the `org_roles` claim and `IsTenantAdmin()`. Service clients stay gated by `AUTHZ_RULES` route groups: members on `tenants.read`, invites on `tenants.write`.
**`admin_email` on the tenant** (migration `0006`, backfilled from the `keycloak.invite_sent` audit trail, and from `keycloak.provision_failed` metadata where the first invite failed) so Settings can show a real contact instead of an em dash. The first `IT_ADMIN`/`OWNER` invite fills it in when it was empty.
**Routing note worth keeping:** `GET /v1/tenants/{id}/members` cannot be registered — Go's ServeMux calls it a conflict with `GET /v1/tenants/by-slug/{slug}`, since both match `/v1/tenants/by-slug/members` and neither pattern is more specific. It is registered as `GET /v1/tenants/{id}/{sub}` instead, which *is* less specific than the by-slug lookup, so the two coexist; anything but `members` answers 404.
`openapi.yaml` documents both endpoints, the `OrgMember`/`Invite` schemas, `admin_email` and a `Forbidden` response.
Verified locally: `go vet ./...`, `gofmt` clean, `go test ./...` green, CI coverage command at **74.3%** (gate 70%).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Demonstration plan, phase D1 (registry side). The portal's Settings/Users page renders design fixtures today and its "Invite member" button posts to a route that does not exist, because the registry had no membership surface.
GET /v1/tenants/{id}/memberslists the tenant's Keycloak organization members — user id, email, first/last name,org_roles,enabled,created_at. A tenant whose organization was never created (sales-led) answers an empty list rather than an error.POST /v1/tenants/{id}/invites{email, first_name?, last_name?, role?}creates the Keycloak user if missing, adds the organization member (KC 26: the member body is the bare user id), writes the tenant-context user attributes, sends the same execute-actions mail the first admin gets, and auditsuser.invitedwith the caller as actor. Idempotent: an existing member answers200 {status:"member"}and sends no mail; a new one202 {status:"invited"}.Scope. A user token may only touch its own tenant — another tenant's id is a 404, never a hint that it exists. Inviting needs the
IT_ADMINorOWNERorg role, soPrincipalnow carries theorg_rolesclaim andIsTenantAdmin(). Service clients stay gated byAUTHZ_RULESroute groups: members ontenants.read, invites ontenants.write.admin_emailon the tenant (migration0006, backfilled from thekeycloak.invite_sentaudit trail, and fromkeycloak.provision_failedmetadata where the first invite failed) so Settings can show a real contact instead of an em dash. The firstIT_ADMIN/OWNERinvite fills it in when it was empty.Routing note worth keeping:
GET /v1/tenants/{id}/memberscannot be registered — Go's ServeMux calls it a conflict withGET /v1/tenants/by-slug/{slug}, since both match/v1/tenants/by-slug/membersand neither pattern is more specific. It is registered asGET /v1/tenants/{id}/{sub}instead, which is less specific than the by-slug lookup, so the two coexist; anything butmembersanswers 404.openapi.yamldocuments both endpoints, theOrgMember/Inviteschemas,admin_emailand aForbiddenresponse.Verified locally:
go vet ./...,gofmtclean,go test ./...green, CI coverage command at 74.3% (gate 70%).🤖 Generated with Claude Code
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
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