From 276201b1e67f69153a58b6c64219295071d6f1f5 Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Sat, 16 Dec 2023 15:11:30 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Begin=20work=20on=20Roles=20Serv?= =?UTF-8?q?ice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Working with Permission Templates has changed, requiring an adjustment to both logic and specs. --- app/services/roles_service.rb | 4 ++-- spec/services/roles_service_spec.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/services/roles_service.rb b/app/services/roles_service.rb index fc8965229c..dbf88832cc 100644 --- a/app/services/roles_service.rb +++ b/app/services/roles_service.rb @@ -128,7 +128,7 @@ def create_collection_accesses! agent_id: 'collection_reader' ) - c.reset_access_controls! if pt.access_grants.count != original_access_grants_count + pt.reset_access_controls_for(collection: col) if pt.access_grants.count != original_access_grants_count end end # rubocop:enable Metrics/MethodLength @@ -165,7 +165,7 @@ def create_admin_set_accesses! agent_id: 'work_editor' ) - as.reset_access_controls! if pt.access_grants.count != original_access_grants_count + pt.reset_access_controls_for(collection: as) if pt.access_grants.count != original_access_grants_count end end # rubocop:enable Metrics/MethodLength diff --git a/spec/services/roles_service_spec.rb b/spec/services/roles_service_spec.rb index 71ac2a8a4a..8db8ad79fe 100644 --- a/spec/services/roles_service_spec.rb +++ b/spec/services/roles_service_spec.rb @@ -158,7 +158,7 @@ end it "does not reset the Collection's access controls unnecessarily" do - expect_any_instance_of(Collection).not_to receive(:reset_access_controls!) + expect_any_instance_of(Hyrax::PermissionTemplate).not_to receive(:reset_access_controls_for) roles_service.create_collection_accesses! end @@ -236,7 +236,7 @@ end it "resets the Collection's access controls" do - expect_any_instance_of(Collection).to receive(:reset_access_controls!).once + expect_any_instance_of(Hyrax::PermissionTemplate).to receive(:reset_access_controls_for).once roles_service.create_collection_accesses! end @@ -253,7 +253,7 @@ end it "does not reset the AdminSet's access controls unnecessarily" do - expect_any_instance_of(AdminSet).not_to receive(:reset_access_controls!) + expect_any_instance_of(Hyrax::PermissionTemplate).not_to receive(:reset_access_controls_for) roles_service.create_admin_set_accesses! end @@ -351,7 +351,7 @@ end it "resets the AdminSet's access controls" do - expect_any_instance_of(AdminSet).to receive(:reset_access_controls!).once + expect_any_instance_of(Hyrax::PermissionTemplate).to receive(:reset_access_controls_for).once roles_service.create_admin_set_accesses! end