Class: WorkDownloaderController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- WorkDownloaderController
- Defined in:
- app/controllers/work_downloader_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#download ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/work_downloader_controller.rb', line 3 def download work = Work.find(params[:id]) if current_user && work.editable_by?(current_user) file_name = params[:filename] service = S3QueryService.new(work, work.files_mode) uri = service.file_url(file_name) redirect_to uri else Honeybadger.notify("Can not download work: #{work.id} is not editable by #{current_user.uid}") redirect_to root_path, notice: I18n.t("works.download.privs") end end |