Fix: Root user should always have admin permission

This commit is contained in:
HFO4 2020-03-11 19:56:20 +08:00
parent 9a56c3c1af
commit 210af8f9e1
2 changed files with 2 additions and 2 deletions

2
assets

@ -1 +1 @@
Subproject commit 220a080a1b8ace8718188420c02d914d8cd2f074
Subproject commit 186f0aac0964c95ed4826894ddf888e32e00d46b

View file

@ -315,7 +315,7 @@ func COSCallbackAuth() gin.HandlerFunc {
func IsAdmin() gin.HandlerFunc {
return func(c *gin.Context) {
user, _ := c.Get("user")
if user.(*model.User).Group.ID != 1 {
if user.(*model.User).Group.ID != 1 && user.(*model.User).ID != 1 {
c.JSON(200, serializer.Err(serializer.CodeAdminRequired, "您不是管理组成员", nil))
c.Abort()
return