Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
auth: Remove Realm.AUTHENTICATION_FLAGS class attribute.
Mateusz Mandera72d56d5d5987
diff --git a/zerver/models.py b/zerver/models.pyindex 9ba46130354..8a0678ff6ca 100644--- a/zerver/models.py+++ b/zerver/models.py@@ -294,19 +294,6 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stubINVITES_STANDARD_REALM_DAILY_MAX = 3000MESSAGE_VISIBILITY_LIMITED = 10000- AUTHENTICATION_FLAGS = [- "Google",- "Email",- "GitHub",- "LDAP",- "Dev",- "RemoteUser",- "AzureAD",- "SAML",- "GitLab",- "Apple",- "OpenID Connect",- ]SUBDOMAIN_FOR_ROOT_DOMAIN = ""WILDCARD_MENTION_THRESHOLD = 15diff --git a/zerver/tests/test_gitter_importer.py b/zerver/tests/test_gitter_importer.pyindex 061e46eea20..09aeb1ffac7 100644--- a/zerver/tests/test_gitter_importer.py+++ b/zerver/tests/test_gitter_importer.py@@ -9,8 +9,13 @@ import orjsonfrom zerver.data_import.gitter import do_convert_data, get_usermentionsfrom zerver.lib.import_realm import do_import_realmfrom zerver.lib.test_classes import ZulipTestCase-from zerver.models import Message, Realm, UserProfile, get_realm-from zproject.backends import GitHubAuthBackend, auth_enabled_helper, github_auth_enabled+from zerver.models import Message, UserProfile, get_realm+from zproject.backends import (+ AUTH_BACKEND_NAME_MAP,+ GitHubAuthBackend,+ auth_enabled_helper,+ github_auth_enabled,+)class GitterImporter(ZulipTestCase):@@ -131,7 +136,7 @@ class GitterImporter(ZulipTestCase):self.assertIsNotNone(message.rendered_content, None)self.assertTrue(github_auth_enabled(realm))- for auth_backend_name in Realm.AUTHENTICATION_FLAGS:+ for auth_backend_name in AUTH_BACKEND_NAME_MAP:if auth_backend_name == GitHubAuthBackend.auth_backend_name:continuediff --git a/zerver/tests/test_urls.py b/zerver/tests/test_urls.pyindex bb281534a72..c52a7ae8ca5 100644--- a/zerver/tests/test_urls.py+++ b/zerver/tests/test_urls.py@@ -12,8 +12,9 @@ from zerver.lib.url_redirects import (LANDING_PAGE_REDIRECTS,POLICY_DOCUMENTATION_REDIRECTS,)-from zerver.models import Realm, Stream+from zerver.models import Streamfrom zproject import urls+from zproject.backends import AUTH_BACKEND_NAME_MAPclass PublicURLTest(ZulipTestCase):@@ -115,7 +116,7 @@ class PublicURLTest(ZulipTestCase):Here we simply sanity-check that all the URLs loadcorrectly."""- auth_types = [auth.lower() for auth in Realm.AUTHENTICATION_FLAGS]+ auth_types = [auth.lower() for auth in AUTH_BACKEND_NAME_MAP]for auth in ["azuread","email",diff --git a/zproject/backends.py b/zproject/backends.pyindex 6b538fba137..ade8e1252d4 100644--- a/zproject/backends.py+++ b/zproject/backends.py@@ -137,7 +137,7 @@ def auth_enabled_helper(backends_to_check: List[str], realm: Optional[Realm]) ->if realm is not None:enabled_method_dict = realm.authentication_methods_dict()else:- enabled_method_dict = {method: True for method in Realm.AUTHENTICATION_FLAGS}+ enabled_method_dict = {method: True for method in AUTH_BACKEND_NAME_MAP}pad_method_dict(enabled_method_dict)for supported_backend in supported_auth_backends():