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:
parent
32a473d23c
commit
86f898d9bd
3 changed files with 7 additions and 6 deletions
|
@ -96,11 +96,10 @@ IMPLIED_SCOPES = {
|
||||||
|
|
||||||
|
|
||||||
def app_scopes(app_config):
|
def app_scopes(app_config):
|
||||||
|
scopes_from_config = dict(ALL_SCOPES)
|
||||||
if not app_config.get('FEATURE_SUPER_USERS', False):
|
if not app_config.get('FEATURE_SUPER_USERS', False):
|
||||||
scopes_from_config = dict(ALL_SCOPES)
|
|
||||||
del scopes_from_config[SUPERUSER.scope]
|
del scopes_from_config[SUPERUSER.scope]
|
||||||
return scopes_from_config
|
return scopes_from_config
|
||||||
return ALL_SCOPES
|
|
||||||
|
|
||||||
|
|
||||||
def scopes_from_scope_string(scopes):
|
def scopes_from_scope_string(scopes):
|
||||||
|
|
|
@ -115,6 +115,8 @@ def render_page_template(name, route_data=None, **kwargs):
|
||||||
if not features.BILLING:
|
if not features.BILLING:
|
||||||
version_number = 'Quay %s' % __version__
|
version_number = 'Quay %s' % __version__
|
||||||
|
|
||||||
|
scopes_set = {scope.scope: scope._asdict() for scope in scopes.app_scopes(app.config).values()}
|
||||||
|
|
||||||
contents = render_template(name,
|
contents = render_template(name,
|
||||||
route_data=route_data,
|
route_data=route_data,
|
||||||
external_styles=external_styles,
|
external_styles=external_styles,
|
||||||
|
@ -124,7 +126,7 @@ def render_page_template(name, route_data=None, **kwargs):
|
||||||
config_set=frontend_visible_config(app.config),
|
config_set=frontend_visible_config(app.config),
|
||||||
oauth_set=get_oauth_config(),
|
oauth_set=get_oauth_config(),
|
||||||
external_login_set=get_external_login_config(),
|
external_login_set=get_external_login_config(),
|
||||||
scope_set=scopes.app_scopes(app.config),
|
scope_set=scopes_set,
|
||||||
vuln_priority_set=PRIORITY_LEVELS,
|
vuln_priority_set=PRIORITY_LEVELS,
|
||||||
enterprise_logo=app.config.get('ENTERPRISE_LOGO_URL', ''),
|
enterprise_logo=app.config.get('ENTERPRISE_LOGO_URL', ''),
|
||||||
mixpanel_key=app.config.get('MIXPANEL_KEY', ''),
|
mixpanel_key=app.config.get('MIXPANEL_KEY', ''),
|
||||||
|
|
|
@ -112,9 +112,9 @@
|
||||||
<tr ng-repeat="(scopeName, scopeInfo) in OAuthService.SCOPES">
|
<tr ng-repeat="(scopeName, scopeInfo) in OAuthService.SCOPES">
|
||||||
<td>
|
<td>
|
||||||
<label onclick="event.stopPropagation()">
|
<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>
|
</label>
|
||||||
<div class="scope-description">{{ scopeInfo[4] }}</div>
|
<div class="scope-description">{{ scopeInfo.description }}</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
Reference in a new issue