realm: Disable enable_spectator_access on changing to limited plan.

Since we not allow enabling public access on limited plan realms,
we set the enable_spectator_access setting to False when downgrading
to a limited plan. Setting is still shown in the UI but it is
disabled.
This commit is contained in:
Sahil Batra
2022-06-02 19:26:30 +05:30
committed by Tim Abbott
parent 9d831b50b7
commit d2f2fbf6b9
5 changed files with 46 additions and 4 deletions

View File

@@ -166,6 +166,10 @@ def do_create_realm(
if org_type is not None:
kwargs["org_type"] = org_type
if enable_spectator_access is not None:
if enable_spectator_access:
# Realms with LIMITED plan cannot have spectators enabled.
assert plan_type != Realm.PLAN_TYPE_LIMITED
assert plan_type is not None or not settings.BILLING_ENABLED
kwargs["enable_spectator_access"] = enable_spectator_access
if date_created is not None: