Plan 3 (#1303) fixed several Org mutating routes (POST /organizations,
/join, /join-request, /join-by-id, /:id/leave, /:id/request-upgrade)
to Admin+ in the caller's tenant, and e1deb810 followed up by gating
DELETE /:id/members/:tenant_id symmetric with /:id/leave.
The remaining Org-admin surfaces still relied solely on a
service-layer "is the caller's tenant admin in this org?" check, with
no route-layer floor. Add g.Admin() to:
- PUT /organizations/:id (update org)
- DELETE /organizations/:id (delete org)
- POST /organizations/:id/invite-code (rotate code)
- GET /organizations/:id/search-users (member picker)
- POST /organizations/:id/invite (direct invite)
- PUT /organizations/:id/members/:tenant_id (change role)
- GET /organizations/:id/join-requests (review queue)
- PUT /organizations/:id/join-requests/:request_id/review
Each of these takes an action that is visible to the whole org or to
another tenant; per the RBAC matrix in router/rbac.go they belong on
Admin+. The service-layer check stays as the authority on org-level
membership; the route guard prevents a tenant Viewer/Contributor from
ever reaching the service in the first place.
Behaviour is unchanged when cfg.Tenant.EnableRBAC is false: RequireRole
continues to log the would-be rejection and let the request through.