Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent editing of category names with hardcoded flag #3227

Closed

Conversation

struan
Copy link
Member

@struan struan commented Oct 23, 2020

If a category has hardcoded set to 1 in it's extra metadata then prevent
the name being edited in the admin. This is to avoid issues where the
name of the category is used in e.g. layers or other configuration and
changing it breaks things.

Also includes admin interface for setting this that is restricted to
super users only.

Fixes mysociety/fixmystreet-commercial#1992

@struan struan force-pushed the issues/commercial/1992-hardcoded-category-protection branch from a15907f to bfce60e Compare October 23, 2020 16:13
@struan struan changed the title prevent editing of category names with harcoded flag prevent editing of category names with hardcoded flag Oct 23, 2020
@codecov
Copy link

codecov bot commented Oct 23, 2020

Codecov Report

Merging #3227 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3227      +/-   ##
==========================================
+ Coverage   83.88%   83.89%   +0.01%     
==========================================
  Files         251      251              
  Lines       15944    15949       +5     
  Branches     3002     3005       +3     
==========================================
+ Hits        13374    13381       +7     
  Misses       1620     1620              
+ Partials      950      948       -2     
Impacted Files Coverage Δ
perllib/FixMyStreet/App/Controller/Admin/Bodies.pm 96.59% <100.00%> (+0.43%) ⬆️
perllib/FixMyStreet/DB/Result/Contact.pm 100.00% <100.00%> (ø)
perllib/Utils.pm 98.98% <0.00%> (+1.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9150a5f...e5cc983. Read the comment docs.

@struan struan requested a review from davea October 26, 2020 13:36
Copy link
Member

@davea davea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One picky thing, sorry!

@@ -276,7 +276,7 @@ sub update_contact : Private {
$contact->send_method( $c->get_param('send_method') );

# Set flags in extra to the appropriate values
foreach (qw(photo_required open311_protect updates_disallowed reopening_disallowed assigned_users_only anonymous_allowed)) {
foreach (qw(photo_required open311_protect updates_disallowed reopening_disallowed assigned_users_only anonymous_allowed hardcoded)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it doesn't really matter, because this page is already behind a staff-only login, but there should be a superuser check here too (like the one in the template) rather than trusting input from the client.

@struan struan requested a review from davea October 27, 2020 15:17
Copy link
Member

@davea davea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@struan struan closed this Nov 9, 2020
@struan struan force-pushed the issues/commercial/1992-hardcoded-category-protection branch from e5cc983 to 6f6a65c Compare November 9, 2020 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants