コード例 #1
0
def client_config():
    if not current_user.is_api_user() and current_user.is_authenticated:
        client_config = {
            'newVersionAvailable': get_latest_version(),
            'version': __version__
        }
    else:
        client_config = {}

    date_format = current_org.get_setting('date_format')

    defaults = {
        'allowScriptsInUserInput': settings.ALLOW_SCRIPTS_IN_USER_INPUT,
        'showPermissionsControl': settings.FEATURE_SHOW_PERMISSIONS_CONTROL,
        'allowCustomJSVisualizations': settings.FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS,
        'autoPublishNamedQueries': settings.FEATURE_AUTO_PUBLISH_NAMED_QUERIES,
        'dateFormat': date_format,
        'dateTimeFormat': "{0} HH:mm".format(date_format),
        'mailSettingsMissing': settings.MAIL_DEFAULT_SENDER is None,
        'dashboardRefreshIntervals': settings.DASHBOARD_REFRESH_INTERVALS,
        'queryRefreshIntervals': settings.QUERY_REFRESH_INTERVALS,
        'googleLoginEnabled': settings.GOOGLE_OAUTH_ENABLED,
    }

    client_config.update(defaults)
    client_config.update({
        'basePath': base_href()
    })

    return client_config
コード例 #2
0
def client_config():
    if not current_user.is_api_user() and current_user.is_authenticated:
        client_config = {
            'newVersionAvailable': get_latest_version(),
            'version': __version__
        }
    else:
        client_config = {}

    defaults = {
        'allowScriptsInUserInput': settings.ALLOW_SCRIPTS_IN_USER_INPUT,
        'showPermissionsControl': settings.FEATURE_SHOW_PERMISSIONS_CONTROL,
        'allowCustomJSVisualizations':
        settings.FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS,
        'autoPublishNamedQueries': settings.FEATURE_AUTO_PUBLISH_NAMED_QUERIES,
        'mailSettingsMissing': settings.MAIL_DEFAULT_SENDER is None,
        'dashboardRefreshIntervals': settings.DASHBOARD_REFRESH_INTERVALS,
        'queryRefreshIntervals': settings.QUERY_REFRESH_INTERVALS,
        'googleLoginEnabled': settings.GOOGLE_OAUTH_ENABLED,
    }

    client_config.update(defaults)
    client_config.update({'basePath': base_href()})
    client_config.update(date_format_config())

    return client_config
コード例 #3
0
ファイル: static.py プロジェクト: MullinsLab/redash
def index(**kwargs):
    email_md5 = hashlib.md5(current_user.email.lower()).hexdigest()
    gravatar_url = "https://www.gravatar.com/avatar/%s?s=40" % email_md5

    user = {
        'gravatar_url': gravatar_url,
        'id': current_user.id,
        'name': current_user.name,
        'email': current_user.email,
        'groups': current_user.groups,
        'permissions': current_user.permissions
    }

    client_config = {
        'newVersionAvailable': get_latest_version(),
        'version': __version__
    }

    client_config.update(settings.COMMON_CLIENT_CONFIG)

    headers = {
        'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate'
    }

    response = render_template("index.html",
                               user=json.dumps(user),
                               base_href=base_href(),
                               name=settings.NAME,
                               org_slug=current_org.slug,
                               client_config=json.dumps(client_config))

    return response, 200, headers
コード例 #4
0
ファイル: static.py プロジェクト: tdawber/redash
def index(**kwargs):
    email_md5 = hashlib.md5(current_user.email.lower()).hexdigest()
    gravatar_url = "https://www.gravatar.com/avatar/%s?s=40" % email_md5

    user = {
        'gravatar_url': gravatar_url,
        'id': current_user.id,
        'name': current_user.name,
        'email': current_user.email,
        'groups': current_user.groups,
        'permissions': current_user.permissions
    }

    client_config = {
        'newVersionAvailable': get_latest_version(),
        'version': __version__
    }

    client_config.update(settings.COMMON_CLIENT_CONFIG)

    headers = {
        'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate'
    }

    response = render_template("index.html",
                               user=json.dumps(user),
                               base_href=base_href(),
                               name=settings.NAME,
                               org_slug=current_org.slug,
                               client_config=json.dumps(client_config))

    return response, 200, headers
コード例 #5
0
ファイル: static.py プロジェクト: benmanns/redash
def index(**kwargs):
    email_md5 = hashlib.md5(current_user.email.lower()).hexdigest()
    gravatar_url = "https://www.gravatar.com/avatar/%s?s=40" % email_md5

    user = {
        "gravatar_url": gravatar_url,
        "id": current_user.id,
        "name": current_user.name,
        "email": current_user.email,
        "groups": current_user.groups,
        "permissions": current_user.permissions,
    }

    client_config = {"newVersionAvailable": get_latest_version(), "version": __version__}

    client_config.update(settings.COMMON_CLIENT_CONFIG)

    headers = {"Cache-Control": "no-cache, no-store, max-age=0, must-revalidate"}

    response = render_template(
        "index.html",
        user=json.dumps(user),
        base_href=base_href(),
        name=settings.NAME,
        org_slug=current_org.slug,
        client_config=json.dumps(client_config),
        analytics=settings.ANALYTICS,
    )

    return response, 200, headers
