Module: Sufia::SingleUseLinksViewerControllerBehavior

Extended by:
ActiveSupport::Concern
Includes:
DownloadsControllerBehavior
Included in:
SingleUseLinksViewerController
Defined in:
app/controllers/concerns/sufia/single_use_links_viewer_controller_behavior.rb

Instance Method Summary collapse

Methods included from DownloadsControllerBehavior

#file_name

Instance Method Details

#downloadObject



16
17
18
19
# File 'app/controllers/concerns/sufia/single_use_links_viewer_controller_behavior.rb', line 16

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

#showObject



21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/concerns/sufia/single_use_links_viewer_controller_behavior.rb', line 21

def show
  raise not_found_exception unless single_use_link.path == sufia.polymorphic_path(@asset)

  #show the file
  @presenter = presenter

  # 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 sufia.download_path(id: @asset)
  @download_link = sufia.download_single_use_link_path(@su.downloadKey)
end