diff options
author | Constance Okoghenun <constanceokoghenun@gmail.com> | 2018-11-05 10:33:05 +0100 |
---|---|---|
committer | Constance Okoghenun <constanceokoghenun@gmail.com> | 2018-11-05 10:33:05 +0100 |
commit | 3bac1a322c82dd9b6e9b23edd66fa45afaa9859f (patch) | |
tree | d3e7d47a3e0c8047cb2972aefbc12fe1e3080ef8 /app/controllers/projects/clusters/applications_controller.rb | |
parent | fe7b6f57120946a5d5fe4a4d54a245dc76b06dc8 (diff) | |
parent | 9e2eb85e365e2a33e52e3f1f48cc23ad4201a52b (diff) | |
download | gitlab-ce-issue_51323.tar.gz |
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into issue_51323issue_51323
Diffstat (limited to 'app/controllers/projects/clusters/applications_controller.rb')
-rw-r--r-- | app/controllers/projects/clusters/applications_controller.rb | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/app/controllers/projects/clusters/applications_controller.rb b/app/controllers/projects/clusters/applications_controller.rb index bcea96bce94..c7b6218d007 100644 --- a/app/controllers/projects/clusters/applications_controller.rb +++ b/app/controllers/projects/clusters/applications_controller.rb @@ -1,29 +1,17 @@ # frozen_string_literal: true -class Projects::Clusters::ApplicationsController < Projects::ApplicationController - before_action :cluster - before_action :authorize_read_cluster! - before_action :authorize_create_cluster!, only: [:create] +class Projects::Clusters::ApplicationsController < Clusters::ApplicationsController + include ProjectUnauthorized - def create - Clusters::Applications::CreateService - .new(@cluster, current_user, create_cluster_application_params) - .execute(request) - - head :no_content - rescue Clusters::Applications::CreateService::InvalidApplicationError - render_404 - rescue StandardError - head :bad_request - end + prepend_before_action :project private - def cluster - @cluster ||= project.clusters.find(params[:id]) || render_404 + def clusterable + @clusterable ||= ClusterablePresenter.fabricate(project, current_user: current_user) end - def create_cluster_application_params - params.permit(:application, :hostname) + def project + @project ||= find_routable!(Project, File.join(params[:namespace_id], params[:project_id]), not_found_or_authorized_proc: project_unauthorized_proc) end end |