Browse Source

fix: delete check

Tao Chen 1 year ago
parent
commit
f17d891302
1 changed files with 1 additions and 1 deletions
  1. 1 1
      service/user.go

+ 1 - 1
service/user.go

@@ -185,7 +185,7 @@ func (us *UserService) Logout(u *model.User, token string) error {
185 185
 // Delete 删除用户和oauth信息
186 186
 func (us *UserService) Delete(u *model.User) error {
187 187
 	userCount := us.getAdminUserCount()
188
-	if userCount <= 1 {
188
+	if userCount <= 1 && us.IsAdmin(u) {
189 189
 		return errors.New("The last admin user cannot be deleted")
190 190
 	}
191 191
 	tx := global.DB.Begin()