app/services/hyrax/collections/permissions_create_service.rb in hyrax-3.0.2 vs app/services/hyrax/collections/permissions_create_service.rb in hyrax-3.1.0

- old
+ new

@@ -11,13 +11,14 @@ # @param grants [Array<Hash>] additional grants to apply to the new collection # @return [Hyrax::PermissionTemplate] def self.create_default(collection:, creating_user:, grants: []) collection_type = Hyrax::CollectionType.find_by_gid!(collection.collection_type_gid) access_grants = access_grants_attributes(collection_type: collection_type, creating_user: creating_user, grants: grants) - PermissionTemplate.create!(source_id: collection.id, - access_grants_attributes: access_grants.uniq) - collection.reset_access_controls! + template = PermissionTemplate.create!(source_id: collection.id, + access_grants_attributes: access_grants.uniq) + + template.reset_access_controls_for(collection: collection, interpret_visibility: true) end # @api public # # Add access grants to a collection @@ -36,10 +37,11 @@ Hyrax::PermissionTemplateAccess.find_or_create_by(permission_template_id: template.id, agent_type: grant[:agent_type], agent_id: grant[:agent_id], access: grant[:access]) end - collection.reset_access_controls! + + template.reset_access_controls_for(collection: collection, interpret_visibility: true) end # @api private # # Gather the default permissions needed for a new collection