Sha256: 7efb9909c9e9571690b649c537c132dfca3f52c6d002eb18c310f362f61ae5a9

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

class LeasesController < ApplicationController
  include Worthwhile::WithoutNamespace
  include Worthwhile::ManagesEmbargoes
  include Hydra::Collections::AcceptsBatches

  skip_before_filter :normalize_identifier, only: :update

  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

  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


  protected
    def _prefixes
      # This allows us to use the unauthorized template in curation_concern/base
      @_prefixes ||= super + ['curation_concern/base']
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
worthwhile-0.1.2 app/controllers/leases_controller.rb
worthwhile-0.1.1 app/controllers/leases_controller.rb
worthwhile-0.1.0 app/controllers/leases_controller.rb
worthwhile-0.0.3 app/controllers/leases_controller.rb
worthwhile-0.0.2 app/controllers/leases_controller.rb
worthwhile-0.0.1 app/controllers/leases_controller.rb