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:
@@ -756,7 +756,7 @@ CREATE TABLE IF NOT EXISTS tenant_api_keys (
|
||||
name TEXT NOT NULL,
|
||||
key_hash TEXT NOT NULL UNIQUE,
|
||||
api_key TEXT NOT NULL DEFAULT '',
|
||||
scopes TEXT NOT NULL DEFAULT '[]',
|
||||
role TEXT NOT NULL DEFAULT 'viewer',
|
||||
knowledge_base_ids TEXT NOT NULL DEFAULT '[]',
|
||||
last_used_at DATETIME,
|
||||
expires_at DATETIME,
|
||||
|
||||
Reference in New Issue
Block a user