加固后台管理安全
This commit is contained in:
@@ -61,8 +61,17 @@ func (h *Handler) Get(c *gin.Context) {
|
||||
}
|
||||
|
||||
includeSecret := c.Query("include_secret") == "true"
|
||||
var actorID uint64
|
||||
if includeSecret {
|
||||
var ok bool
|
||||
actorID, ok = currentAdminID(c)
|
||||
if !ok {
|
||||
response.Unauthorized(c, "未授权")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
config, err := h.service.Get(c.Request.Context(), id, includeSecret)
|
||||
config, err := h.service.Get(c.Request.Context(), id, includeSecret, actorID, auditMeta(c))
|
||||
if err == ErrConfigNotFound {
|
||||
response.NotFound(c, "配置不存在")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user