mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-31 13:03:49 +08:00
Go: add audit log framework (#17129)
### Summary Prepare for audit log --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -1968,3 +1968,29 @@ func (h *Handler) GetTokenStatsSummary(c *gin.Context) {
|
||||
|
||||
common.SuccessWithData(c, stats, "success")
|
||||
}
|
||||
|
||||
func (h *Handler) ListLogs(c *gin.Context) {
|
||||
userName := c.Query("user_name")
|
||||
if userName == "" {
|
||||
common.ErrorWithCode(c, common.CodeBadRequest, "User name is required")
|
||||
return
|
||||
}
|
||||
days := c.Query("days")
|
||||
if days == "" {
|
||||
days = "7"
|
||||
}
|
||||
daysInt, err := strconv.Atoi(days)
|
||||
if err != nil {
|
||||
common.ErrorWithCode(c, common.CodeBadRequest, "Invalid days")
|
||||
return
|
||||
}
|
||||
|
||||
stats, err := h.service.ListLogs(userName, daysInt)
|
||||
if err != nil {
|
||||
common.ErrorWithCode(c, common.CodeDataError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
common.SuccessWithData(c, stats, "success")
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user