Module: CurationConcerns::EmbargoesControllerBehavior

Extended by:
ActiveSupport::Concern
Includes:
ManagesEmbargoes, Hydra::Collections::AcceptsBatches
Included in:
EmbargoesController
Defined in:
app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb

Instance Method Summary collapse

Methods included from ManagesEmbargoes

#deny_access, #edit

Instance Method Details

#destroyObject

Removes a single embargo



16
17
18
19
20
21
22
23
24
# File 'app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb', line 16

def destroy
  EmbargoActor.new(curation_concern).destroy
  flash[:notice] = curation_concern.embargo_history.last
  if curation_concern.work? && curation_concern.file_sets.present?
    redirect_to confirm_curation_concerns_permission_path(curation_concern)
  else
    redirect_to edit_embargo_path(curation_concern)
  end
end

#indexObject



11
12
13
# File 'app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb', line 11

def index
  authorize! :index, Hydra::AccessControls::Embargo
end

#updateObject

Updates a batch of embargos



27
28
29
30
31
32
33
34
35
# File 'app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb', line 27

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