Skip to content

Commit

Permalink
Merge pull request #2291 from alphagov/homepage-editior-permission
Browse files Browse the repository at this point in the history
Add homepage editor permission for all controller actions
  • Loading branch information
syed-ali-tw authored Aug 19, 2024
2 parents 8c0e8cf + 7e74125 commit 9f1c422
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 151 deletions.
7 changes: 7 additions & 0 deletions app/controllers/homepage_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
class HomepageController < ApplicationController
layout "design_system"
before_action :fetch_latest_popular_link
before_action :require_homepage_editor_permissions

include GDS::SSO::ControllerMethods

def show
render "homepage/popular_links/show"
Expand Down Expand Up @@ -117,4 +120,8 @@ def raise_support_error_message
def support_link
"<a href=\"#{Plek.external_url_for('support')}/technical_fault_report/new\">please raise a support ticket</a>"
end

def require_homepage_editor_permissions
authorise_user!("homepage_editor")
end
end
2 changes: 1 addition & 1 deletion test/functional/homepage_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class HomepageControllerTest < ActionController::TestCase
setup do
login_as_stub_user
login_as_homepage_editor
end

context "#show" do
Expand Down
Loading

0 comments on commit 9f1c422

Please sign in to comment.