Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: super admin should not login to normal page (#21405)

Wang Qifca5fdf7a804
diff --git a/internal/handler/user.go b/internal/handler/user.go
index 2204818b33..21de728bc0 100644
--- a/internal/handler/user.go
+++ b/internal/handler/user.go
@@ -255,6 +255,13 @@ func (h *UserHandler) LoginByEmail(c *gin.Context) {
}
operationLog.UserID = user.ID
+ if user.IsSuperuser != nil && *user.IsSuperuser {
+ common.ResponseWithCodeData(c, common.CodeForbidden, false, "super admin should not login to this page.")
+ operationLog.ErrorCode = uint16(common.CodeForbidden)
+ operationLog.Message = "super admin should not login to this page."
+ return
+ }
+
secretKey, err := server.GetSecretKey(ctx, kvrocks.Get())
if err != nil {
errorMessage := fmt.Sprintf("Failed to get secret key: %s", err.Error())