def forbidden(request): """ View used when someone tries to log in and is an authenticated iPlant user, but was found to be unauthorized to use Atmosphere by OAuth. Returns HTTP status code 403 Forbidden """ metadata = get_site_metadata() template_params = {} template_params['THEME_URL'] = "/themes/%s" % settings.THEME_NAME template_params['ORG_NAME'] = settings.ORG_NAME template_params['SITE_TITLE'] = settings.SITE_TITLE template_params['SITE_FOOTER'] = settings.SITE_FOOTER template_params['USER_PORTAL_LINK'] = metadata.user_portal_link template_params['USER_PORTAL_LINK_TEXT'] = metadata.user_portal_link_text template_params['ACCOUNT_INSTRUCTIONS_LINK'] = \ metadata.account_instructions_link if hasattr(settings, "BASE_URL"): template_params['BASE_URL'] = settings.BASE_URL # If banner message in query params, pass it into the template if "banner" in request.GET: template_params['banner'] = request.GET['banner'] response = render_to_response('no_user.html', template_params, context_instance=RequestContext(request)) return response
def forbidden(request): """ View used when someone tries to log in and is an authenticated iPlant user, but was found to be unauthorized to use Atmosphere by OAuth. Returns HTTP status code 403 Forbidden """ metadata = get_site_metadata() template_params = {} template_params['THEME_URL'] = "/assets/theme" template_params['ORG_NAME'] = settings.ORG_NAME template_params['SITE_TITLE'] = settings.SITE_TITLE template_params['SITE_FOOTER'] = settings.SITE_FOOTER template_params['SUPPORT_EMAIL'] = settings.SUPPORT_EMAIL template_params['USER_PORTAL_LINK'] = metadata.user_portal_link template_params['USER_PORTAL_LINK_TEXT'] = metadata.user_portal_link_text template_params['ACCOUNT_INSTRUCTIONS_LINK'] = \ metadata.account_instructions_link if hasattr(settings, "BASE_URL"): template_params['BASE_URL'] = settings.BASE_URL # If banner message in query params, pass it into the template if "banner" in request.GET: template_params['banner'] = request.GET['banner'] response = render_to_response( 'no_user.html', template_params, context_instance=RequestContext(request) ) return response
def _populate_template_params(request, maintenance_records, notice_t, disabled_login, public=False): """ Creates a dict of parameters for later template merge given the arguments, request session, and django settings (defined in `default.py` or overidden in `local.py`). """ # keep this variable around for the return statement ... show_troposphere_only = _should_show_troposphere_only() enable_new_relic = _should_enabled_new_relic() notice = "" if notice_t and len(notice_t) > 2: notice = notice_t[1] if not notice_t[2] else None logger.info("maintenance notice tuple: {0}".format(notice_t)) template_params = { 'access_token': request.session.get('access_token'), 'emulator_token': request.session.get('emulator_token'), 'emulator': request.session.get('emulator'), 'records': maintenance_records, 'notice': notice, 'show_troposphere_only': show_troposphere_only, 'new_relic_enabled': enable_new_relic, 'show_public_site': public } show_instance_metrics = getattr(settings, "SHOW_INSTANCE_METRICS", False) if public: template_params['disable_login'] = disabled_login else: template_params['disable_login'] = False template_params['show_instance_metrics'] = show_instance_metrics # Only include Intercom information when rendering the authenticated # version of the site. if hasattr(settings, "INTERCOM_APP_ID"): template_params['intercom_app_id'] = settings.INTERCOM_APP_ID template_params['intercom_company_id'] = \ settings.INTERCOM_COMPANY_ID template_params['intercom_company_name'] = \ settings.INTERCOM_COMPANY_NAME if enable_new_relic: template_params['new_relic_browser_snippet'] = \ settings.NEW_RELIC_BROWSER_SNIPPET template_params['SITE_TITLE'] = settings.SITE_TITLE template_params['SITE_FOOTER'] = settings.SITE_FOOTER template_params['SUPPORT_EMAIL'] = settings.SUPPORT_EMAIL template_params['UI_VERSION'] = settings.UI_VERSION template_params['BADGE_HOST'] = getattr(settings, "BADGE_HOST", None) #TODO: Replace this line when theme support is re-enabled. #template_params["THEME_URL"] = "assets/" template_params['THEME_URL'] = "/themes/%s" % settings.THEME_NAME template_params['ORG_NAME'] = settings.ORG_NAME template_params['DYNAMIC_ASSET_LOADING'] = settings.DYNAMIC_ASSET_LOADING if hasattr(settings, "BASE_URL"): template_params['BASE_URL'] = settings.BASE_URL metadata = get_site_metadata() template_params['DISPLAY_STATUS_PAGE'] = False template_params['WEB_DESKTOP_INCLUDE_LINK'] = \ settings.WEB_DESKTOP_INCLUDE_LINK if metadata: template_params['DISPLAY_STATUS_PAGE'] = \ metadata.display_status_page_link template_params['STATUS_PAGE_LINK'] = \ metadata.status_page_link if hasattr(settings, "API_ROOT"): template_params['API_ROOT'] = settings.API_ROOT if hasattr(settings, "API_V2_ROOT"): template_params['API_V2_ROOT'] = settings.API_V2_ROOT if hasattr(settings, "USE_GATE_ONE_API"): template_params['USE_GATE_ONE_API'] = settings.USE_GATE_ONE_API template_params['WEB_SH_URL'] = settings.WEB_SH_URL return template_params, show_troposphere_only
def _populate_template_params(request, maintenance_records, notice_t, disabled_login, public=False): """ Creates a dict of parameters for later template merge given the arguments, request session, and django settings (defined in `default.py` or overidden in `local.py`). """ # keep this variable around for the return statement ... enable_new_relic = _should_enabled_new_relic() notice = "" if notice_t and len(notice_t) > 2: notice = notice_t[1] if not notice_t[2] else None logger.info("maintenance notice tuple: {0}".format(notice_t)) if 'access_token' not in request.session \ and 'auth_token' in request.COOKIES: request.session['access_token'] = request.COOKIES['auth_token'] #NOTE: Now that we've moved this section from .js to Django, sentry configuration _could_ become more dynamic: if settings.DEBUG: sentry_dict = None else: sentry_dict = { "dsn": "https://[email protected]/73366", "release":"205096b5fde3a47303ad8d1fef9ff8052cbbd7d4", } auth_backends = settings.AUTHENTICATION_BACKENDS oauth_backends = [ 'iplantauth.authBackends.OAuthLoginBackend', 'iplantauth.authBackends.GlobusOAuthLoginBackend' ] auth_type = None for backend in auth_backends: if backend == oauth_backends[0]: auth_type = "oauth-login" auth_provider = "CAS" elif backend == oauth_backends[1]: auth_type = "oauth-login" auth_provider = "Globus" if not auth_type: auth_type = "token-login" auth_provider = "Atmosphere" template_params = { 'access_token': request.session.get('access_token'), 'login_auth_type': auth_type, 'login_auth_provider': auth_provider, 'emulator_token': request.session.get('emulator_token'), 'emulator': request.session.get('emulator'), 'records': maintenance_records, 'notice': notice, 'sentry': sentry_dict, 'new_relic_enabled': enable_new_relic, 'show_public_site': public } logger.info("Populated template: %s" % template_params) if public: template_params['disable_login'] = disabled_login else: template_params['disable_login'] = False template_params['SHOW_INSTANCE_METRICS'] = \ getattr(settings, "SHOW_INSTANCE_METRICS", False) # Only include Intercom information when rendering the authenticated # version of the site. if hasattr(settings, "INTERCOM_APP_ID"): template_params['intercom_app_id'] = settings.INTERCOM_APP_ID template_params['intercom_company_id'] = \ settings.INTERCOM_COMPANY_ID template_params['intercom_company_name'] = \ settings.INTERCOM_COMPANY_NAME if enable_new_relic: template_params['new_relic_browser_snippet'] = \ settings.NEW_RELIC_BROWSER_SNIPPET template_params['SITE_TITLE'] = settings.SITE_TITLE template_params['SITE_FOOTER'] = settings.SITE_FOOTER template_params['SUPPORT_EMAIL'] = settings.SUPPORT_EMAIL template_params['UI_VERSION'] = settings.UI_VERSION template_params['BADGE_HOST'] = getattr(settings, "BADGE_HOST", None) template_params['USE_MOCK_DATA'] = getattr(settings, "USE_MOCK_DATA", False) template_params['USE_ALLOCATION_SOURCES'] = getattr(settings, "USE_ALLOCATION_SOURCES", False) template_params['THEME_URL'] = "/assets/theme" template_params['ORG_NAME'] = settings.ORG_NAME template_params['DYNAMIC_ASSET_LOADING'] = settings.DYNAMIC_ASSET_LOADING if hasattr(settings, "BASE_URL"): template_params['BASE_URL'] = settings.BASE_URL metadata = get_site_metadata() template_params['DISPLAY_STATUS_PAGE'] = False template_params['WEB_DESKTOP_INCLUDE_LINK'] = \ settings.WEB_DESKTOP_INCLUDE_LINK if metadata: template_params['DISPLAY_STATUS_PAGE'] = \ metadata.display_status_page_link template_params['STATUS_PAGE_LINK'] = \ metadata.status_page_link template_params['SITE_FOOTER_LINK'] = \ metadata.site_footer_link template_params['USER_PORTAL'] = \ metadata.get_user_portal_as_json() if hasattr(settings, "API_ROOT"): template_params['API_ROOT'] = settings.API_ROOT if hasattr(settings, "API_V2_ROOT"): template_params['API_V2_ROOT'] = settings.API_V2_ROOT if hasattr(settings, "USE_GATE_ONE_API"): template_params['USE_GATE_ONE_API'] = settings.USE_GATE_ONE_API template_params['WEB_SH_URL'] = settings.WEB_SH_URL return template_params
def _populate_template_params(request, maintenance_records, notice_t, disabled_login, public=False): """ Creates a dict of parameters for later template merge given the arguments, request session, and django settings (defined in `default.py` or overidden in `local.py`). """ # keep this variable around for the return statement ... new_relic_enabled = _should_enabled_new_relic() notice = "" if notice_t and len(notice_t) > 2: notice = notice_t[1] if not notice_t[2] else None logger.info("maintenance notice tuple: {0}".format(notice_t)) if 'access_token' not in request.session \ and 'auth_token' in request.COOKIES: request.session['access_token'] = request.COOKIES['auth_token'] emulator = request.session.get('emulator') auth_backends = settings.AUTHENTICATION_BACKENDS oauth_backends = [ 'django_cyverse_auth.authBackends.OAuthLoginBackend', 'django_cyverse_auth.authBackends.GlobusOAuthLoginBackend' ] openstack_backends = [ 'django_cyverse_auth.authBackends.OpenstackLoginBackend', ] password_backends = [ 'django_cyverse_auth.authBackends.AuthTokenLoginBackend', ] login_auth_allowed = [] login_auth_preferred = None for backend in auth_backends: login_auth_type = None auth_provider = None if backend in password_backends: login_auth_type = "password-login" auth_provider = "Atmosphere" elif backend in openstack_backends: login_auth_type = "openstack-login" auth_provider = "Openstack" elif backend == oauth_backends[0]: login_auth_type = "oauth-login" auth_provider = "CAS" elif backend == oauth_backends[1]: login_auth_type = "oauth-login" auth_provider = "Globus" if login_auth_type: login_auth_allowed.append({ 'method': login_auth_type, 'provider': auth_provider }) use_login_selection = getattr(settings, "USE_LOGIN_SELECTION", False) template_params = { 'access_token': request.session.get('access_token'), 'use_login_selection': use_login_selection, 'login_auth_allowed': login_auth_allowed, 'org_name': settings.ORG_NAME, 'show_instance_metrics': getattr(settings, "SHOW_INSTANCE_METRICS", False), 'emulator_token': request.session.get('emulator_token'), 'emulator': emulator, 'records': maintenance_records, 'notice': notice, 'new_relic_enabled': new_relic_enabled, 'show_public_site': public } logger.info("Populated template: %s" % template_params) if public: template_params['disable_login'] = disabled_login else: template_params['disable_login'] = False # Only include Intercom information when rendering the authenticated # version of the site. if hasattr(settings, "INTERCOM_APP_ID"): template_params['intercom_app_id'] = settings.INTERCOM_APP_ID template_params['intercom_company_id'] = \ settings.INTERCOM_COMPANY_ID template_params['intercom_company_name'] = \ settings.INTERCOM_COMPANY_NAME template_params['intercom_options'] = \ json.dumps(settings.INTERCOM_OPTIONS) if new_relic_enabled: from troposphere.settings import new_relic template_params['new_relic_browser_snippet'] = \ new_relic.NEW_RELIC_BROWSER_SNIPPET enable_sentry = getattr(settings, 'SENTRY_DSN', "") != "" enable_project_sharing = getattr(settings, 'ENABLE_PROJECT_SHARING', False) server_prefix = urlparse(settings.SERVER_URL).netloc.split('.')[0] sentry_tags = {'server_name': server_prefix} if emulator: sentry_tags['emulator'] = str(emulator) template_params['SITE_TITLE'] = settings.SITE_TITLE template_params['SITE_FOOTER'] = settings.SITE_FOOTER template_params['SUPPORT_EMAIL'] = settings.SUPPORT_EMAIL template_params['UI_VERSION'] = settings.UI_VERSION template_params['BADGE_HOST'] = getattr(settings, "BADGE_HOST", None) template_params['USE_MOCK_DATA'] = getattr(settings, "USE_MOCK_DATA", False) template_params['USE_ALLOCATION_SOURCES'] = getattr( settings, "USE_ALLOCATION_SOURCES", False) template_params['EXTERNAL_ALLOCATION'] = getattr(settings, "EXTERNAL_ALLOCATION", False) template_params['ALLOCATION_UNIT_NAME'] = getattr(settings, "ALLOCATION_UNIT_NAME", None) template_params['ALLOCATION_UNIT_ABBREV'] = getattr( settings, "ALLOCATION_UNIT_ABBREV", None) template_params['ORG_NAME'] = settings.ORG_NAME template_params['SENTRY_ENABLED'] = enable_sentry template_params['PROJECT_SHARING'] = enable_project_sharing template_params['sentry_tags_dict'] = sentry_tags template_params['collect_analytics'] = getattr(settings, "COLLECT_ANALYTICS", False) if hasattr(settings, "BASE_URL"): template_params['BASE_URL'] = settings.BASE_URL metadata = get_site_metadata() template_params['DISPLAY_STATUS_PAGE'] = False template_params['WEB_DESKTOP_ENABLED'] = \ settings.WEB_DESKTOP_ENABLED template_params['GUACAMOLE_ENABLED'] = \ settings.GUACAMOLE_ENABLED if metadata: template_params['DISPLAY_STATUS_PAGE'] = \ metadata.display_status_page_link template_params['STATUS_PAGE_LINK'] = \ metadata.status_page_link template_params['SITE_FOOTER_LINK'] = \ metadata.site_footer_link template_params['SITE_FOOTER_HTML'] = \ metadata.site_footer template_params['USER_PORTAL'] = \ metadata.get_user_portal_as_json() if hasattr(settings, "API_ROOT"): template_params['API_ROOT'] = settings.API_ROOT if hasattr(settings, "API_V2_ROOT"): template_params['API_V2_ROOT'] = settings.API_V2_ROOT if hasattr(settings, "USE_GATE_ONE_API"): template_params['USE_GATE_ONE_API'] = settings.USE_GATE_ONE_API template_params['WEB_SH_URL'] = settings.WEB_SH_URL return template_params
def _populate_template_params(request, maintenance_records, disabled_login, public=False): """ Creates a dict of parameters for later template merge given the arguments, request session, and django settings (defined in `default.py` or overidden in `local.py`). """ show_troposphere_only = _should_show_troposphere_only() template_params = { 'access_token': request.session.get('access_token'), 'emulator_token': request.session.get('emulator_token'), 'emulated_by': request.session.get('emulated_by'), 'records': maintenance_records, 'show_troposphere_only': show_troposphere_only, 'show_public_site': public } show_instance_metrics = getattr(settings, "SHOW_INSTANCE_METRICS", False) if public: template_params['disable_login'] = disabled_login else: template_params['disable_login'] = False template_params['show_instance_metrics'] = show_instance_metrics # Only include Intercom information when rendering the authenticated # version of the site. if hasattr(settings, "INTERCOM_APP_ID"): template_params['intercom_app_id'] = settings.INTERCOM_APP_ID template_params['intercom_company_id'] = \ settings.INTERCOM_COMPANY_ID template_params['intercom_company_name'] = \ settings.INTERCOM_COMPANY_NAME template_params['SITE_TITLE'] = settings.SITE_TITLE template_params['SITE_FOOTER'] = settings.SITE_FOOTER template_params['SUPPORT_EMAIL'] = settings.SUPPORT_EMAIL template_params['UI_VERSION'] = settings.UI_VERSION template_params['BADGE_HOST'] = getattr(settings, "BADGE_HOST", None) #TODO: Replace this line when theme support is re-enabled. #template_params["THEME_URL"] = "assets/" template_params['THEME_URL'] = "/themes/%s" % settings.THEME_NAME template_params['ORG_NAME'] = settings.ORG_NAME if hasattr(settings, "BASE_URL"): template_params['BASE_URL'] = settings.BASE_URL metadata = get_site_metadata() template_params['DISPLAY_STATUS_PAGE'] = False template_params['WEB_DESKTOP_INCLUDE_LINK'] = \ settings.WEB_DESKTOP_INCLUDE_LINK if metadata: template_params['DISPLAY_STATUS_PAGE'] = \ metadata.display_status_page_link template_params['STATUS_PAGE_LINK'] = \ metadata.status_page_link if hasattr(settings, "API_ROOT"): template_params['API_ROOT'] = settings.API_ROOT if hasattr(settings, "API_V2_ROOT"): template_params['API_V2_ROOT'] = settings.API_V2_ROOT if hasattr(settings, "USE_GATE_ONE_API"): template_params['USE_GATE_ONE_API'] = settings.USE_GATE_ONE_API template_params['WEB_SH_URL'] = settings.WEB_SH_URL return template_params, show_troposphere_only
def _populate_template_params(request, maintenance_records, notice_t, disabled_login, public=False): """ Creates a dict of parameters for later template merge given the arguments, request session, and django settings (defined in `default.py` or overidden in `local.py`). """ # keep this variable around for the return statement ... new_relic_enabled = _should_enabled_new_relic() notice = "" if notice_t and len(notice_t) > 2: notice = notice_t[1] if not notice_t[2] else None logger.info("maintenance notice tuple: {0}".format(notice_t)) if 'access_token' not in request.session \ and 'auth_token' in request.COOKIES: request.session['access_token'] = request.COOKIES['auth_token'] emulator = request.session.get('emulator') auth_backends = settings.AUTHENTICATION_BACKENDS oauth_backends = [ 'django_cyverse_auth.authBackends.OAuthLoginBackend', 'django_cyverse_auth.authBackends.GlobusOAuthLoginBackend' ] openstack_backends = [ 'django_cyverse_auth.authBackends.OpenstackLoginBackend', ] password_backends = [ 'django_cyverse_auth.authBackends.AuthTokenLoginBackend', ] login_auth_allowed = [] login_auth_preferred = None for backend in auth_backends: login_auth_type = None auth_provider = None if backend in password_backends: login_auth_type = "password-login" auth_provider = "Atmosphere" elif backend in openstack_backends: login_auth_type = "openstack-login" auth_provider = "Openstack" elif backend == oauth_backends[0]: login_auth_type = "oauth-login" auth_provider = "CAS" elif backend == oauth_backends[1]: login_auth_type = "oauth-login" auth_provider = "Globus" if login_auth_type: login_auth_allowed.append({'method': login_auth_type, 'provider': auth_provider}) use_login_selection = getattr(settings, "USE_LOGIN_SELECTION", False) template_params = { 'access_token': request.session.get('access_token'), 'use_login_selection': use_login_selection, 'login_auth_allowed': login_auth_allowed, 'org_name': settings.ORG_NAME, 'show_instance_metrics': getattr(settings, "SHOW_INSTANCE_METRICS", False), 'emulator_token': request.session.get('emulator_token'), 'emulator': emulator, 'records': maintenance_records, 'notice': notice, 'new_relic_enabled': new_relic_enabled, 'show_public_site': public } logger.info("Populated template: %s" % template_params) if public: template_params['disable_login'] = disabled_login else: template_params['disable_login'] = False # Only include Intercom information when rendering the authenticated # version of the site. if hasattr(settings, "INTERCOM_APP_ID"): template_params['intercom_app_id'] = settings.INTERCOM_APP_ID template_params['intercom_company_id'] = \ settings.INTERCOM_COMPANY_ID template_params['intercom_company_name'] = \ settings.INTERCOM_COMPANY_NAME template_params['intercom_options'] = \ json.dumps(settings.INTERCOM_OPTIONS) if new_relic_enabled: from troposphere.settings import new_relic template_params['new_relic_browser_snippet'] = \ new_relic.NEW_RELIC_BROWSER_SNIPPET enable_sentry = getattr(settings, 'SENTRY_DSN',"") != "" enable_project_sharing = getattr(settings, 'ENABLE_PROJECT_SHARING',False) server_prefix = urlparse(settings.SERVER_URL).netloc.split('.')[0] sentry_tags = {'server_name': server_prefix} if emulator: sentry_tags['emulator'] = str(emulator) template_params['SITE_TITLE'] = settings.SITE_TITLE template_params['SITE_FOOTER'] = settings.SITE_FOOTER template_params['SUPPORT_EMAIL'] = settings.SUPPORT_EMAIL template_params['BADGE_HOST'] = getattr(settings, "BADGE_HOST", None) template_params['USE_MOCK_DATA'] = getattr(settings, "USE_MOCK_DATA", False) template_params['EXTERNAL_ALLOCATION'] = getattr(settings, "EXTERNAL_ALLOCATION", False) template_params['ALLOCATION_UNIT_NAME'] = getattr(settings, "ALLOCATION_UNIT_NAME", None) template_params['ALLOCATION_UNIT_ABBREV'] = getattr(settings, "ALLOCATION_UNIT_ABBREV", None) template_params['ORG_NAME'] = settings.ORG_NAME template_params['SENTRY_ENABLED'] = enable_sentry template_params['PROJECT_SHARING'] = enable_project_sharing template_params['sentry_tags_dict'] = sentry_tags template_params['collect_analytics'] = getattr(settings, "COLLECT_ANALYTICS", False) if hasattr(settings, "BASE_URL"): template_params['BASE_URL'] = settings.BASE_URL metadata = get_site_metadata() template_params['DISPLAY_STATUS_PAGE'] = False template_params['WEB_DESKTOP_ENABLED'] = \ settings.WEB_DESKTOP_ENABLED template_params['GUACAMOLE_ENABLED'] = \ settings.GUACAMOLE_ENABLED if metadata: template_params['DISPLAY_STATUS_PAGE'] = \ metadata.display_status_page_link template_params['STATUS_PAGE_LINK'] = \ metadata.status_page_link template_params['SITE_FOOTER_LINK'] = \ metadata.site_footer_link template_params['SITE_FOOTER_HTML'] = \ metadata.site_footer template_params['USER_PORTAL'] = \ metadata.get_user_portal_as_json() if hasattr(settings, "API_ROOT"): template_params['API_ROOT'] = settings.API_ROOT if hasattr(settings, "API_V2_ROOT"): template_params['API_V2_ROOT'] = settings.API_V2_ROOT if hasattr(settings, "USE_GATE_ONE_API"): template_params['USE_GATE_ONE_API'] = settings.USE_GATE_ONE_API template_params['WEB_SH_URL'] = settings.WEB_SH_URL return template_params
def _populate_template_params(request, maintenance_records, notice_t, disabled_login, public=False): """ Creates a dict of parameters for later template merge given the arguments, request session, and django settings (defined in `default.py` or overidden in `local.py`). """ # keep this variable around for the return statement ... enable_new_relic = _should_enabled_new_relic() notice = "" if notice_t and len(notice_t) > 2: notice = notice_t[1] if not notice_t[2] else None logger.info("maintenance notice tuple: {0}".format(notice_t)) if 'access_token' not in request.session \ and 'auth_token' in request.COOKIES: request.session['access_token'] = request.COOKIES['auth_token'] auth_backends = settings.AUTHENTICATION_BACKENDS oauth_backends = [ 'django_cyverse_auth.authBackends.OAuthLoginBackend', 'django_cyverse_auth.authBackends.GlobusOAuthLoginBackend' ] openstack_backends = [ 'django_cyverse_auth.authBackends.OpenstackLoginBackend', ] password_backends = [ 'django_cyverse_auth.authBackends.AuthTokenLoginBackend', ] login_auth_allowed = [] login_auth_preferred = None for backend in auth_backends: login_auth_type = None auth_provider = None # if backend in password_backends: # login_auth_type = "password-login" # auth_provider = "Atmosphere" if backend in openstack_backends: login_auth_type = "openstack-login" auth_provider = "Openstack" elif backend == oauth_backends[0]: login_auth_type = "oauth-login" auth_provider = "CAS" elif backend == oauth_backends[1]: login_auth_type = "oauth-login" auth_provider = "Globus" if login_auth_type: login_auth_allowed.append({ 'method': login_auth_type, 'provider': auth_provider }) use_login_selection = getattr(settings, "USE_LOGIN_SELECTION", False) template_params = { 'access_token': request.session.get('access_token'), 'use_login_selection': use_login_selection, 'login_auth_allowed': login_auth_allowed, 'org_name': settings.ORG_NAME, 'emulator_token': request.session.get('emulator_token'), 'emulator': request.session.get('emulator'), 'records': maintenance_records, 'notice': notice, 'new_relic_enabled': enable_new_relic, 'show_public_site': public } logger.info("Populated template: %s" % template_params) if public: template_params['disable_login'] = disabled_login else: template_params['disable_login'] = False template_params['SHOW_INSTANCE_METRICS'] = \ getattr(settings, "SHOW_INSTANCE_METRICS", False) if enable_new_relic: template_params['new_relic_browser_snippet'] = \ settings.NEW_RELIC_BROWSER_SNIPPET template_params['SITE_TITLE'] = settings.SITE_TITLE template_params['SITE_FOOTER'] = settings.SITE_FOOTER template_params['SUPPORT_EMAIL'] = settings.SUPPORT_EMAIL template_params['UI_VERSION'] = settings.UI_VERSION template_params['BADGE_HOST'] = getattr(settings, "BADGE_HOST", None) template_params['USE_MOCK_DATA'] = getattr(settings, "USE_MOCK_DATA", False) template_params['USE_ALLOCATION_SOURCES'] = getattr( settings, "USE_ALLOCATION_SOURCES", False) template_params['THEME_URL'] = "/assets/theme" template_params['ORG_NAME'] = settings.ORG_NAME template_params['DYNAMIC_ASSET_LOADING'] = settings.DYNAMIC_ASSET_LOADING if hasattr(settings, "BASE_URL"): template_params['BASE_URL'] = settings.BASE_URL metadata = get_site_metadata() template_params['DISPLAY_STATUS_PAGE'] = False template_params['WEB_DESKTOP_INCLUDE_LINK'] = \ settings.WEB_DESKTOP_INCLUDE_LINK if metadata: template_params['DISPLAY_STATUS_PAGE'] = \ metadata.display_status_page_link template_params['STATUS_PAGE_LINK'] = \ metadata.status_page_link template_params['SITE_FOOTER_LINK'] = \ metadata.site_footer_link template_params['USER_PORTAL'] = \ metadata.get_user_portal_as_json() if hasattr(settings, "API_ROOT"): template_params['API_ROOT'] = settings.API_ROOT if hasattr(settings, "API_V2_ROOT"): template_params['API_V2_ROOT'] = settings.API_V2_ROOT if hasattr(settings, "USE_GATE_ONE_API"): template_params['USE_GATE_ONE_API'] = settings.USE_GATE_ONE_API template_params['WEB_SH_URL'] = settings.WEB_SH_URL return template_params