Commit 9667bc86 by JustSong

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

parent 4bcc5f54
...@@ -559,6 +559,13 @@ func ManageUser(c *gin.Context) { ...@@ -559,6 +559,13 @@ func ManageUser(c *gin.Context) {
} }
user.Role = common.RoleAdminUser user.Role = common.RoleAdminUser
case "demote": case "demote":
if user.Role == common.RoleRootUser {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "无法降级超级管理员用户",
})
return
}
user.Role = common.RoleCommonUser user.Role = common.RoleCommonUser
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment