Bug fixes:
- Report proper errors when trying to change permissions - Turn off the auto-caps of the team names - Fix the is_org_member checks everywhere - Fix resetting of roles if the change was not successful
This commit is contained in:
parent
9f1bf1499d
commit
be0fba276f
6 changed files with 46 additions and 23 deletions
|
@ -1012,6 +1012,13 @@ def change_user_permissions(namespace, repository, username):
|
|||
except model.InvalidOrganizationException:
|
||||
# This repository is not part of an organization
|
||||
pass
|
||||
except model.DataModelException as ex:
|
||||
error_resp = jsonify({
|
||||
'message': ex.message,
|
||||
})
|
||||
error_resp.status_code = 400
|
||||
return error_resp
|
||||
|
||||
|
||||
resp = jsonify(perm_view)
|
||||
if request.method == 'POST':
|
||||
|
@ -1051,7 +1058,15 @@ def change_team_permissions(namespace, repository, teamname):
|
|||
def delete_user_permissions(namespace, repository, username):
|
||||
permission = AdministerRepositoryPermission(namespace, repository)
|
||||
if permission.can():
|
||||
model.delete_user_permission(username, namespace, repository)
|
||||
try:
|
||||
model.delete_user_permission(username, namespace, repository)
|
||||
except model.DataModelException as ex:
|
||||
error_resp = jsonify({
|
||||
'message': ex.message,
|
||||
})
|
||||
error_resp.status_code = 400
|
||||
return error_resp
|
||||
|
||||
return make_response('Deleted', 204)
|
||||
|
||||
abort(403) # Permission denied
|
||||
|
|
Reference in a new issue