Sha256: 929d4e85cbb5b443a5b9d7804e8cf997721ae4e82b9979d6ea50ec3a36132da7
Contents?: true
Size: 860 Bytes
Versions: 25
Compression:
Stored size: 860 Bytes
Contents
# frozen_string_literal: true module Hyrax module CustomQueries # @example # Hyrax.custom_queries.find_access_control_for(resource: resource) class FindAccessControl def self.queries [:find_access_control_for] end def initialize(query_service:) @query_service = query_service end attr_reader :query_service delegate :resource_factory, to: :query_service def find_access_control_for(resource:) query_service .find_inverse_references_by(resource: resource, property: :access_to) .find { |r| r.is_a?(Hyrax::AccessControl) } || raise(Valkyrie::Persistence::ObjectNotFoundError) rescue ArgumentError # some adapters raise ArgumentError for missing resources raise(Valkyrie::Persistence::ObjectNotFoundError) end end end end
Version data entries
25 entries across 25 versions & 1 rubygems