refactor: Update tenant ID handling across the application

This commit is contained in:
wizardchen
2025-11-25 16:30:54 +08:00
parent 9f6f5f5773
commit 64c44c9e27
78 changed files with 437 additions and 601 deletions
+3 -3
View File
@@ -58,7 +58,7 @@ func (h *ChunkHandler) GetChunkByIDOnly(c *gin.Context) {
}
// Validate tenant ID
if chunk.TenantID != tenantID.(uint) {
if chunk.TenantID != tenantID.(uint64) {
logger.Warnf(
ctx,
"Tenant has no permission to access chunk, chunk ID: %s, req tenant: %d, chunk tenant: %d",
@@ -184,11 +184,11 @@ func (h *ChunkHandler) validateAndGetChunk(c *gin.Context) (*types.Chunk, string
}
// Validate tenant ID
if chunk.TenantID != tenantID.(uint) || chunk.KnowledgeID != knowledgeID {
if chunk.TenantID != tenantID.(uint64) || chunk.KnowledgeID != knowledgeID {
logger.Warnf(
ctx,
"Tenant has no permission to access chunk, knowledge ID: %s, chunk ID: %s, req tenant: %d, chunk tenant: %d",
knowledgeID, id, tenantID.(uint), chunk.TenantID,
knowledgeID, id, tenantID, chunk.TenantID,
)
return nil, knowledgeID, errors.NewForbiddenError("No permission to access this chunk")
}