def custom_contexts(request): try: user_level_projects = Authorization.get_user_level_projects( request.user) except Exception: user_level_projects = {} logger.exception('Cannot retrieve user level project') return { 'APPLICATION_NAME': settings.APPLICATION_NAME, 'LOGO_PATH': settings.LOGO_PATH, 'APPLICATION_ABSTRACT': settings.APPLICATION_ABSTRACT, 'FAVICON_PATH': settings.FAVICON_PATH, 'IMAGE_FORMAT': settings.IMAGE_FORMAT, 'FILE_MAX_SIZE': settings.FILE_MAX_SIZE, 'USER_LEVEL_PROJECTS': user_level_projects, 'SERVICE': settings.DEFAULT_BASE_MAP.get('SERVICE'), 'OPTIONS': settings.DEFAULT_BASE_MAP.get('OPTIONS'), 'DEFAULT_MAP_VIEW': settings.DEFAULT_MAP_VIEW, 'GEOCODER_PROVIDERS': settings.GEOCODER_PROVIDERS, 'SELECTED_GEOCODER_PROVIDER': settings.SELECTED_GEOCODER.get('PROVIDER'), 'SSO_SETTED': sso_setted(request), 'LOGIN_URL': login_url(), }
def get(self, request): try: user_level_projects = Authorization.get_user_level_projects( request.user) except Exception: user_level_projects = {} return Response(data=user_level_projects, status=200)
def custom_contexts(request): try: user_level_projects = Authorization.get_user_level_projects( request.user) except Exception: user_level_projects = {} logger.exception('Cannot retrieve user level project') return { 'APPLICATION_NAME': settings.APPLICATION_NAME, 'LOGO_PATH': settings.LOGO_PATH, 'APPLICATION_ABSTRACT': settings.APPLICATION_ABSTRACT, 'IMAGE_FORMAT': settings.IMAGE_FORMAT, 'FILE_MAX_SIZE': settings.FILE_MAX_SIZE, 'USER_LEVEL_PROJECTS': user_level_projects, 'SERVICE': settings.DEFAULT_BASE_MAP.get('SERVICE'), 'OPTIONS': json.dumps(settings.DEFAULT_BASE_MAP.get('OPTIONS')), 'DEFAULT_MAP_VIEW': settings.DEFAULT_MAP_VIEW }