From 5b76a57de70303cab0e6ef846caee89de8edc5f7 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Wed, 21 Jan 2015 21:24:26 +0200 Subject: [PATCH] Require authentication and privacy for problems during contests --- lib/Plack/App/Gruntmaster.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Plack/App/Gruntmaster.pm b/lib/Plack/App/Gruntmaster.pm index 9775b96..136f657 100644 --- a/lib/Plack/App/Gruntmaster.pm +++ b/lib/Plack/App/Gruntmaster.pm @@ -179,6 +179,10 @@ sub dispatch_request{ $_{contest} = $contest; return NOT_FOUND if !contest && !problem->is_in_archive || contest && !db->contest_problems->find($_{contest}, $_{problem}); forbid problem->is_private; + if (contest && contest->is_running) { + forbid !remote_user; + $privacy = 'private'; + } response pb_entry => problem->name, db->problem_entry($_{problem}, $_{contest}, remote_user && remote_user->id); }, sub (/sol/:problem) { -- 2.39.2