加固后台管理安全

This commit is contained in:
yml2213
2026-06-11 07:23:00 +08:00
parent 5255b21141
commit 88b1df64e7
41 changed files with 1276 additions and 293 deletions
@@ -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