aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-09-20 08:50:05 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-09-20 08:52:40 +0100
commit1de47094d7a569c0055c0d23657140772c87d93d (patch)
tree3d2ce01f31e783e60758594a52eb9cb876319c06 /perllib
parent506938574095ebeee250cdf8987e025d8897de91 (diff)
Don't lose from_body if edited by non-superuser.
If an admin with the user_edit permission but not user_assign_body edited a user with from_body set, the from_body field was lost.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index a513ea33c..7c81251e8 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -1591,11 +1591,12 @@ sub user_edit : Path('user_edit') : Args(1) {
# set from_body to the same value as their own from_body.
if ( $c->user->is_superuser || $c->cobrand->moniker eq 'zurich' ) {
$user->from_body( $c->get_param('body') || undef );
- } elsif ( $c->user->has_body_permission_to('user_assign_body') &&
- $c->get_param('body') && $c->get_param('body') eq $c->user->from_body->id ) {
- $user->from_body( $c->user->from_body );
- } else {
- $user->from_body( undef );
+ } elsif ( $c->user->has_body_permission_to('user_assign_body') ) {
+ if ($c->get_param('body') && $c->get_param('body') eq $c->user->from_body->id ) {
+ $user->from_body( $c->user->from_body );
+ } else {
+ $user->from_body( undef );
+ }
}
$c->forward('user_cobrand_extra_fields');