mirror of
https://github.com/veops/oneterm.git
synced 2025-10-10 09:40:07 +08:00
feat(api):share & fix(api):gateway;idletime
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user