From: Marius Gavrilescu Date: Thu, 5 Feb 2015 17:31:56 +0000 (+0200) Subject: Always allow users to view their own sources X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=c22928ed23e4213faf2529bde153a5c48e8f3629;p=gruntmaster-page.git Always allow users to view their own sources --- diff --git a/lib/Plack/App/Gruntmaster.pm b/lib/Plack/App/Gruntmaster.pm index 0edfe5a..77a8828 100644 --- a/lib/Plack/App/Gruntmaster.pm +++ b/lib/Plack/App/Gruntmaster.pm @@ -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]] },