Class: EmbargoesController

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

Instance Method Summary collapse

Methods included from Worthwhile::ManagesEmbargoes

#edit, #index

Instance Method Details

#destroyObject

Remove an active or lapsed embargo



10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/embargoes_controller.rb', line 10

def destroy
  update_files = !curation_concern.under_embargo? # embargo expired
  remove_embargo(curation_concern)
  flash[:notice] = curation_concern.embargo_history.last
  if update_files
    redirect_to confirm_curation_concern_permission_path(curation_concern)
  else
    redirect_to edit_embargo_path(curation_concern)
  end
end

#updateObject



21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/embargoes_controller.rb', line 21

def update
  filter_docs_with_edit_access!
  copy_visibility = params[:embargoes].values.map { |h| h[:copy_visibility] }
  batch.each do |id|
    ActiveFedora::Base.find(id).tap do |curation_concern|
      remove_embargo(curation_concern)
      curation_concern.copy_visibility_to_files if copy_visibility.include?(id)
    end
  end
  redirect_to embargoes_path
end