feat(api-keys): enhance manage_kbs capability for KB lifecycle management

Update the manage_kbs capability to cover the full lifecycle of knowledge bases, including create, copy, duplicate, update, and delete operations. Adjust related API routes and tests to ensure proper access control and policy requirements for knowledge base management.
This commit is contained in:
wizardchen
2026-07-15 10:50:41 +08:00
committed by lyingbug
parent b3bb60f03c
commit 97490ef7ed
3 changed files with 27 additions and 4 deletions
+3 -2
View File
@@ -258,8 +258,9 @@ func apiKeyIngest(base middleware.APIKeyRoutePolicy) middleware.APIKeyRoutePolic
}
// apiKeyManageKnowledgeBases layers the "manage_kbs" capability on top of a
// base policy so a scoped key can manage existing KB metadata/config within
// its KB allow-list.
// base policy so a scoped key can manage the KB lifecycle (create/copy/
// duplicate/update/delete + config). Existing-KB operations stay bounded by
// the key's allow-list downstream; create has no source to bound.
func apiKeyManageKnowledgeBases(base middleware.APIKeyRoutePolicy) middleware.APIKeyRoutePolicy {
return base.WithCapability(types.APIKeyCapabilityManageKnowledgeBases)
}