apps/workbench/app/controllers/actions_controller.rb
# Skip require_thread_api_token if this is a show action
# for an object uuid that supports anonymous access.
Skip require_thread_api_token if this is a show action
for an object uuid that supports anonymous access.
Skip require_thread_api_token if this is a show action for an object uuid that supports anonymous access .
def move_or_copy action
    uuids_to_add = params["selection"]
    uuids_to_add = [ uuids_to_add ] unless uuids_to_add.is_a? Array
    resource_classes = uuids_to_add.
      collect { |x| ArvadosBase::resource_class_for_uuid(x) }.
      uniq
    resource_classes.each do |resource_class|
      resource_class.filter([['uuid','in',uuids_to_add]]).each do |src|
        if resource_class == Collection and not Collection.attribute_info.include?(:name)
          dst = Link.new(owner_uuid: @object.uuid,
                         tail_uuid: @object.uuid,
                         head_uuid: src.uuid,
                         link_class: 'name',
                         name: src.uuid)
        else
          case action
          when :copy
            dst = src.dup
            if dst.respond_to? :'name='
              if dst.name
                dst.name = "Copy of #{dst.name}"
              else
                dst.name = "Copy of unnamed #{dst.class_for_display.downcase}"
              end
            end
            if resource_class == Collection
              dst.manifest_text = Collection.select([:manifest_text]).where(uuid: src.uuid).with_count("none").first.manifest_text
            end
          when :move
            dst = src
          else
            raise ArgumentError.new "Unsupported action #{action}"
          end
          dst.owner_uuid = @object.uuid
          dst.tail_uuid = @object.uuid if dst.class == Link
        end
        begin
          dst.save!
        rescue
          dst.name += " (#{Time.now.localtime})" if dst.respond_to? :name=
          dst.save!
        end
      end
    end
    if (resource_classes == [Collection] and
        @object.is_a? Group and
        @object.group_class == 'project') or
        @object.is_a? User
      redirect_to project_url(@object.uuid, anchor: 'Data_collections')
    else
      redirect_to @object
    end
  end
def move_or_copy action uuids_to_add = params [ "selection" ] uuids_to_add = [ uuids_to_add ] unless uuids_to_add . is_a? Array resource_classes = uuids_to_add . collect { | x | ArvadosBase :: resource_class_for_uuid ( x ) } . uniq resource_classes . each do | resource_class | resource_class . filter ( [ [ 'uuid' , 'in' , uuids_to_add ] ] ) . each do | src | if resource_class == Collection and not Collection . attribute_info . include? ( :name ) dst = Link . new ( owner_uuid : @object . uuid , tail_uuid : @object . uuid , head_uuid : src . uuid , link_class : 'name' , name : src . uuid ) else case action when :copy dst = src . dup if dst . respond_to? :' name= ' if dst . name dst . name = "Copy of #{dst.name}" else dst . name = "Copy of unnamed #{dst.class_for_display.downcase}" end end if resource_class == Collection dst . manifest_text = Collection . select ( [ :manifest_text ] ) . where ( uuid : src . uuid ) . with_count ( "none" ) . first . manifest_text end when :move dst = src else raise ArgumentError . new "Unsupported action #{action}" end dst . owner_uuid = @object . uuid dst . tail_uuid = @object . uuid if dst . class == Link end begin dst . save! rescue dst . name += " (#{Time.now.localtime})" if dst . respond_to? :name= dst . save! end end end if ( resource_classes == [ Collection ] and @object . is_a? Group and @object . group_class == 'project' ) or @object . is_a? User redirect_to project_url ( @object . uuid , anchor : 'Data_collections' ) else redirect_to @object end end
Skip require_thread_api_token if this is a show action
for an object uuid that supports anonymous access.
Skip require_thread_api_token if this is a show action for an object uuid that supports anonymous access .
# In the common case where only collections are copied/moved # into a project, it's polite to land on the collections tab on # the destination project. # Otherwise just land on the default (Description) tab.
action