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



35
36
37
38
39
# File 'app/controllers/single_use_links_viewer_controller.rb', line 35

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

#showObject



41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/single_use_links_viewer_controller.rb', line 41

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