Class: Hyrax::SingleUseLinksViewerController

Inherits:
DownloadsController show all
Includes:
ActionDispatch::Routing::PolymorphicRoutes, Blacklight::AccessControls::Catalog, Blacklight::Base
Defined in:
app/controllers/hyrax/single_use_links_viewer_controller.rb

Defined Under Namespace

Classes: Ability

Instance Method Summary collapse

Methods inherited from DownloadsController

default_content_path

Methods included from WorkflowsHelper

#workflow_restriction?

Methods included from ValkyrieDownloadsControllerBehavior

#show_valkyrie

Instance Method Details

#downloadObject



20
21
22
23
# File 'app/controllers/hyrax/single_use_links_viewer_controller.rb', line 20

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

#showObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/hyrax/single_use_links_viewer_controller.rb', line 25

def show
  # 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 hyrax.download_path(curation_concern.id)
  @download_link = hyrax.download_single_use_link_path(@su.download_key)
end