From: Marius Gavrilescu Date: Thu, 13 Feb 2014 16:17:25 +0000 (+0200) Subject: Merge branch 'master' into mindcoding X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=7ffb6a3686e644a2cb9a6d39f3d60a646a1e2de6;hp=d3264f569fcefcec2c68fa6d5de66e8279331c8b;p=plack-app-gruntmaster.git Merge branch 'master' into mindcoding --- diff --git a/app.psgi b/app.psgi index 75076cb..c470f30 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) {