Sha256: bb041a1a59b730577f42f232eda747630ba0e4decdb6d1d4f538239a9a8e0662

Contents?: true

Size: 706 Bytes

Versions: 10

Compression:

Stored size: 706 Bytes

Contents

module Sufia
  module GenericFile
    module ProxyDeposit
      extend ActiveSupport::Concern

      included do
        has_attributes :proxy_depositor, :on_behalf_of, datastream: :properties, multiple: false
        after_create :create_transfer_request
      end

      def create_transfer_request
        Sufia.queue.push(ContentDepositorChangeEventJob.new(pid, on_behalf_of)) if on_behalf_of.present?
      end

      def request_transfer_to(target)
        raise ArgumentError, "Must provide a target" unless target
        deposit_user = ::User.find_by_user_key(depositor)
        ProxyDepositRequest.create!(pid: pid, receiving_user: target, sending_user: deposit_user)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
sufia-5.0.0 sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb
sufia-models-5.0.0 app/models/concerns/sufia/generic_file/proxy_deposit.rb
sufia-5.0.0.rc1 sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb
sufia-models-5.0.0.rc1 app/models/concerns/sufia/generic_file/proxy_deposit.rb
sufia-4.3.1 sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb
sufia-models-4.3.1 app/models/concerns/sufia/generic_file/proxy_deposit.rb
sufia-4.2.0 sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb
sufia-models-4.2.0 app/models/concerns/sufia/generic_file/proxy_deposit.rb
sufia-4.1.0 sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb
sufia-models-4.1.0 app/models/concerns/sufia/generic_file/proxy_deposit.rb