fix(users): visitor user can not be deleted

This commit is contained in:
hexxa 2022-01-12 15:58:10 +08:00 committed by Hexxa
parent 563e90b3a4
commit 963f5b199a

View file

@ -460,8 +460,8 @@ func (h *MultiUsersSvc) DelUser(c *gin.Context) {
if err != nil { if err != nil {
c.JSON(q.ErrResp(c, 400, fmt.Errorf("invalid users ID %w", err))) c.JSON(q.ErrResp(c, 400, fmt.Errorf("invalid users ID %w", err)))
return return
} else if userID == 0 { } else if userID == 0 || userID == 1 { // 0=root, 1=visitor
c.JSON(q.ErrResp(c, 400, errors.New("It is not allowed to delete root"))) c.JSON(q.ErrResp(c, 400, errors.New("It is not allowed to delete predefined users")))
return return
} }