Description:
prevents user from viewing own sources submitted to unavailable problems
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r305:a5e98b239050 - - 1 file changed: 3 inserted, 1 deleted
@@ -80,25 +80,27 | |||
|
80 | 80 | :status => Task::STATUS_INQUEUE) == false |
|
81 | 81 | flash[:notice] = 'Error adding your submission to task queue' |
|
82 | 82 | end |
|
83 | 83 | else |
|
84 | 84 | prepare_list_information |
|
85 | 85 | render :action => 'list' and return |
|
86 | 86 | end |
|
87 | 87 | redirect_to :action => 'list' |
|
88 | 88 | end |
|
89 | 89 | |
|
90 | 90 | def source |
|
91 | 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 | 95 | send_data(submission.source, |
|
94 | 96 | {:filename => submission.download_filename, |
|
95 | 97 | :type => 'text/plain'}) |
|
96 | 98 | else |
|
97 | 99 | flash[:notice] = 'Error viewing source' |
|
98 | 100 | redirect_to :action => 'list' |
|
99 | 101 | end |
|
100 | 102 | end |
|
101 | 103 | |
|
102 | 104 | def compiler_msg |
|
103 | 105 | @submission = Submission.find(params[:id]) |
|
104 | 106 | if @submission.user_id == session[:user_id] |
You need to be logged in to leave comments.
Login now