diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/Bodies.pm | 7 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Contact.pm | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm index f1a6f938b..31a717a9c 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm @@ -283,6 +283,13 @@ sub update_contact : Private { $contact->unset_extra_metadata($_); } } + if ( $c->user->is_superuser ) { + if ( $c->get_param('hardcoded') ) { + $contact->set_extra_metadata( hardcoded => 1 ); + } else { + $contact->unset_extra_metadata('hardcoded'); + } + } if ( my @group = $c->get_param_list('group') ) { @group = grep { $_ } @group; if (scalar @group == 0) { diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm index 5cf3302dd..69f8886eb 100644 --- a/perllib/FixMyStreet/DB/Result/Contact.pm +++ b/perllib/FixMyStreet/DB/Result/Contact.pm @@ -191,12 +191,16 @@ sub sent_by_open311 { # We do not want to allow editing of a category's name # if it's Open311, unless it's marked as protected +# Also prevent editing of hardcoded categories sub category_uneditable { my $self = shift; return 1 if $self->in_storage && !$self->get_extra_metadata('open311_protect') && $self->sent_by_open311; + return 1 if + $self->in_storage + && $self->get_extra_metadata('hardcoded'); return 0; } |