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
This commit is contained in:
Joseph Schorr 2018-03-16 13:03:42 -04:00
parent 32a473d23c
commit 86f898d9bd
3 changed files with 7 additions and 6 deletions

View File

@ -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):

View File

@ -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', ''),

View File

@ -112,9 +112,9 @@
<tr ng-repeat="(scopeName, scopeInfo) in OAuthService.SCOPES">
<td>
<label onclick="event.stopPropagation()">
<input type="checkbox" value="scopeInfo[0]" ng-model="genScopes[scopeName]">{{ scopeInfo[3] }}
<input type="checkbox" value="scopeInfo.scope" ng-model="genScopes[scopeName]">{{ scopeInfo.title }}
</label>
<div class="scope-description">{{ scopeInfo[4] }}</div>
<div class="scope-description">{{ scopeInfo.description }}</div>
</td>
</tr>
</table>