From 86f898d9bd2e6600731b3c8ad4eb2cea04b4f29a Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 16 Mar 2018 13:03:42 -0400 Subject: [PATCH] Fix OAuth scopes display Before, we were sending the wrong kind of data (namedtuple instead of dict) in the non-superuser case, which broke prod. Now, we always explicitly send a standard dictionary. Fixes https://jira.coreos.com/browse/QUAY-871 --- auth/scopes.py | 5 ++--- endpoints/common.py | 4 +++- static/partials/manage-application.html | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/auth/scopes.py b/auth/scopes.py index c41ad7033..dbbb0ae1c 100644 --- a/auth/scopes.py +++ b/auth/scopes.py @@ -96,11 +96,10 @@ IMPLIED_SCOPES = { def app_scopes(app_config): + scopes_from_config = dict(ALL_SCOPES) if not app_config.get('FEATURE_SUPER_USERS', False): - scopes_from_config = dict(ALL_SCOPES) del scopes_from_config[SUPERUSER.scope] - return scopes_from_config - return ALL_SCOPES + return scopes_from_config def scopes_from_scope_string(scopes): diff --git a/endpoints/common.py b/endpoints/common.py index 77a19b39f..355817dce 100644 --- a/endpoints/common.py +++ b/endpoints/common.py @@ -115,6 +115,8 @@ def render_page_template(name, route_data=None, **kwargs): if not features.BILLING: version_number = 'Quay %s' % __version__ + scopes_set = {scope.scope: scope._asdict() for scope in scopes.app_scopes(app.config).values()} + contents = render_template(name, route_data=route_data, external_styles=external_styles, @@ -124,7 +126,7 @@ def render_page_template(name, route_data=None, **kwargs): config_set=frontend_visible_config(app.config), oauth_set=get_oauth_config(), external_login_set=get_external_login_config(), - scope_set=scopes.app_scopes(app.config), + scope_set=scopes_set, vuln_priority_set=PRIORITY_LEVELS, enterprise_logo=app.config.get('ENTERPRISE_LOGO_URL', ''), mixpanel_key=app.config.get('MIXPANEL_KEY', ''), diff --git a/static/partials/manage-application.html b/static/partials/manage-application.html index 52264bd45..90bb4dc5c 100644 --- a/static/partials/manage-application.html +++ b/static/partials/manage-application.html @@ -112,9 +112,9 @@ -
{{ scopeInfo[4] }}
+
{{ scopeInfo.description }}