Module: Hydra::Controller::DownloadBehavior

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/hydra/controller/download_behavior.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#showObject

Responds to http requests to show the datastream



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/concerns/hydra/controller/download_behavior.rb', line 12

def show
  if can_download?
    if datastream.new?
      render_404
    else
      # we can now examine asset and determine if we should send_content, or some other action.
      send_content (asset)
    end
  else 
    logger.info "Can not read #{params[asset_param_key]}"
    raise Hydra::AccessDenied.new("You do not have sufficient access privileges to read this document, which has been marked private.", :read, params[asset_param_key])
  end
end