コード例 #6
0
def client_config():
    if not current_user.is_api_user() and current_user.is_authenticated:
        client_config = {
            'newVersionAvailable': bool(get_latest_version()),
            'version': __version__
        }
    else:
        client_config = {}

    defaults = {
        'allowScriptsInUserInput': settings.ALLOW_SCRIPTS_IN_USER_INPUT,
        'showPermissionsControl': current_org.get_setting("feature_show_permissions_control"),
        'allowCustomJSVisualizations': settings.FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS,
        'autoPublishNamedQueries': settings.FEATURE_AUTO_PUBLISH_NAMED_QUERIES,
        'extendedAlertOptions': settings.FEATURE_EXTENDED_ALERT_OPTIONS,
        'mailSettingsMissing': not settings.email_server_is_configured(),
        'dashboardRefreshIntervals': settings.DASHBOARD_REFRESH_INTERVALS,
        'queryRefreshIntervals': settings.QUERY_REFRESH_INTERVALS,
        'googleLoginEnabled': settings.GOOGLE_OAUTH_ENABLED,
        'pageSize': settings.PAGE_SIZE,
        'pageSizeOptions': settings.PAGE_SIZE_OPTIONS,
        'tableCellMaxJSONSize': settings.TABLE_CELL_MAX_JSON_SIZE,
    }

    client_config.update(defaults)
    client_config.update({
        'basePath': base_href()
    })
    client_config.update(date_time_format_config())
    client_config.update(number_format_config())

    return client_config
コード例 #7
0
ファイル: authentication.py プロジェクト: ariarijp/redash
def client_config():
    if not current_user.is_api_user() and current_user.is_authenticated:
        client_config = {
            'newVersionAvailable': bool(get_latest_version()),
            'version': __version__
        }
    else:
        client_config = {}

    defaults = {
        'allowScriptsInUserInput': settings.ALLOW_SCRIPTS_IN_USER_INPUT,
        'showPermissionsControl': current_org.get_setting("feature_show_permissions_control"),
        'allowCustomJSVisualizations': settings.FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS,
        'autoPublishNamedQueries': settings.FEATURE_AUTO_PUBLISH_NAMED_QUERIES,
        'mailSettingsMissing': not settings.email_server_is_configured(),
        'dashboardRefreshIntervals': settings.DASHBOARD_REFRESH_INTERVALS,
        'queryRefreshIntervals': settings.QUERY_REFRESH_INTERVALS,
        'googleLoginEnabled': settings.GOOGLE_OAUTH_ENABLED,
        'pageSize': settings.PAGE_SIZE,
        'pageSizeOptions': settings.PAGE_SIZE_OPTIONS,
        'tableCellMaxJSONSize': settings.TABLE_CELL_MAX_JSON_SIZE,
    }

    client_config.update(defaults)
    client_config.update({
        'basePath': base_href()
    })
    client_config.update(date_format_config())
    client_config.update(number_format_config())

    return client_config
コード例 #8
0
def client_config():
    if not current_user.is_api_user() and current_user.is_authenticated:
        client_config = {
            'newVersionAvailable': get_latest_version(),
            'version': __version__
        }
    else:
        client_config = {}

    date_format = current_org.get_setting('date_format')

    defaults = {
        'allowScriptsInUserInput': settings.ALLOW_SCRIPTS_IN_USER_INPUT,
        'showPermissionsControl': settings.FEATURE_SHOW_PERMISSIONS_CONTROL,
        'allowCustomJSVisualizations': settings.FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS,
        'autoPublishNamedQueries': settings.FEATURE_AUTO_PUBLISH_NAMED_QUERIES,
        'dateFormat': date_format,
        'dateTimeFormat': "{0} HH:mm".format(date_format),
        'mailSettingsMissing': settings.MAIL_DEFAULT_SENDER is None
    }

    client_config.update(defaults)
    client_config.update({
        'basePath': base_href()
    })

    return client_config
コード例 #9
0
ファイル: static.py プロジェクト: carezone/redash
def index(**kwargs):
    email_md5 = hashlib.md5(current_user.email.lower()).hexdigest()
    gravatar_url = "https://www.gravatar.com/avatar/%s?s=40" % email_md5

    user = {
        'gravatar_url': gravatar_url,
        'id': current_user.id,
        'name': current_user.name,
        'email': current_user.email,
        'groups': current_user.groups,
        'permissions': current_user.permissions
    }

    client_config = {
        'clientSideMetrics': settings.CLIENT_SIDE_METRICS,
        'allowScriptsInUserInput': settings.ALLOW_SCRIPTS_IN_USER_INPUT,
        'highChartsTurboThreshold': settings.HIGHCHARTS_TURBO_THRESHOLD,
        'dateFormat': settings.DATE_FORMAT,
        'dateTimeFormat': "{0} HH:mm".format(settings.DATE_FORMAT),
        'newVersionAvailable': get_latest_version(),
        'version': __version__
    }

    return render_template("index.html", user=json.dumps(user), name=settings.NAME,
                           client_config=json.dumps(client_config),
                           analytics=settings.ANALYTICS)
