diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-23 16:34:19 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-23 16:34:19 +0100 |
commit | fb56c38856fe33c971903ab0efde1cf5d4829426 (patch) | |
tree | 91409b19c31f82118b279e29ee3d344a9414c745 /perllib/FixMyStreet/App/Controller/Report/Update.pm | |
parent | 2264d094189ff9d5e1c52b58329fc191f97c3fd6 (diff) |
check that state is permitted
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/Update.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index 41bc3a4bd..5421385fb 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -181,11 +181,18 @@ sub check_for_errors : Private { # they have to be an authority user to update the state if ( $c->req->param('state') ) { - unless ( $c->user && $c->user->from_authority ) { + my $error = 0; + $error = 1 unless $c->user && $c->user->from_authority; + + my $state = $c->req->param('state'); + $error = 1 unless ( grep { $state eq $_ } ( qw/closed fixed investigating planned/, 'in progress', 'fixed', 'fixed - user', 'fixed - council' ) ); + + if ( $error ) { $c->stash->{errors} ||= []; push @{ $c->stash->{errors} }, _('There was a problem with your update. Please try again.'); return; } + } # let the model check for errors |