Enforce file creation allowance via Pundit policy

This commit is contained in:
Sebastian Serth
2020-12-03 17:05:21 +01:00
parent bd8741f3dd
commit 5eaa508b74

View File

@ -15,8 +15,10 @@ module CodeOcean
def create?
if @record.context.is_a?(Exercise)
admin? || author?
else
elsif @record.context.is_a?(Submission) and @record.context.exercise.allow_file_creation
author?
else
no_one
end
end