Skip to content

Commit

Permalink
Prevent global censor rule creation
Browse files Browse the repository at this point in the history
Censor rule creation results in expiry of all related content. On
WhatDoTheyKnow this would cause a major problem. This hacks in a
preventative measure. Admins who wish to create a global rule can seek
developer assistance until a more robust solution is found.
  • Loading branch information
garethrees committed Nov 29, 2024
1 parent 5232f38 commit 1db557a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/controller_patches.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Please arrange overridden classes alphabetically.
Rails.configuration.to_prepare do
AdminCensorRuleController.class_eval do
before_action :block_global_censor_rule_creation, only: [:create]

private

def block_global_censor_rule_creation
raise NotImplementedError if @censor_rule.is_global?
end
end

HelpController.class_eval do
prepend VolunteerContactForm::ControllerMethods
prepend DataBreach::ControllerMethods
Expand Down

0 comments on commit 1db557a

Please sign in to comment.