Skip to content

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

Update for audit (#21754)

Jin Hai6f571fda64cb
diff --git a/internal/common/model.go b/internal/common/model.go
index 8d9408db91..7cf4f7d627 100644
--- a/internal/common/model.go
+++ b/internal/common/model.go
@@ -54,6 +54,7 @@ func (m *ModelUsage) String() string {
type OperationLog struct {
EventTime time.Time `json:"event_time"`
UserID string `json:"user_id"`
+ UserName string `json:"user_name"`
IPAddress string `json:"ip_address"`
Operation string `json:"operation"`
APIPath string `json:"api_path"`
diff --git a/internal/handler/user.go b/internal/handler/user.go
index cdbc2df6aa..09bc2bbf7e 100644
--- a/internal/handler/user.go
+++ b/internal/handler/user.go
@@ -144,7 +144,7 @@ func (h *UserHandler) Login(c *gin.Context) {
operationLog.Error = err
return
}
- operationLog.ResourceName = req.Username
+ operationLog.UserName = req.Username
user, code, err := h.userService.Login(ctx, &req)
if err != nil {
@@ -214,7 +214,7 @@ func (h *UserHandler) LoginByEmail(c *gin.Context) {
operationLog.Error = err
return
}
- operationLog.ResourceName = req.Email
+ operationLog.UserName = req.Email
if !local.IsAdminAvailable() {
adminStatus := local.GetAdminStatus()
@@ -344,6 +344,7 @@ func (h *UserHandler) Logout(c *gin.Context) {
}
user := identity.User
operationLog.UserID = user.ID
+ operationLog.UserName = user.Email
// Logout user
code, err = h.userService.Logout(ctx, user)