Module: Hyrax::LeasesControllerBehavior

Extended by:
ActiveSupport::Concern
Includes:
Collections::AcceptsBatches, ManagesEmbargoes
Included in:
LeasesController
Defined in:
app/controllers/concerns/hyrax/leases_controller_behavior.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Collections::AcceptsBatches

#batch, #batch=, #check_for_empty_batch?

Methods included from ManagesEmbargoes

#deny_access

Class Method Details

.local_prefixesObject

This allows us to use the unauthorized template in curation_concerns/base



36
37
38
# File 'app/controllers/concerns/hyrax/leases_controller_behavior.rb', line 36

def self.local_prefixes
  ['hyrax/base']
end

Instance Method Details

#destroyObject

Removes a single lease



15
16
17
18
19
20
21
22
23
# File 'app/controllers/concerns/hyrax/leases_controller_behavior.rb', line 15

def destroy
  Hyrax::Actors::LeaseActor.new(curation_concern).destroy
  flash[:notice] = curation_concern.lease_history.last
  if curation_concern.work? && curation_concern.file_sets.present?
    redirect_to confirm_permission_path
  else
    redirect_to edit_lease_path
  end
end

#editObject



40
41
42
43
44
45
# File 'app/controllers/concerns/hyrax/leases_controller_behavior.rb', line 40

def edit
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
  add_breadcrumb t(:'hyrax.leases.index.manage_leases'), hyrax.leases_path
  add_breadcrumb t(:'hyrax.leases.edit.lease_update'), '#'
end

#indexObject



7
8
9
10
11
12
# File 'app/controllers/concerns/hyrax/leases_controller_behavior.rb', line 7

def index
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
  add_breadcrumb t(:'hyrax.leases.index.manage_leases'), hyrax.leases_path
  authorize! :index, Hydra::AccessControls::Lease
end

#updateObject



25
26
27
28
29
30
31
32
33
# File 'app/controllers/concerns/hyrax/leases_controller_behavior.rb', line 25

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