refactor(api-keys): use role field and route-level API key guards
Replace scopes JSON with a viewer/contributor/admin role column, move unsafe-method authorization from path-prefix middleware to declarative APIKey* guards on routes, and close remaining KB-scope gaps in handlers.
This commit is contained in:
@@ -183,7 +183,7 @@ func TestCloneContextPreservesTenantAPIKeyScope(t *testing.T) {
|
||||
|
||||
want := types.TenantAPIKeyScope{
|
||||
KeyID: 7,
|
||||
Scopes: types.StringArray{types.TenantAPIKeyScopeRead},
|
||||
Role: types.TenantRoleViewer,
|
||||
KnowledgeBaseIDs: types.StringArray{"kb-1"},
|
||||
}
|
||||
ctx := types.WithTenantAPIKeyScope(context.Background(), want)
|
||||
|
||||
Reference in New Issue
Block a user