fix: root user cannot demote itself now (close #30)

This commit is contained in:
JustSong
2023-04-27 14:45:12 +08:00
parent 4bcc5f54f2
commit 9667bc86bc

View File

@@ -559,6 +559,13 @@ func ManageUser(c *gin.Context) {
}
user.Role = common.RoleAdminUser
case "demote":
if user.Role == common.RoleRootUser {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "无法降级超级管理员用户",
})
return
}
user.Role = common.RoleCommonUser
}