feat(api):share & fix(api):gateway;idletime

This commit is contained in:
ttk
2024-09-12 09:58:22 +08:00
parent dfd22e3314
commit de9129703a
41 changed files with 1140 additions and 1396 deletions

View File

@@ -81,6 +81,16 @@ func auth() gin.HandlerFunc {
}
}
func authAdmin() gin.HandlerFunc {
return func(ctx *gin.Context) {
currentUser, _ := acl.GetSessionFromCtx(ctx)
if !acl.IsAdmin(currentUser) {
ctx.AbortWithStatus(http.StatusUnauthorized)
return
}
}
}
type bodyWriter struct {
gin.ResponseWriter
body *bytes.Buffer