mirror of
https://github.com/zulip/zulip.git
synced 2025-10-24 16:43:57 +00:00
export: Don't turn non-consented deactivated users into mirror dummies.
As explained in the comment, if we turn a non-consented deactivated user into a mirror dummy, this will violate the rule that a deactivated user cannot restore their account by themselves after an export->import cycle.
This commit is contained in:
committed by
Tim Abbott
parent
ff876d2df4
commit
39f1e1951b
@@ -1216,10 +1216,16 @@ def custom_fetch_user_profile(response: TableData, context: Context) -> None:
|
|||||||
if row["id"] in exportable_user_ids:
|
if row["id"] in exportable_user_ids:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# Convert non-exportable users to
|
# Non-exportable users should be turned into mirror dummies, with the notable exception
|
||||||
# inactive is_mirror_dummy users.
|
# of users who were already deactivated. Mirror dummies can sign up with the matching email
|
||||||
row["is_mirror_dummy"] = True
|
# address to reactivate their account. However, deactivated users are specifically meant to
|
||||||
row["is_active"] = False
|
# be prevented from re-entering the organization with the deactivated account.
|
||||||
|
# In order to maintain that restriction through the export->import cycle, we need to keep
|
||||||
|
# deactivated accounts as just deactivated - without flipping is_mirror_dummy=True.
|
||||||
|
if row["is_active"]:
|
||||||
|
row["is_mirror_dummy"] = True
|
||||||
|
row["is_active"] = False
|
||||||
|
|
||||||
if row["email_address_visibility"] == UserProfile.EMAIL_ADDRESS_VISIBILITY_NOBODY:
|
if row["email_address_visibility"] == UserProfile.EMAIL_ADDRESS_VISIBILITY_NOBODY:
|
||||||
# The user chose not to make their email address visible even to the realm administrators.
|
# The user chose not to make their email address visible even to the realm administrators.
|
||||||
# Generate a dummy email address for them so that this preference can't be bypassed
|
# Generate a dummy email address for them so that this preference can't be bypassed
|
||||||
|
|||||||
Reference in New Issue
Block a user