Module: CurationConcerns::SingleUseLinksViewerControllerBehavior

Extended by:
ActiveSupport::Concern
Includes:
Blacklight::AccessControls::Catalog, Blacklight::Base, DownloadBehavior
Included in:
SingleUseLinksViewerController
Defined in:
app/controllers/concerns/curation_concerns/single_use_links_viewer_controller_behavior.rb

Instance Method Summary collapse

Instance Method Details

#downloadObject



20
21
22
23
# File 'app/controllers/concerns/curation_concerns/single_use_links_viewer_controller_behavior.rb', line 20

def download
  raise not_found_exception unless single_use_link.path == main_app.download_path(id: @asset)
  send_content
end

#showObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/concerns/curation_concerns/single_use_links_viewer_controller_behavior.rb', line 25

def show
  _, document_list = search_results(id: single_use_link.itemId)
  curation_concern = document_list.first

  # Authorize using SingleUseLinksViewerController::Ability
  authorize! :read, curation_concern

  raise not_found_exception unless single_use_link.path == polymorphic_path([main_app, curation_concern])

  # show the file
  @presenter = presenter_class.new(curation_concern, current_ability)

  # create a dowload link that is single use for the user since we do not just want to show metadata we want to access it too
  @su = single_use_link.create_for_path main_app.download_path(curation_concern.id)
  @download_link = curation_concerns.download_single_use_link_path(@su.downloadKey)
end