Class: LeasesController

Inherits:
ApplicationController
  • Object
show all
Includes:
Hydra::Collections::AcceptsBatches, Worthwhile::ManagesEmbargoes, Worthwhile::WithoutNamespace
Defined in:
app/controllers/leases_controller.rb

Instance Method Summary collapse

Methods included from Worthwhile::ManagesEmbargoes

#edit, #index

Instance Method Details

#destroyObject



8
9
10
11
12
13
14
15
# File 'app/controllers/leases_controller.rb', line 8

def destroy
  curation_concern.lease_visibility! # If the lease has lapsed, update the current visibility.
  curation_concern.deactivate_lease!
  saved = curation_concern.save
  Sufia.queue.push(VisibilityCopyWorker.new(curation_concern.id)) if saved
  flash[:notice] = curation_concern.lease_history.last
  redirect_to edit_lease_path(curation_concern)
end

#updateObject



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/leases_controller.rb', line 17

def update
  filter_docs_with_edit_access!
  batch.each do |id|
    ActiveFedora::Base.find(id).tap do |curation_concern|
      curation_concern.deactivate_lease!
      curation_concern.save
    end
  end
  redirect_to leases_path
end