backends: Implementation of restricting certain backends by plan.

Only affects zulipchat, by being based on the BILLING_ENABLED setting.

The restricted backends in this commit are
- AzureAD - restricted to Standard plan
- SAML - restricted to Plus plan, although it was already practically
  restricted due to requiring server-side configuration to be done by us

This restriction is placed upon **enabling** a backend - so
organizations that already have a backend enabled, will continue to be
able to use it. This allows us to make exceptions and enable a backend
for an org manually via the shell, and to grandfather organizations into
keeping the backend they have been relying on.
This commit is contained in:
Mateusz Mandera
2024-02-05 23:52:25 +01:00
committed by Tim Abbott
parent fdbdf8c620
commit da9e4e6e54
19 changed files with 538 additions and 38 deletions

View File

@@ -290,7 +290,20 @@ export function dispatch_normal_event(event) {
switch (event.property) {
case "default":
for (const [key, value] of Object.entries(event.data)) {
realm["realm_" + key] = value;
if (key === "authentication_methods") {
for (const [auth_method, enabled] of Object.entries(
event.data.authentication_methods,
)) {
realm.realm_authentication_methods[auth_method].enabled =
enabled;
}
settings_org.populate_auth_methods(
event.data.authentication_methods,
);
} else {
realm["realm_" + key] = value;
}
if (Object.hasOwn(realm_settings, key)) {
settings_org.sync_realm_settings(key);
}
@@ -305,11 +318,6 @@ export function dispatch_normal_event(event) {
message_live_update.rerender_messages_view();
}
}
if (event.data.authentication_methods !== undefined) {
settings_org.populate_auth_methods(
event.data.authentication_methods,
);
}
break;
case "icon":
realm.realm_icon_url = event.data.icon_url;