mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
Move completely_open to models.py.
It will have new callers soon and that's as fine a place as any to avoid circular imports. (imported from commit 089a724e9ad06cb5a51ffe80f1729d789238e5f6)
This commit is contained in:
@@ -59,6 +59,12 @@ def get_display_recipient_memcached(recipient):
|
||||
'short_name': user_profile.short_name,
|
||||
'id': user_profile.id} for user_profile in user_profile_list]
|
||||
|
||||
def completely_open(domain):
|
||||
# This domain is completely open to everyone on the internet to
|
||||
# join. This is not the same as a "restricted_to_domain" realm: in
|
||||
# those realms, users from outside the domain must be invited.
|
||||
return domain and domain.lower() == "customer3.invalid"
|
||||
|
||||
class Realm(models.Model):
|
||||
domain = models.CharField(max_length=40, db_index=True, unique=True)
|
||||
restricted_to_domain = models.BooleanField(default=True)
|
||||
|
||||
@@ -21,7 +21,7 @@ from zerver.models import Message, UserProfile, Stream, Subscription, \
|
||||
MAX_SUBJECT_LENGTH, get_stream, bulk_get_streams, UserPresence, \
|
||||
get_recipient, valid_stream_name, to_dict_cache_key, to_dict_cache_key_id, \
|
||||
extract_message_dict, stringify_message_dict, parse_usermessage_flags, \
|
||||
email_to_domain, email_to_username, get_realm
|
||||
email_to_domain, email_to_username, get_realm, completely_open
|
||||
from zerver.lib.actions import do_remove_subscription, bulk_remove_subscriptions, \
|
||||
do_change_password, create_mit_user_if_needed, do_change_full_name, \
|
||||
do_change_enable_desktop_notifications, do_change_enter_sends, do_change_enable_sounds, \
|
||||
@@ -480,12 +480,6 @@ def initial_invite_page(request):
|
||||
def logout_then_login(request, **kwargs):
|
||||
return django_logout_then_login(request, kwargs)
|
||||
|
||||
def completely_open(domain):
|
||||
# This domain is completely open to everyone on the internet to
|
||||
# join. This is not the same as a "restricted_to_domain" realm: in
|
||||
# those realms, users from outside the domain must be invited.
|
||||
return domain.lower() == "customer3.invalid"
|
||||
|
||||
def create_preregistration_user(email, request):
|
||||
domain = request.session.get("domain")
|
||||
if domain and not completely_open(domain):
|
||||
|
||||
Reference in New Issue
Block a user