Sha256: 06c9e1709f7410fbf5227f8dda515586fbe4d464296a3c6b6c7f29f448ca99ff

Contents?: true

Size: 1.3 KB

Versions: 17

Compression:

Stored size: 1.3 KB

Contents

module CurationConcerns
  module LeasesControllerBehavior
    extend ActiveSupport::Concern
    include CurationConcerns::ManagesEmbargoes
    include CurationConcerns::Collections::AcceptsBatches

    included do
      skip_before_action :normalize_identifier, only: :update
    end

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

    # Removes a single lease
    def destroy
      LeaseActor.new(curation_concern).destroy
      flash[:notice] = curation_concern.lease_history.last
      if curation_concern.work? && curation_concern.file_sets.present?
        redirect_to confirm_curation_concerns_permission_path(curation_concern)
      else
        redirect_to edit_lease_path(curation_concern)
      end
    end

    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|
        LeaseActor.new(curation_concern).destroy
        curation_concern.copy_visibility_to_files if copy_visibility.include?(curation_concern.id)
      end
      redirect_to leases_path
    end

    protected

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
curation_concerns-1.0.0.beta1 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.14.0 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.14.0.pre4 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.14.0.pre3 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.14.0.pre2 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.14.0.pre1 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.13.1 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.13.0 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.12.0 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.12.0.pre9 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.12.0.pre8 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.12.0.pre7 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.12.0.pre6 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.12.0.pre5 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.12.0.pre4 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.12.0.pre3 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb
curation_concerns-0.12.0.pre2 app/controllers/concerns/curation_concerns/leases_controller_behavior.rb