コード例 #10
0
def client_config():
    if not current_user.is_api_user() and current_user.is_authenticated:
        client_config = {
            "newVersionAvailable": bool(get_latest_version()),
            "version": __version__,
        }
    else:
        client_config = {}

    if (current_user.has_permission("admin")
            and current_org.get_setting("beacon_consent") is None):
        client_config["showBeaconConsentMessage"] = True

    defaults = {
        "allowScriptsInUserInput":
        settings.ALLOW_SCRIPTS_IN_USER_INPUT,
        "showPermissionsControl":
        current_org.get_setting("feature_show_permissions_control"),
        "hidePlotlyModeBar":
        current_org.get_setting("hide_plotly_mode_bar"),
        "disablePublicUrls":
        current_org.get_setting("disable_public_urls"),
        "disableEmbedUrls":
        current_org.get_setting("disable_embed_urls"),
        "allowCustomJSVisualizations":
        settings.FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS,
        "autoPublishNamedQueries":
        settings.FEATURE_AUTO_PUBLISH_NAMED_QUERIES,
        "extendedAlertOptions":
        settings.FEATURE_EXTENDED_ALERT_OPTIONS,
        "mailSettingsMissing":
        not settings.email_server_is_configured(),
        "dashboardRefreshIntervals":
        settings.DASHBOARD_REFRESH_INTERVALS,
        "queryRefreshIntervals":
        settings.QUERY_REFRESH_INTERVALS,
        "googleLoginEnabled":
        settings.GOOGLE_OAUTH_ENABLED,
        "microsoftLoginEnabled":
        settings.MICROSOFT_OAUTH_ENABLED,
        "ldapLoginEnabled":
        settings.LDAP_LOGIN_ENABLED,
        "pageSize":
        settings.PAGE_SIZE,
        "pageSizeOptions":
        settings.PAGE_SIZE_OPTIONS,
        "tableCellMaxJSONSize":
        settings.TABLE_CELL_MAX_JSON_SIZE,
    }

    client_config.update(defaults)
    client_config.update({"basePath": base_href()})
    client_config.update(date_time_format_config())
    client_config.update(number_format_config())

    return client_config
コード例 #11
0
ファイル: authentication.py プロジェクト: vishesh92/redash
def client_config():
    if not current_user.is_api_user() and current_user.is_authenticated:
        client_config = {
            'newVersionAvailable': get_latest_version(),
            'version': __version__
        }
    else:
        client_config = {}

    client_config.update(settings.COMMON_CLIENT_CONFIG)
    client_config.update({'basePath': base_href()})

    return client_config
コード例 #12
0
def client_config():
    if not isinstance(current_user._get_current_object(),
                      models.ApiUser) and current_user.is_authenticated:
        client_config = {
            'newVersionAvailable': get_latest_version(),
            'version': __version__
        }
    else:
        client_config = {}

    client_config.update(settings.COMMON_CLIENT_CONFIG)
    client_config.update({'basePath': base_href()})

    return client_config
コード例 #13
0
ファイル: authentication.py プロジェクト: vishesh92/redash
def client_config():
    if not current_user.is_api_user() and current_user.is_authenticated:
        client_config = {
            'newVersionAvailable': get_latest_version(),
            'version': __version__
        }
    else:
        client_config = {}

    client_config.update(settings.COMMON_CLIENT_CONFIG)
    client_config.update({
        'basePath': base_href()
    })

    return client_config
コード例 #14
0
ファイル: static.py プロジェクト: johnkabler/redash
def index(**kwargs):
    email_md5 = hashlib.md5(current_user.email.lower()).hexdigest()
    gravatar_url = "https://www.gravatar.com/avatar/%s?s=40" % email_md5

    user = {
        'gravatar_url': gravatar_url,
        'id': current_user.id,
        'name': current_user.name,
        'email': current_user.email,
        'groups': current_user.groups,
        'permissions': current_user.permissions
    }

    client_config = {
        'newVersionAvailable': get_latest_version(),
        'version': __version__
    }
    client_config.update(settings.COMMON_CLIENT_CONFIG)

    return render_template("index.html", user=json.dumps(user), name=settings.NAME,
                           client_config=json.dumps(client_config),
                           analytics=settings.ANALYTICS)
コード例 #15
0
def index(**kwargs):
    email_md5 = hashlib.md5(current_user.email.lower()).hexdigest()
    gravatar_url = "https://www.gravatar.com/avatar/%s?s=40" % email_md5

    user = {
        'gravatar_url': gravatar_url,
        'id': current_user.id,
        'name': current_user.name,
        'email': current_user.email,
        'groups': current_user.groups,
        'permissions': current_user.permissions
    }

    client_config = {
        'newVersionAvailable': get_latest_version(),
        'version': __version__
    }
    client_config.update(settings.COMMON_CLIENT_CONFIG)

    return render_template("index.html",
                           user=json.dumps(user),
                           name=settings.NAME,
                           client_config=json.dumps(client_config),
                           analytics=settings.ANALYTICS)