def commonheader(title, section, user, request=None, padding="90px", skip_topbar=False, skip_idle_timeout=False, is_mobile=False): """ Returns the rendered common header """ current_app, other_apps, apps_list = _get_apps(user, section) template = 'common_header.mako' if is_mobile: template = 'common_header_m.mako' return django_mako.render_to_string(template, { 'current_app': current_app, 'apps': apps_list, 'other_apps': other_apps, 'title': title, 'section': section, 'padding': padding, 'user': user, 'request': request, 'skip_topbar': skip_topbar, 'skip_idle_timeout': skip_idle_timeout, 'leaflet': { 'layer': desktop.conf.LEAFLET_TILE_LAYER.get(), 'attribution': desktop.conf.LEAFLET_TILE_LAYER_ATTRIBUTION.get(), 'map_options': json.dumps(desktop.conf.LEAFLET_MAP_OPTIONS.get()), 'layer_options': json.dumps(desktop.conf.LEAFLET_TILE_LAYER_OPTIONS.get()), }, 'is_demo': desktop.conf.DEMO_ENABLED.get(), 'is_ldap_setup': 'desktop.auth.backend.LdapBackend' in desktop.conf.AUTH.BACKEND.get(), 'is_s3_enabled': fsmanager.is_enabled('s3a') and fsmanager.has_access('s3a', request.user), 'is_adls_enabled': fsmanager.is_enabled('adl') and fsmanager.has_access('adl', request.user), 'banner_message': get_banner_message(request) })
def hue(request): current_app, other_apps, apps_list = _get_apps(request.user, '') clusters = list(get_clusters(request.user).values()) user_permitted = request.session.get('samlgroup_permitted_flag') if (not user_permitted) and (not samlgroup_check(request)): return render('403.mako', request, { 'is_embeddable': True }) return render('hue.mako', request, { 'apps': apps_list, 'other_apps': other_apps, 'is_s3_enabled': fsmanager.is_enabled('s3a') and fsmanager.has_access('s3a', request.user), 'is_adls_enabled': fsmanager.is_enabled('adl') and fsmanager.has_access('adl', request.user), 'is_ldap_setup': 'desktop.auth.backend.LdapBackend' in desktop.conf.AUTH.BACKEND.get(), 'leaflet': { 'layer': desktop.conf.LEAFLET_TILE_LAYER.get(), 'attribution': desktop.conf.LEAFLET_TILE_LAYER_ATTRIBUTION.get(), 'map_options': json.dumps(desktop.conf.LEAFLET_MAP_OPTIONS.get()), 'layer_options': json.dumps(desktop.conf.LEAFLET_TILE_LAYER_OPTIONS.get()), }, 'is_demo': desktop.conf.DEMO_ENABLED.get(), 'banner_message': get_banner_message(request), 'user_preferences': dict((x.key, x.value) for x in UserPreferences.objects.filter(user=request.user)), 'cluster': clusters[0]['type'] if clusters else None })
def global_js_constants(request): return HttpResponse(render('global_js_constants.mako', request, { 'is_s3_enabled': fsmanager.is_enabled('s3a') and fsmanager.has_access('s3a', request.user), 'leaflet': { 'layer': desktop.conf.LEAFLET_TILE_LAYER.get(), 'attribution': desktop.conf.LEAFLET_TILE_LAYER_ATTRIBUTION.get(), 'map_options': json.dumps(desktop.conf.LEAFLET_MAP_OPTIONS.get()), 'layer_options': json.dumps(desktop.conf.LEAFLET_TILE_LAYER_OPTIONS.get()), } }), content_type="application/javascript")