feat: add scoped tenant api keys

This commit is contained in:
wizardchen
2026-07-05 10:25:37 +08:00
committed by lyingbug
parent 1708d6895a
commit 505bc7ddec
49 changed files with 2899 additions and 1578 deletions
+5
View File
@@ -241,6 +241,11 @@ func RequireKBAccess(
}
ctx := c.Request.Context()
if err := authorizeTenantAPIKeyKnowledgeBase(ctx, kbID); err != nil {
_ = c.Error(apperrors.NewForbiddenError("API key scope does not allow this knowledge base"))
c.Abort()
return
}
// Rollout window: enforcement off -> log the would-be check and
// pass through. We still resolve the KB (best-effort) so the