auth: Remove Realm.AUTHENTICATION_FLAGS class attribute.

With the removal of the authentication_methods bitfield this is now
useless and just duplicates AUTH_BACKEND_NAME_MAP keys.
This commit is contained in:
Mateusz Mandera 2023-04-16 22:32:39 +02:00 committed by Tim Abbott
parent ffa3aa8487
commit 72d56d5d59
4 changed files with 12 additions and 19 deletions

View File

@ -294,19 +294,6 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
INVITES_STANDARD_REALM_DAILY_MAX = 3000
MESSAGE_VISIBILITY_LIMITED = 10000
AUTHENTICATION_FLAGS = [
"Google",
"Email",
"GitHub",
"LDAP",
"Dev",
"RemoteUser",
"AzureAD",
"SAML",
"GitLab",
"Apple",
"OpenID Connect",
]
SUBDOMAIN_FOR_ROOT_DOMAIN = ""
WILDCARD_MENTION_THRESHOLD = 15

View File

@ -9,8 +9,13 @@ import orjson
from zerver.data_import.gitter import do_convert_data, get_usermentions
from zerver.lib.import_realm import do_import_realm
from 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:
continue

View File

@ -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 Stream
from zproject import urls
from zproject.backends import AUTH_BACKEND_NAME_MAP
class PublicURLTest(ZulipTestCase):
@ -115,7 +116,7 @@ class PublicURLTest(ZulipTestCase):
Here we simply sanity-check that all the URLs load
correctly.
"""
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",

View File

@ -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():