mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-04 23:45:07 +00:00
fix: use correct check for user existing on import (#8907)
# Which Problems Are Solved - ImportHuman was not checking for a `UserStateDeleted` state on import, resulting in "already existing" errors when attempting to delete and re-import a user with the same id # How the Problems Are Solved Use the `Exists` helper method to check for both `UserStateUnspecified` and `UserStateDeleted` states on import # Additional Changes N/A # Additional Context N/A Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
374b9a7f66
commit
7ba797b872
@ -448,7 +448,7 @@ func (c *Commands) ImportHuman(ctx context.Context, orgID string, human *domain.
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if existing.UserState != domain.UserStateUnspecified {
|
if existing.UserState.Exists() {
|
||||||
return nil, nil, zerrors.ThrowPreconditionFailed(nil, "COMMAND-ziuna", "Errors.User.AlreadyExisting")
|
return nil, nil, zerrors.ThrowPreconditionFailed(nil, "COMMAND-ziuna", "Errors.User.AlreadyExisting")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user