Use X-Sendfile to transmit native files and handle file uploads

This commit is contained in:
Sebastian Serth
2022-09-06 00:00:59 +02:00
parent dccc60b7ca
commit 0a16f589e9
9 changed files with 58 additions and 9 deletions

View File

@ -7,6 +7,8 @@ module CodeOcean
end
def show?
return false if @record.native_file? && !@record.native_file_location_valid?
if @record.context.is_a?(Exercise)
admin? || author? || !@record.hidden
else
@ -14,6 +16,16 @@ module CodeOcean
end
end
def show_protected_upload?
return false if @record.native_file? && !@record.native_file_location_valid?
if @record.context.is_a?(Exercise)
admin? || author? || (!@record.context.unpublished && !@record.hidden)
else
admin? || author?
end
end
def create?
if @record.context.is_a?(Exercise)
admin? || author?