From 3da5a77e33432034813529f4c014346894985387 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 21 Jan 2014 18:34:54 -0500 Subject: [PATCH] Add support for org-wide default permissions --- endpoints/api.py | 14 +++++---- static/css/quay.css | 7 +++++ static/directives/prototype-manager.html | 36 +++++++++++++++++++----- static/js/app.js | 12 +++++++- 4 files changed, 56 insertions(+), 13 deletions(-) diff --git a/endpoints/api.py b/endpoints/api.py index 64519af41..f1a7e8869 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -559,7 +559,7 @@ def prototype_view(proto, org_members): } return { - 'activating_user': prototype_user_view(proto.activating_user), + 'activating_user': prototype_user_view(proto.activating_user) if proto.activating_user else None, 'delegate': delegate_view, 'role': proto.role.name, 'id': proto.uuid, @@ -588,7 +588,7 @@ def log_prototype_action(action_kind, orgname, prototype, **kwargs): log_params = { 'prototypeid': prototype.uuid, 'username': username, - 'activating_username': prototype.activating_user.username, + 'activating_username': prototype.activating_user.username if prototype.activating_user else None, 'role': prototype.role.name } @@ -614,7 +614,10 @@ def create_organization_prototype_permission(orgname): abort(404) details = request.get_json() - activating_username = details['activating_user']['name'] + activating_username = None + + if 'activating_user' in details and details['activating_user'] and 'name' in details['activating_user']: + activating_username = details['activating_user']['name'] delegate = details['delegate'] delegate_kind = delegate['kind'] @@ -623,13 +626,14 @@ def create_organization_prototype_permission(orgname): delegate_username = delegate_name if delegate_kind == 'user' else None delegate_teamname = delegate_name if delegate_kind == 'team' else None - activating_user = model.get_user(activating_username) + activating_user = (model.get_user(activating_username) + if activating_username else None) delegate_user = (model.get_user(delegate_username) if delegate_username else None) delegate_team = (model.get_organization_team(orgname, delegate_teamname) if delegate_teamname else None) - if not activating_user: + if activating_username and not activating_user: abort(404) if not delegate_user and not delegate_team: diff --git a/static/css/quay.css b/static/css/quay.css index bbe875230..1fe07fddc 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -54,6 +54,13 @@ transition: opacity 1s ease-in-out; } +.super-option { + border: 1px solid #ddd; + border-radius: 10px; + background: #eee; + margin-bottom: 26px; +} + .small-spinner { display: inline-block; width: 14px; diff --git a/static/directives/prototype-manager.html b/static/directives/prototype-manager.html index f00748e69..c8b07f594 100644 --- a/static/directives/prototype-manager.html +++ b/static/directives/prototype-manager.html @@ -16,9 +16,10 @@ - - +
- - Creating User/Robot + Repository Creator @@ -31,9 +32,14 @@
- +
+ + + + (Organization Default) + @@ -60,8 +66,24 @@