Sha256: d675af0e0d694c219abc107949622a03423a210324cfd2bcfc7731ddcbbf8fe7

Contents?: true

Size: 756 Bytes

Versions: 9

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  # Grants read access for the supplied user for the members attached to a work
  module MembersPermissionJobBehavior
    extend ActiveSupport::Concern

    included do
      queue_as Hyrax.config.ingest_queue_name
    end

    private

    # Filter the member ids and return only the FileSet ids (filter out child works)
    # @return [Array<String>] the file set ids
    def file_set_ids(work)
      case work
      when ActiveFedora::Base
        ::FileSet.search_with_conditions(id: work.member_ids).map(&:id)
      when Valkyrie::Resource
        Hyrax.custom_queries.find_child_fileset_ids(resource: work)
      end
    end

    def use_valkyrie?(work)
      work.is_a? Valkyrie::Resource
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hyrax-3.3.0 app/jobs/concerns/hyrax/members_permission_job_behavior.rb
hyrax-3.2.0 app/jobs/concerns/hyrax/members_permission_job_behavior.rb
hyrax-3.1.0 app/jobs/concerns/hyrax/members_permission_job_behavior.rb
hyrax-3.0.2 app/jobs/concerns/hyrax/members_permission_job_behavior.rb
hyrax-3.0.1 app/jobs/concerns/hyrax/members_permission_job_behavior.rb
hyrax-3.0.0 app/jobs/concerns/hyrax/members_permission_job_behavior.rb
hyrax-3.0.0.pre.rc4 app/jobs/concerns/hyrax/members_permission_job_behavior.rb
hyrax-3.0.0.pre.rc3 app/jobs/concerns/hyrax/members_permission_job_behavior.rb
hyrax-3.0.0.pre.rc2 app/jobs/concerns/hyrax/members_permission_job_behavior.rb