mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-12-03 18:43:15 +00:00
fix: delete check
This commit is contained in:
@@ -185,7 +185,7 @@ func (us *UserService) Logout(u *model.User, token string) error {
|
||||
// Delete 删除用户和oauth信息
|
||||
func (us *UserService) Delete(u *model.User) error {
|
||||
userCount := us.getAdminUserCount()
|
||||
if userCount <= 1 {
|
||||
if userCount <= 1 && us.IsAdmin(u) {
|
||||
return errors.New("The last admin user cannot be deleted")
|
||||
}
|
||||
tx := global.DB.Begin()
|
||||
|
||||
Reference in New Issue
Block a user