Sha256: de166565d45dfdf445f3990a04c8c37f91aa6883a1493708081913ef6705a7e4

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 KB

Contents

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

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

    # Removes a single lease
    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

    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

    # This allows us to use the unauthorized template in curation_concerns/base
    def self.local_prefixes
      ['hyrax/base']
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hyrax-2.0.3 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.2 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.1.0.beta1 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.1 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.0 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.0.rc3 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.0.rc2 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.0.rc1 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.0.beta5 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.0.beta4 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.0.beta3 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.0.beta2 app/controllers/concerns/hyrax/leases_controller_behavior.rb
hyrax-2.0.0.beta1 app/controllers/concerns/hyrax/leases_controller_behavior.rb