mirror of
https://github.com/HChaZZY/alist.git
synced 2025-12-22 10:06:28 +08:00
feat: meta manage api
This commit is contained in:
@@ -2,6 +2,7 @@ package middlewares
|
||||
|
||||
import (
|
||||
"github.com/alist-org/alist/v3/internal/db"
|
||||
"github.com/alist-org/alist/v3/internal/model"
|
||||
"github.com/alist-org/alist/v3/internal/server/common"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -36,3 +37,13 @@ func Auth(c *gin.Context) {
|
||||
c.Set("user", user)
|
||||
c.Next()
|
||||
}
|
||||
|
||||
func AuthAdmin(c *gin.Context) {
|
||||
user := c.MustGet("user").(*model.User)
|
||||
if !user.IsAdmin() {
|
||||
common.ErrorStrResp(c, "You are not an admin", 403)
|
||||
c.Abort()
|
||||
} else {
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user