Class: Hyrax::ChangeDepositorService
- Inherits:
-
Object
- Object
- Hyrax::ChangeDepositorService
- Defined in:
- app/services/hyrax/change_depositor_service.rb
Class Method Summary collapse
-
.call(work, user, reset) ⇒ Object
Set the given ‘user` as the depositor of the given `work`; If `reset` is true, first remove all previous permissions.
Class Method Details
.call(work, user, reset) ⇒ Object
Set the given ‘user` as the depositor of the given `work`; If `reset` is true, first remove all previous permissions.
Used to transfer a an existing work, and to set depositor / proxy_depositor on a work newly deposited on_behalf_of another user
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/services/hyrax/change_depositor_service.rb', line 20 def self.call(work, user, reset) # user_key is nil when there was no `on_behalf_of` in the form return work unless user&.user_key # Don't transfer to self return work if user.user_key == work.depositor work = case work when ActiveFedora::Base call_af(work, user, reset) when Valkyrie::Resource call_valkyrie(work, user, reset) end ChangeDepositorEventJob.perform_later(work) work end |