Public building repositories should allow users to see the build status
This commit is contained in:
parent
335733ad68
commit
96e15d285d
1 changed files with 5 additions and 4 deletions
|
@ -1161,12 +1161,13 @@ def get_repo(namespace, repository):
|
||||||
|
|
||||||
|
|
||||||
@api.route('/repository/<path:repository>/build/', methods=['GET'])
|
@api.route('/repository/<path:repository>/build/', methods=['GET'])
|
||||||
@api_login_required
|
|
||||||
@parse_repository_name
|
@parse_repository_name
|
||||||
def get_repo_builds(namespace, repository):
|
def get_repo_builds(namespace, repository):
|
||||||
permission = ModifyRepositoryPermission(namespace, repository)
|
permission = ReadRepositoryPermission(namespace, repository)
|
||||||
if permission.can():
|
is_public = model.repository_is_public(namespace, repository)
|
||||||
|
if permission.can() or is_public:
|
||||||
def build_view(build_obj):
|
def build_view(build_obj):
|
||||||
|
# TODO(jake): Filter these logs if the current user can only *read* the repo.
|
||||||
if build_obj.status_url:
|
if build_obj.status_url:
|
||||||
# Delegate the status to the build node
|
# Delegate the status to the build node
|
||||||
node_status = requests.get(build_obj.status_url).json()
|
node_status = requests.get(build_obj.status_url).json()
|
||||||
|
@ -1190,7 +1191,7 @@ def get_repo_builds(namespace, repository):
|
||||||
'builds': [build_view(build) for build in builds]
|
'builds': [build_view(build) for build in builds]
|
||||||
})
|
})
|
||||||
|
|
||||||
abort(403) # Permissions denied
|
abort(403) # Permission denied
|
||||||
|
|
||||||
|
|
||||||
@api.route('/repository/<path:repository>/build/', methods=['POST'])
|
@api.route('/repository/<path:repository>/build/', methods=['POST'])
|
||||||
|
|
Reference in a new issue