app/services/hyrax/collections/permissions_create_service.rb in hyrax-3.0.0.pre.rc1 vs app/services/hyrax/collections/permissions_create_service.rb in hyrax-3.0.0.pre.rc2

- old
+ new

@@ -1,13 +1,14 @@ +# frozen_string_literal: true module Hyrax module Collections class PermissionsCreateService # @api public # # Set the default permissions for a (newly created) collection # - # @param collection [Collection] the collection the new permissions will act on + # @param collection [::Collection] the collection the new permissions will act on # @param creating_user [User] the user that created the collection # @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) @@ -27,10 +28,10 @@ # [ { agent_type: Hyrax::PermissionTemplateAccess::GROUP, # agent_id: 'my_group_name', # access: Hyrax::PermissionTemplateAccess::DEPOSIT } ] # @see Hyrax::PermissionTemplateAccess for valid values for agent_type and access def self.add_access(collection_id:, grants:) - collection = Collection.find(collection_id) + collection = ::Collection.find(collection_id) template = Hyrax::PermissionTemplate.find_by!(source_id: collection_id) grants.each do |grant| Hyrax::PermissionTemplateAccess.find_or_create_by(permission_template_id: template.id, agent_type: grant[:agent_type], agent_id: grant[:agent_id],