Class: SingleUseLinksViewerController

Inherits:
ApplicationController
  • Object
show all
Includes:
Sufia::DownloadsControllerBehavior
Defined in:
app/controllers/single_use_links_viewer_controller.rb

Defined Under Namespace

Classes: Ability

Instance Method Summary collapse

Methods included from Sufia::DownloadsControllerBehavior

#datastream_name

Instance Method Details

#downloadObject



32
33
34
35
36
# File 'app/controllers/single_use_links_viewer_controller.rb', line 32

def download
  # send the data content
  raise not_found_exception unless single_use_link.path == sufia.download_path(id: @asset)
  send_content
end

#showObject



38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/single_use_links_viewer_controller.rb', line 38

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

  #show the file
  @terms = @asset.terms_for_display

  # 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