diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-02-12 14:01:38 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-02-14 16:55:24 +0000 |
commit | c2089e945132d36468f1d9a3bf08ae4d661cf44a (patch) | |
tree | 755780edf643ebd8babb910632eb259623fd8a24 /perllib/FixMyStreet/App/Controller/Admin.pm | |
parent | 1825a09bbdfee97928a251a84534d859b1a43387 (diff) |
Allow user to be associated with multiple areas.
Update database to store an array of IDs rather than only one;
consequential changes to the admin and the dashboard to allow
selection.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index acd6ddbf2..84651ad07 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -1647,7 +1647,7 @@ sub user_edit : Path('user_edit') : Args(1) { if (!$user->from_body) { # Non-staff users aren't allowed any permissions or to be in an area $user->admin_user_body_permissions->delete; - $user->area_id(undef); + $user->area_ids(undef); delete $c->stash->{areas}; delete $c->stash->{fetched_areas_body_id}; } elsif ($c->stash->{available_permissions}) { @@ -1667,8 +1667,8 @@ sub user_edit : Path('user_edit') : Args(1) { if ( $user->from_body && $c->user->has_permission_to('user_assign_areas', $user->from_body->id) ) { my %valid_areas = map { $_->{id} => 1 } @{ $c->stash->{areas} }; - my $new_area = $c->get_param('area_id'); - $user->area_id( $valid_areas{$new_area} ? $new_area : undef ); + my @area_ids = grep { $valid_areas{$_} } $c->get_param_list('area_ids'); + $user->area_ids( @area_ids ? \@area_ids : undef ); } # Handle 'trusted' flag(s) |