Add custom_embed_option to disallow downloading submissions

This commit is contained in:
Sebastian Serth
2019-03-29 14:56:14 +01:00
parent a162a2cf9c
commit baa0784ede
3 changed files with 14 additions and 3 deletions

View File

@ -62,6 +62,10 @@ class SubmissionsController < ApplicationController
end
def download
if @embed_options[:disable_download]
raise Pundit::NotAuthorizedError
end
# files = @submission.files.map{ }
# zipline( files, 'submission.zip')
# send_data(@file.content, filename: @file.name_with_extension)
@ -98,6 +102,10 @@ class SubmissionsController < ApplicationController
end
def download_file
if @embed_options[:disable_download]
raise Pundit::NotAuthorizedError
end
if @file.native_file?
send_file(@file.native_file.path)
else