tests(db): add additional tests & comments
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-06-16 20:00:41 -04:00
parent 9809a09d2e
commit 3a633235ea
5 changed files with 383 additions and 134 deletions

View File

@@ -869,10 +869,10 @@ func (api *API) updateUser(user string, rawPassword *string, isAdmin *bool) erro
updateParams.Admin = user.Admin
}
// Check Admins
// Check Admins - Disallow Demotion
if isLast, err := api.isLastAdmin(user); err != nil {
return err
} else if isLast {
} else if isLast && !updateParams.Admin {
return fmt.Errorf("unable to demote %s - last admin", user)
}