Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
auth: Fix re-enabling of SAML/AzureAD in organization settings UI.
Mateusz Mandera114f13e0ee0c
diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.pyindex a2654cb92ce..96b3a8890e8 100644--- a/zerver/tests/test_auth_backends.py+++ b/zerver/tests/test_auth_backends.py@@ -7368,6 +7368,21 @@ class TestAdminSetBackends(ZulipTestCase):result, "Authentication method AzureAD is not available on your current plan.")+ # With BILLING_ENABLED=False, no such restrictions apply.+ with self.settings(BILLING_ENABLED=False):+ result = self.client_patch(+ "/json/realm",+ {+ "authentication_methods": orjson.dumps(+ {"Email": True, "Dev": True, "AzureAD": True}+ ).decode()+ },+ )+ self.assert_json_success(result)+ self.assertEqual(+ realm.authentication_methods_dict(), {"Dev": True, "Email": True, "AzureAD": True}+ )+class EmailValidatorTestCase(ZulipTestCase):def test_valid_email(self) -> None:diff --git a/zerver/views/realm.py b/zerver/views/realm.pyindex 68bce2a3d58..b91df956f23 100644--- a/zerver/views/realm.py+++ b/zerver/views/realm.py@@ -25,7 +25,6 @@ from zerver.actions.realm_settings import (do_set_realm_zulip_update_announcements_stream,parse_and_set_setting_value_if_required,validate_authentication_methods_dict_from_api,- validate_plan_for_authentication_methods,)from zerver.decorator import require_realm_admin, require_realm_ownerfrom zerver.forms import check_subdomain_available as check_subdomain@@ -199,7 +198,6 @@ def update_realm(validate_authentication_methods_dict_from_api(realm, authentication_methods)if True not in authentication_methods.values():raise JsonableError(_("At least one authentication method must be enabled."))- validate_plan_for_authentication_methods(realm, authentication_methods)if video_chat_provider is not None and video_chat_provider not in {p["id"] for p in Realm.VIDEO_CHAT_PROVIDERS.values()