2013-04-23 18:51:17 +02:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2012-10-15 22:52:08 +02:00
|
|
|
from django.conf import settings
|
2013-06-18 23:55:55 +02:00
|
|
|
import ujson
|
2013-11-04 23:42:31 +01:00
|
|
|
from zproject.backends import password_auth_enabled
|
2012-10-15 22:52:08 +02:00
|
|
|
|
2012-10-30 21:20:52 +01:00
|
|
|
def add_settings(request):
|
2014-03-28 00:45:03 +01:00
|
|
|
if hasattr(request.user, "realm"):
|
|
|
|
is_pw_auth_enabled = password_auth_enabled(request.user.realm)
|
|
|
|
else:
|
|
|
|
is_pw_auth_enabled = True
|
2012-10-17 20:34:38 +02:00
|
|
|
return {
|
|
|
|
'full_navbar': settings.FULL_NAVBAR,
|
2013-11-13 22:08:58 +01:00
|
|
|
# We use the not_enterprise variable name so that templates
|
|
|
|
# will render even if the appropriate context is not provided
|
|
|
|
# to the template
|
|
|
|
'not_enterprise': not settings.ENTERPRISE,
|
2013-11-04 19:37:05 +01:00
|
|
|
'zulip_admin': settings.ZULIP_ADMINISTRATOR,
|
2014-03-28 00:45:03 +01:00
|
|
|
'password_auth_enabled': is_pw_auth_enabled,
|
2013-11-13 23:31:59 +01:00
|
|
|
'login_url': settings.HOME_NOT_LOGGED_IN,
|
2013-11-14 16:56:07 +01:00
|
|
|
'only_sso': settings.ONLY_SSO,
|
2013-12-04 20:57:44 +01:00
|
|
|
'external_api_path': settings.EXTERNAL_API_PATH,
|
|
|
|
'external_api_uri': settings.EXTERNAL_API_URI,
|
|
|
|
'external_uri_scheme': settings.EXTERNAL_URI_SCHEME,
|
|
|
|
'api_site_required': settings.EXTERNAL_API_PATH != "api.zulip.com",
|
2013-12-04 22:35:38 +01:00
|
|
|
'email_integration_enabled': settings.EMAIL_GATEWAY_BOT != "",
|
2013-12-04 22:37:49 +01:00
|
|
|
'email_gateway_example': settings.EMAIL_GATEWAY_EXAMPLE,
|
2012-10-17 20:34:38 +02:00
|
|
|
}
|
2013-06-17 18:01:22 +02:00
|
|
|
|
|
|
|
def add_metrics(request):
|
|
|
|
return {
|
|
|
|
'mixpanel_token': settings.MIXPANEL_TOKEN,
|
2013-06-18 23:55:55 +02:00
|
|
|
'enable_metrics': ujson.dumps(settings.DEPLOYED),
|
2013-10-29 22:21:17 +01:00
|
|
|
'dropboxAppKey': settings.DROPBOX_APP_KEY
|
2013-06-17 18:01:22 +02:00
|
|
|
}
|