]> iEval git - gruntmaster-page.git/commitdiff
Always allow users to view their own sources
authorMarius Gavrilescu <marius@ieval.ro>
Thu, 5 Feb 2015 17:31:56 +0000 (19:31 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Thu, 5 Feb 2015 17:31:56 +0000 (19:31 +0200)
lib/Plack/App/Gruntmaster.pm

index 0edfe5abd99615f54778a703cef7b8ee354663ce..77a8828aab25fc687a9876ee9169cd5a68612ed5 100644 (file)
@@ -113,7 +113,8 @@ sub dispatch_request{
 
                sub (/src/:job) {
                        return NOT_FOUND if !job;
-                       forbid job->private || job->problem->private || job->contest && job->contest->is_running;
+                       my $isowner = remote_user && remote_user->id eq job->rawowner;
+                       forbid !$isowner && (job->private || job->problem->private || job->contest && job->contest->is_running);
                        my @headers = ('X-Forever' => 1, 'Cache-Control' => 'public, max-age=604800', 'Content-Type' => CONTENT_TYPES->{job->format});
                        [200, \@headers, [job->source]]
                },
This page took 0.027075 seconds and 4 git commands to generate.