From c22928ed23e4213faf2529bde153a5c48e8f3629 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Thu, 5 Feb 2015 19:31:56 +0200 Subject: [PATCH] Always allow users to view their own sources --- lib/Plack/App/Gruntmaster.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]] }, -- 2.39.2