From 79fe18d9e7290fb880f1feb5f2c9f3f96b2d74fe Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 17 Dec 2015 14:24:43 +0100 Subject: Move build artifacts implementation to separate controller --- app/controllers/projects/builds_controller.rb | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'app/controllers/projects/builds_controller.rb') diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index 39d3ba26ba2..0e965966ffa 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -2,7 +2,6 @@ class Projects::BuildsController < Projects::ApplicationController before_action :build, except: [:index, :cancel_all] before_action :authorize_manage_builds!, except: [:index, :show, :status] - before_action :authorize_download_build_artifacts!, only: [:download] layout "project" @@ -51,18 +50,6 @@ class Projects::BuildsController < Projects::ApplicationController redirect_to build_path(build) end - def download - unless artifacts_file.file_storage? - return redirect_to artifacts_file.url - end - - unless artifacts_file.exists? - return not_found! - end - - send_file artifacts_file.path, disposition: 'attachment' - end - def status render json: @build.to_json(only: [:status, :id, :sha, :coverage], methods: :sha) end @@ -79,10 +66,6 @@ class Projects::BuildsController < Projects::ApplicationController @build ||= project.builds.unscoped.find_by!(id: params[:id]) end - def artifacts_file - build.artifacts_file - end - def build_path(build) namespace_project_build_path(build.project.namespace, build.project, build) end @@ -92,14 +75,4 @@ class Projects::BuildsController < Projects::ApplicationController return page_404 end end - - def authorize_download_build_artifacts! - unless can?(current_user, :download_build_artifacts, @project) - if current_user.nil? - return authenticate_user! - else - return render_404 - end - end - end end -- cgit v1.2.1 From f66f9e95bf1e67ad13de9958d16103b858b58e72 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 15 Jan 2016 02:29:34 -0800 Subject: Give reporters the ability to download artifacts. Also fix a few places where page_404 should be render_404. --- app/controllers/projects/builds_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/projects/builds_controller.rb') diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index 0e965966ffa..92d9699fe84 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -42,7 +42,7 @@ class Projects::BuildsController < Projects::ApplicationController def retry unless @build.retryable? - return page_404 + return render_404 end build = Ci::Build.retry(@build) @@ -72,7 +72,7 @@ class Projects::BuildsController < Projects::ApplicationController def authorize_manage_builds! unless can?(current_user, :manage_builds, project) - return page_404 + return render_404 end end end -- cgit v1.2.1