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

Revert "Merge pull request #2495 from alphagov/enable-permission-rest… #2500

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
description: "Update the publications edit page to use the GOV.UK Design System"

feature :restrict_access_by_org,
default: true,
default: false,
description: "Restrict access to editions based on the user's org and which org(s) own the edition"

feature :show_link_to_content_block_manager,
Expand Down
22 changes: 11 additions & 11 deletions test/functional/editions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class EditionsControllerTest < ActionController::TestCase
setup do
login_as_stub_user
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, true)
test_strategy.switch!(:restrict_access_by_org, false)
@edition = FactoryBot.create(:edition, :fact_check)
@welsh_edition = FactoryBot.create(:edition, :fact_check, :welsh)
end
Expand Down Expand Up @@ -46,16 +46,6 @@ class EditionsControllerTest < ActionController::TestCase
end

context "when 'restrict_access_by_org' feature toggle is disabled" do
setup do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, false)
end

teardown do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, true)
end

%i[show metadata history admin related_external_links unpublish].each do |action|
context "##{action}" do
setup do
Expand All @@ -74,6 +64,16 @@ class EditionsControllerTest < ActionController::TestCase
end

context "when 'restrict_access_by_org' feature toggle is enabled" do
setup do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, true)
end

teardown do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, false)
end

%i[show metadata history admin related_external_links unpublish].each do |action|
context "##{action}" do
setup do
Expand Down
22 changes: 11 additions & 11 deletions test/functional/legacy_editions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class LegacyEditionsControllerTest < ActionController::TestCase
stub_holidays_used_by_fact_check

test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, true)
test_strategy.switch!(:restrict_access_by_org, false)
end

context "#create" do
Expand Down Expand Up @@ -1309,16 +1309,6 @@ class LegacyEditionsControllerTest < ActionController::TestCase
end

context "when 'restrict_access_by_org' feature toggle is disabled" do
setup do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, false)
end

teardown do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, true)
end

%i[metadata history].each do |action|
context "##{action}" do
setup do
Expand All @@ -1337,6 +1327,16 @@ class LegacyEditionsControllerTest < ActionController::TestCase
end

context "when 'restrict_access_by_org' feature toggle is enabled" do
setup do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, true)
end

teardown do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:restrict_access_by_org, false)
end

%i[show metadata history admin unpublish duplicate update linking update_tagging update_related_external_links review destroy progress diff process_unpublish diagram].each do |action|
context "##{action}" do
setup do
Expand Down
2 changes: 1 addition & 1 deletion test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def setup
end

test "#gds_editor? is false if user's organisation is not GDS" do
user = FactoryBot.create(:user, organisation_slug: "some-other-org", organisation_content_id: "some-other-org-id")
user = FactoryBot.create(:user, organisation_slug: "some-other-org")

assert_not user.gds_editor?
end
Expand Down
1 change: 0 additions & 1 deletion test/support/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
sequence(:uid) { |n| "uid-#{n}" }
sequence(:name) { |n| "Joe Bloggs #{n}" }
sequence(:email) { |n| "joe#{n}@bloggs.com" }
organisation_content_id { PublishService::GDS_ORGANISATION_ID }

if defined?(GDS::SSO::Config)
# Grant permission to signin to the app using the gem
Expand Down
Loading