create_user: Remove assert about needing prereg_user if realm_creation.

Closes #22274.

This assertion was added in 4b903c5dcd
where it may have made sense, because indeed when doing realm creation
there was always a PreregistrationUser (created because realms were
created via going to a generated realm creation link). With the addition
of the create_realm command that's no longer the case.

It would be unnatural to create a PreregistrationUser in the
realm_creation command, because there is no confirmation link for it to
be tied to - and it just doesn't make sense conceptually.

The intended, correct behavior added in
4b903c5dcd is still maintained - the code
lower down correctly handles the
(prereg_user is None and realm_creation) case.
This commit is contained in:
Mateusz Mandera 2022-07-18 11:12:07 +02:00 committed by Tim Abbott
parent 7ae3708c02
commit 6b451ce6f0
1 changed files with 0 additions and 2 deletions

View File

@ -237,8 +237,6 @@ def process_new_human_user(
# Revoke all preregistration users except prereg_user, and link prereg_user to
# the created user
if prereg_user is None:
assert not realm_creation, "realm_creation should only happen with a PreregistrationUser"
if prereg_user is not None:
prereg_user.status = confirmation_settings.STATUS_ACTIVE