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