diff --git a/auth/scopes.py b/auth/scopes.py index 6ab4f811a..932541969 100644 --- a/auth/scopes.py +++ b/auth/scopes.py @@ -43,7 +43,7 @@ READ_USER = Scope(scope= 'user:read', 'username and email address.')) ORG_ADMIN = Scope(scope='org:admin', - icon='fa-exclamation-triangle', + icon='fa-gear', dangerous=True, title='Administer Organization', description=('This application will be able to administer your organizations ' @@ -103,6 +103,7 @@ def get_scope_information(scopes_string): 'scope': scope.scope, 'description': scope.description, 'icon': scope.icon, + 'dangerous': scope.dangerous, }) return scope_info diff --git a/endpoints/web.py b/endpoints/web.py index 07ef3ffb0..fd6db64ca 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -374,7 +374,10 @@ def request_authorization_code(): } # Show the authorization page. - return render_page_template('oauthorize.html', scopes=scope_info, application=oauth_app_view, + has_dangerous_scopes = bool([scope for scope in scope_info if scope['dangerous']]) + return render_page_template('oauthorize.html', scopes=scope_info, + has_dangerous_scopes=has_dangerous_scopes, + application=oauth_app_view, enumerate=enumerate, client_id=client_id, redirect_uri=redirect_uri, scope=scope, csrf_token_val=generate_csrf_token()) diff --git a/static/css/quay.css b/static/css/quay.css index 431927b47..f095d275d 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -3988,6 +3988,12 @@ pre.command:before { max-width: 500px; } +.auth-scopes .scope .fa-exclamation-triangle { + color: orange; + margin-left: 16px; + display: inline-block; +} + .auth-scopes .scope-container:last-child { border-bottom: 0px; } diff --git a/templates/oauthorize.html b/templates/oauthorize.html index 858692ec0..dd3d0f29c 100644 --- a/templates/oauthorize.html +++ b/templates/oauthorize.html @@ -25,22 +25,33 @@
This application would like permission to:
{% for index, scope in enumerate(scopes) %} -
+

-

-
+
+ {% if scope.dangerous %} +
Warning! This scope grants a lot of power. Be careful when authorizing it!
+ {% endif %} + {{ scope.description }}
@@ -50,13 +61,18 @@
+ {% if has_dangerous_scopes %} + + {% else %}
-
+
+ {% endif %} +
@@ -65,4 +81,40 @@
+ + + + + + {% endblock %}