aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-09-16 09:31:38 +0100
committerDave Arter <davea@mysociety.org>2016-09-16 09:39:15 +0100
commite8fb7318f94f78f768700f72b2bb8e3434f108a2 (patch)
tree4aaaf5a942d82c0a17366a9bb89ed072a4723b45
parentf2da71c3116f81c386aad164176108d341ac5ecc (diff)
[Zurich] Restore admin user edit functionality
- Zurich users don't need permission to access user_edit page - from_body can be set to any body by Zurich admin users, not just their own - Don't show the area field on user_edit form
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm4
-rw-r--r--templates/web/base/admin/user-form.html4
2 files changed, 4 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index b643c9633..a312a4399 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -1218,7 +1218,7 @@ sub user_edit : Path('user_edit') : Args(1) {
my $user = $c->cobrand->users->find( { id => $id } );
$c->detach( '/page_error_404_not_found', [] ) unless $user;
- unless ( $c->user->is_superuser || $c->user->has_body_permission_to('user_edit') ) {
+ unless ( $c->user->is_superuser || $c->user->has_body_permission_to('user_edit') || $c->cobrand->moniker eq 'zurich' ) {
$c->detach('/page_error_403_access_denied', []);
}
@@ -1253,7 +1253,7 @@ sub user_edit : Path('user_edit') : Args(1) {
$user->is_superuser( ( $c->user->is_superuser && $c->get_param('is_superuser') ) || 0 );
# Superusers can set from_body to any value, but other staff can only
# set from_body to the same value as their own from_body.
- if ( $c->user->is_superuser ) {
+ 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 ) {
diff --git a/templates/web/base/admin/user-form.html b/templates/web/base/admin/user-form.html
index 8a9ba5a77..38191e095 100644
--- a/templates/web/base/admin/user-form.html
+++ b/templates/web/base/admin/user-form.html
@@ -23,7 +23,7 @@
<li><label for="phone">[% loc('Phone:') %]</label>
<input type='text' id='phone' name='phone' value='[% user.phone | html %]'></li>
- [% IF c.user.is_superuser %]
+ [% IF c.user.is_superuser || c.cobrand.moniker == 'zurich' %]
<li>
<div class="admin-hint">
<p>
@@ -53,7 +53,7 @@
</li>
[% END %]
- [% IF areas %]
+ [% IF areas AND c.cobrand.moniker != 'zurich' %]
<li>
<div class="admin-hint">
<p>