Introduces full multi-tenant organization model to AgentIdP: Schema: - 6 migrations: organizations + organization_members tables; organization_id FK added to agents, credentials, audit_logs; PostgreSQL RLS policies on all three tables; system org seed + backfill API: - 6 new /api/v1/organizations endpoints (CRUD + members) gated by admin:orgs scope - OPA scopes.json updated with 6 new org endpoint → admin:orgs mappings Implementation: - OrgRepository, OrgService, OrgController, createOrgsRouter - OrgContextMiddleware: sets app.organization_id session variable so RLS enforces per-request org isolation at the database layer - JWT payload extended with organization_id claim; auth.ts backfills org_system for backward-compatible tokens - New error classes: OrgNotFoundError, OrgHasActiveAgentsError, AlreadyMemberError Tests: 373 passing, 80.64% branch coverage, zero any types Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
1.4 KiB
JSON
24 lines
1.4 KiB
JSON
{
|
|
"endpoint_permissions": {
|
|
"GET:/api/v1/agents": ["agents:read"],
|
|
"GET:/api/v1/agents/:id": ["agents:read"],
|
|
"POST:/api/v1/agents": ["agents:write"],
|
|
"PATCH:/api/v1/agents/:id": ["agents:write"],
|
|
"DELETE:/api/v1/agents/:id": ["agents:write"],
|
|
"GET:/api/v1/agents/:id/credentials": ["agents:read"],
|
|
"POST:/api/v1/agents/:id/credentials": ["agents:write"],
|
|
"POST:/api/v1/agents/:id/credentials/:credId/rotate": ["agents:write"],
|
|
"DELETE:/api/v1/agents/:id/credentials/:credId": ["agents:write"],
|
|
"POST:/api/v1/token/introspect": ["tokens:read"],
|
|
"POST:/api/v1/token/revoke": ["tokens:read"],
|
|
"GET:/api/v1/audit": ["audit:read"],
|
|
"GET:/api/v1/audit/:id": ["audit:read"],
|
|
"POST:/api/v1/organizations": ["admin:orgs"],
|
|
"GET:/api/v1/organizations": ["admin:orgs"],
|
|
"GET:/api/v1/organizations/:id": ["admin:orgs"],
|
|
"PATCH:/api/v1/organizations/:id": ["admin:orgs"],
|
|
"DELETE:/api/v1/organizations/:id": ["admin:orgs"],
|
|
"POST:/api/v1/organizations/:id/members": ["admin:orgs"]
|
|
}
|
|
}
|