Description:
prevents user from viewing own sources submitted to unavailable problems
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r305:a5e98b239050 - - 1 file changed: 3 inserted, 1 deleted

@@ -86,13 +86,15
86 end
86 end
87 redirect_to :action => 'list'
87 redirect_to :action => 'list'
88 end
88 end
89
89
90 def source
90 def source
91 submission = Submission.find(params[:id])
91 submission = Submission.find(params[:id])
92 - if submission.user_id == session[:user_id]
92 + if ((submission.user_id == session[:user_id]) and
93 + (submission.problem != nil) and
94 + (submission.problem.available))
93 send_data(submission.source,
95 send_data(submission.source,
94 {:filename => submission.download_filename,
96 {:filename => submission.download_filename,
95 :type => 'text/plain'})
97 :type => 'text/plain'})
96 else
98 else
97 flash[:notice] = 'Error viewing source'
99 flash[:notice] = 'Error viewing source'
98 redirect_to :action => 'list'
100 redirect_to :action => 'list'
You need to be logged in to leave comments. Login now