Skip to content

Commit

Permalink
Add Site manager permission
Browse files Browse the repository at this point in the history
We are in the process of archiving Transition Config, which requires that we
add various bits of functionality to Transition.

In order to test these safely, we have added a new `Site manager` permission to
Signon.

This adds the permission to the user model, as well as some test helpers.

Co-authored-by: CristinaRO [email protected]
  • Loading branch information
jkempster34 committed Sep 5, 2023
1 parent a2ed788 commit 977a63f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def gds_editor?
permissions.include?("GDS Editor")
end

def site_manager?
permissions.include?("Site Manager")
end

def can_edit_sites
@can_edit_sites ||= {}
end
Expand Down
5 changes: 5 additions & 0 deletions features/step_definitions/authentication_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@
Given(/^I have logged in as a member of another organisation$/) do
GDS::SSO.test_user = create(:user, organisation_content_id: SecureRandom.uuid)
end

Given(/^I have logged in as a Site Manager$/) do
GDS::SSO.test_user = create(:site_manager)
end

Check failure on line 35 in features/step_definitions/authentication_steps.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Layout/TrailingEmptyLines: 1 trailing blank lines detected. (https://rubystyle.guide#newline-eof)
4 changes: 4 additions & 0 deletions spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@
factory :admin do
permissions { ["signin", "GDS Editor", "admin"] }
end

factory :site_manager do
permissions { ["signin", "Site Manager"] }
end
end
end

0 comments on commit 977a63f

Please sign in to comment.