From 977a63fa3790b2733ab90ea1d5f518998dfcf2b7 Mon Sep 17 00:00:00 2001 From: Joseph Kempster Date: Tue, 5 Sep 2023 15:05:11 +0100 Subject: [PATCH] Add `Site manager` permission 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 579522+CristinaRO@users.noreply.github.com --- app/models/user.rb | 4 ++++ features/step_definitions/authentication_steps.rb | 5 +++++ spec/factories/users.rb | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index 9825515bb..14483334e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/features/step_definitions/authentication_steps.rb b/features/step_definitions/authentication_steps.rb index f4eac4ab4..058f03395 100644 --- a/features/step_definitions/authentication_steps.rb +++ b/features/step_definitions/authentication_steps.rb @@ -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 + diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 2535e81e4..b83d59944 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -11,5 +11,9 @@ factory :admin do permissions { ["signin", "GDS Editor", "admin"] } end + + factory :site_manager do + permissions { ["signin", "Site Manager"] } + end end end