From 4578ee9a75a326eea77d0f2e84737ebcfda3fdcc Mon Sep 17 00:00:00 2001 From: radhika Date: Mon, 6 Oct 2014 16:27:25 -0400 Subject: [PATCH] 3990: set owner_uuid of a copied pipeline instance to that of the source, provided it is a project and writable by the current user. --- .../app/controllers/pipeline_instances_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb index 27e8f5b51b..ce3befae06 100644 --- a/apps/workbench/app/controllers/pipeline_instances_controller.rb +++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb @@ -47,6 +47,13 @@ class PipelineInstancesController < ApplicationController component.delete :job end @object.state = 'New' + + # set owner_uuid to that of source, provided it is wriable by current user + current_project = Group.find(source.owner_uuid) rescue nil + if (current_project && current_project.writable_by.andand.include?(current_user.uuid)) + @object.owner_uuid = source.owner_uuid + end + super end -- 2.30.2