mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-05 07:10:29 +08:00
Service list and minio status (#13480)
### What problem does this PR solve? 1. Resolve standard user can access admin service 2. Get RAGFlow service status 3. Fix minio status fetching ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality) --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -644,7 +644,10 @@ func (h *Handler) GetUserPermission(c *gin.Context) {
|
||||
func (h *Handler) GetServices(c *gin.Context) {
|
||||
services, err := h.service.GetAllServices()
|
||||
if err != nil {
|
||||
errorResponse(c, err.Error(), 500)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"code": common.CodeServerError,
|
||||
"message": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -932,6 +935,14 @@ func (h *Handler) AuthMiddleware() gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
if !*user.IsSuperuser {
|
||||
c.JSON(http.StatusForbidden, gin.H{
|
||||
"code": common.CodeForbidden,
|
||||
"message": "Permission denied",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
c.Set("user", user)
|
||||
c.Set("user_id", user.ID)
|
||||
c.Set("email", user.Email)
|
||||
|
||||
Reference in New Issue
Block a user