Skip to content

Commit

Permalink
🧹 Begin work on Roles Service
Browse files Browse the repository at this point in the history
Working with Permission Templates has changed, requiring an adjustment
to both logic and specs.
  • Loading branch information
LaRita Robinson committed Dec 16, 2023
1 parent fd1c932 commit 276201b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/services/roles_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions spec/services/roles_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 276201b

Please sign in to comment.