mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-29 00:14:35 +08:00
fixed bugs around user update & user delete false error with no nets
This commit is contained in:
parent
f336a81f01
commit
8584699944
1 changed files with 7 additions and 2 deletions
|
@ -283,7 +283,8 @@ func UpdateUser(userchange models.User, user models.User) (models.User, error) {
|
|||
|
||||
user.Password = userchange.Password
|
||||
}
|
||||
if userchange.IsAdmin != user.IsAdmin {
|
||||
|
||||
if (userchange.IsAdmin != user.IsAdmin) && !user.IsAdmin {
|
||||
user.IsAdmin = userchange.IsAdmin
|
||||
}
|
||||
|
||||
|
@ -340,7 +341,11 @@ func DeleteUser(user string) (bool, error) {
|
|||
// == pro - remove user from all network user instances ==
|
||||
currentNets, err := GetNetworks()
|
||||
if err != nil {
|
||||
return true, err
|
||||
if database.IsEmptyRecord(err) {
|
||||
currentNets = []models.Network{}
|
||||
} else {
|
||||
return true, err
|
||||
}
|
||||
}
|
||||
|
||||
for i := range currentNets {
|
||||
|
|
Loading…
Add table
Reference in a new issue