Skip to content

Commit

Permalink
Add check for previously existing staging workflow
Browse files Browse the repository at this point in the history
Verification of a previously existing staging workflow for a project was missing
on staging workflow creation.

Fixes #8714.

Co-authored-by: David Kang <dkang@suse.com>
Co-authored-by: Saray Cabrera Padrón <scabrerapadron@suse.de>
  • Loading branch information
3 people committed Nov 15, 2019
1 parent 080ce71 commit c1cd338
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/api/app/controllers/staging/workflows_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Staging::WorkflowsController < Staging::StagingController
before_action :require_login
before_action :set_project
before_action :check_staging_workflow, only: :create
before_action :set_staging_workflow, only: [:update, :destroy]
after_action :verify_authorized

Expand Down Expand Up @@ -50,6 +51,16 @@ def update

private

def check_staging_workflow
return unless @project.staging

render_error(
status: 400,
errorcode: 'staging_workflow_exists',
message: "Project #{@project} already has an associated Staging Workflow with id: #{@project.staging.id}"
)
end

def xml_hash
Xmlhash.parse(request.body.read) || {}
end
Expand Down

0 comments on commit c1cd338

Please sign in to comment.