Skip to content

Commit

Permalink
Update app/controllers/uploaded_files_controller.rb
Browse files Browse the repository at this point in the history
Co-Authored-By: Adrian Jost <22987140+adrianjost@users.noreply.github.com>
  • Loading branch information
caustt and adrianjost authored Jan 16, 2020
1 parent 87fdd2c commit 5d9a3a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/uploaded_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def uploaded_file_params
def validate_destroy_rights
uploaded_file = UploadedFile.find(params[:id])
@owner = current_user == @uploaded_file.author
@course_file_and_course_owner = (@uploaded_file.allowsUpload.class == Course) && (@uploaded_file.allowsUpload.creator_id == current_user.id)
course_file_and_course_owner = (uploaded_file.allowsUpload.class == Course) && (uploaded_file.allowsUpload.creator_id == current_user.id)
lecture_file_and_lecture_owner = (uploaded_file.allowsUpload.class == Lecture) && (uploaded_file.allowsUpload.lecturer_id == current_user.id)
unless owner || course_file_and_course_owner || lecture_file_and_lecture_owner
redirect_to (uploaded_files_url), notice: "You can't delete this file."
Expand Down

0 comments on commit 5d9a3a8

Please sign in to comment.