Work in progress: Start on marking user permissions on whether they are inside or outside the repo's org
This commit is contained in:
parent
9fa77aaa48
commit
5ed85cf833
1 changed files with 7 additions and 5 deletions
|
@ -501,9 +501,11 @@ def request_repo_build(namespace, repository):
|
|||
abort(403) # Permissions denied
|
||||
|
||||
|
||||
def role_view(repo_perm_obj):
|
||||
def user_role_view(repo_perm_obj, username):
|
||||
# TODO: Determine whether the user is outside of the organization.
|
||||
return {
|
||||
'role': repo_perm_obj.role.name
|
||||
'role': repo_perm_obj.role.name,
|
||||
'outside_org': False
|
||||
}
|
||||
|
||||
|
||||
|
@ -593,7 +595,7 @@ def list_repo_permissions(namespace, repository):
|
|||
repo_perms = model.get_all_repo_users(namespace, repository)
|
||||
|
||||
return jsonify({
|
||||
'permissions': {repo_perm.user.username: role_view(repo_perm)
|
||||
'permissions': {repo_perm.user.username: user_role_view(repo_perm, repo_perm.user.username)
|
||||
for repo_perm in repo_perms}
|
||||
})
|
||||
|
||||
|
@ -610,7 +612,7 @@ def get_permissions(namespace, repository, username):
|
|||
permission = AdministerRepositoryPermission(namespace, repository)
|
||||
if permission.can():
|
||||
perm = model.get_user_reponame_permission(username, namespace, repository)
|
||||
return jsonify(role_view(perm))
|
||||
return jsonify(user_role_view(perm, username))
|
||||
|
||||
abort(403) # Permission denied
|
||||
|
||||
|
@ -634,7 +636,7 @@ def change_permissions(namespace, repository, username):
|
|||
logger.warning('User tried to remove themselves as admin.')
|
||||
abort(409)
|
||||
|
||||
resp = jsonify(role_view(perm))
|
||||
resp = jsonify(user_role_view(perm, username))
|
||||
if request.method == 'POST':
|
||||
resp.status_code = 201
|
||||
return resp
|
||||
|
|
Reference in a new issue