Remove user_can_download_artifacts

It was actually not used anywhere.
This commit is contained in:
Toon Claes 2017-03-07 21:08:45 +01:00
parent 901fbda67c
commit ae9218a7fd
2 changed files with 16 additions and 32 deletions

View file

@ -38,8 +38,7 @@ module API
builds = user_project.builds.order('id DESC') builds = user_project.builds.order('id DESC')
builds = filter_builds(builds, params[:scope]) builds = filter_builds(builds, params[:scope])
present paginate(builds), with: Entities::Job, present paginate(builds), with: Entities::Job
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Get pipeline jobs' do desc 'Get pipeline jobs' do
@ -55,8 +54,7 @@ module API
builds = pipeline.builds builds = pipeline.builds
builds = filter_builds(builds, params[:scope]) builds = filter_builds(builds, params[:scope])
present paginate(builds), with: Entities::Job, present paginate(builds), with: Entities::Job
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Get a specific job of a project' do desc 'Get a specific job of a project' do
@ -70,8 +68,7 @@ module API
build = get_build!(params[:job_id]) build = get_build!(params[:job_id])
present build, with: Entities::Job, present build, with: Entities::Job
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Download the artifacts file from a job' do desc 'Download the artifacts file from a job' do
@ -138,8 +135,7 @@ module API
build.cancel build.cancel
present build, with: Entities::Job, present build, with: Entities::Job
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Retry a specific build of a project' do desc 'Retry a specific build of a project' do
@ -156,8 +152,7 @@ module API
build = Ci::Build.retry(build, current_user) build = Ci::Build.retry(build, current_user)
present build, with: Entities::Job, present build, with: Entities::Job
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Erase job (remove artifacts and the trace)' do desc 'Erase job (remove artifacts and the trace)' do
@ -173,8 +168,7 @@ module API
return forbidden!('Job is not erasable!') unless build.erasable? return forbidden!('Job is not erasable!') unless build.erasable?
build.erase(erased_by: current_user) build.erase(erased_by: current_user)
present build, with: Entities::Job, present build, with: Entities::Job
user_can_download_artifacts: can?(current_user, :download_build_artifacts, user_project)
end end
desc 'Keep the artifacts to prevent them from being deleted' do desc 'Keep the artifacts to prevent them from being deleted' do
@ -192,8 +186,7 @@ module API
build.keep_artifacts! build.keep_artifacts!
status 200 status 200
present build, with: Entities::Job, present build, with: Entities::Job
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Trigger a manual job' do desc 'Trigger a manual job' do
@ -213,8 +206,7 @@ module API
build.play(current_user) build.play(current_user)
status 200 status 200
present build, with: Entities::Job, present build, with: Entities::Job
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
end end

View file

@ -36,8 +36,7 @@ module API
builds = user_project.builds.order('id DESC') builds = user_project.builds.order('id DESC')
builds = filter_builds(builds, params[:scope]) builds = filter_builds(builds, params[:scope])
present paginate(builds), with: ::API::V3::Entities::Build, present paginate(builds), with: ::API::V3::Entities::Build
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Get builds for a specific commit of a project' do desc 'Get builds for a specific commit of a project' do
@ -57,8 +56,7 @@ module API
builds = user_project.builds.where(pipeline: pipelines).order('id DESC') builds = user_project.builds.where(pipeline: pipelines).order('id DESC')
builds = filter_builds(builds, params[:scope]) builds = filter_builds(builds, params[:scope])
present paginate(builds), with: ::API::V3::Entities::Build, present paginate(builds), with: ::API::V3::Entities::Build
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Get a specific build of a project' do desc 'Get a specific build of a project' do
@ -72,8 +70,7 @@ module API
build = get_build!(params[:build_id]) build = get_build!(params[:build_id])
present build, with: ::API::V3::Entities::Build, present build, with: ::API::V3::Entities::Build
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Download the artifacts file from build' do desc 'Download the artifacts file from build' do
@ -140,8 +137,7 @@ module API
build.cancel build.cancel
present build, with: ::API::V3::Entities::Build, present build, with: ::API::V3::Entities::Build
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Retry a specific build of a project' do desc 'Retry a specific build of a project' do
@ -158,8 +154,7 @@ module API
build = Ci::Build.retry(build, current_user) build = Ci::Build.retry(build, current_user)
present build, with: ::API::V3::Entities::Build, present build, with: ::API::V3::Entities::Build
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Erase build (remove artifacts and build trace)' do desc 'Erase build (remove artifacts and build trace)' do
@ -175,8 +170,7 @@ module API
return forbidden!('Build is not erasable!') unless build.erasable? return forbidden!('Build is not erasable!') unless build.erasable?
build.erase(erased_by: current_user) build.erase(erased_by: current_user)
present build, with: ::API::V3::Entities::Build, present build, with: ::API::V3::Entities::Build
user_can_download_artifacts: can?(current_user, :download_build_artifacts, user_project)
end end
desc 'Keep the artifacts to prevent them from being deleted' do desc 'Keep the artifacts to prevent them from being deleted' do
@ -194,8 +188,7 @@ module API
build.keep_artifacts! build.keep_artifacts!
status 200 status 200
present build, with: ::API::V3::Entities::Build, present build, with: ::API::V3::Entities::Build
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
desc 'Trigger a manual build' do desc 'Trigger a manual build' do
@ -215,8 +208,7 @@ module API
build.play(current_user) build.play(current_user)
status 200 status 200
present build, with: ::API::V3::Entities::Build, present build, with: ::API::V3::Entities::Build
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end end
end end