From acef92e8dd279c526d98f61408f5d7f326348eab Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Thu, 13 Feb 2014 18:16:59 +0200 Subject: [PATCH] Add problem open --- app.psgi | 3 ++- lib/Gruntmaster/Page/Pb/Entry.pm | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app.psgi b/app.psgi index 9908172..62a6f79 100644 --- a/app.psgi +++ b/app.psgi @@ -24,6 +24,7 @@ sub debug { sub some_auth_required { my $r = Plack::Request->new($_[0]); return 1 if $_[0]->{'gruntmaster.reqadmin'} || $r->path eq '/action/passwd' || $r->path =~ m,/pb/$word/submit$,; + return 1 if $r->path =~ m,^/ct/$word/pb/$word, && time < contest_end $1; 0 } @@ -39,7 +40,7 @@ sub admin_required { sub require_admin { my $app = $_[0]; sub { - *__ANON__ = "require_admin_middleware"; + local *__ANON__ = "require_admin_middleware"; my $env = $_[0]; my $r = Plack::Request->new($env); $env->{'gruntmaster.reqadmin'} = 1 if admin_required $r->path; diff --git a/lib/Gruntmaster/Page/Pb/Entry.pm b/lib/Gruntmaster/Page/Pb/Entry.pm index 95b15a4..3d696a7 100644 --- a/lib/Gruntmaster/Page/Pb/Entry.pm +++ b/lib/Gruntmaster/Page/Pb/Entry.pm @@ -12,6 +12,11 @@ use constant FORMATS => [qw/C CPP JAVA PERL PYTHON/]; sub _generate{ my ($self, $htc, $lang, $env, $contest, $id) = @_; debug $env => "language is '$lang', contest is '$contest', id is '$id'"; + my $user = $env->{REMOTE_USER}; + if ($contest && $user) { + mark_open $id, $user; + debug $env => "Marking problem $id of contest $contest open by $user"; + } $htc->param(cansubmit => 1); if ($contest) { -- 2.30.2