Sha256: 49a9b9540a2446fc966ec0575e95aa91b655677c11b8acc65c3762e511b1f3df

Contents?: true

Size: 853 Bytes

Versions: 36

Compression:

Stored size: 853 Bytes

Contents

module Hyrax
  module Dashboard
    module ManagedSearchFilters
      extend ActiveSupport::Concern

      # This includes collection/admin the user can manage and view.
      def discovery_permissions
        @discovery_permissions ||= %w[edit read]
      end

      # Override to exclude 'public' and 'registered' groups from read access.
      def apply_group_permissions(permission_types, ability = current_ability)
        groups = ability.user_groups
        return [] if groups.empty?
        permission_types.map do |type|
          field = solr_field_for(type, 'group')
          user_groups = type == 'read' ? groups - ['public', 'registered'] : groups
          next if user_groups.empty?
          "({!terms f=#{field}}#{user_groups.join(',')})" # parens required to properly OR the clauses together.
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.9.5 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.9.4 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.9.3 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.9.2 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.9.1 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.9.0 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.8.0 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.7.2 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.7.1 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.7.0 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.6.0 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-3.0.0.pre.rc1 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-3.0.0.pre.beta3 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.5.1 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.5.0 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-3.0.0.pre.beta2 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.4.1 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-3.0.0.pre.beta1 app/search_builders/hyrax/dashboard/managed_search_filters.rb
hyrax-2.4.0 app/search_builders/hyrax/dashboard/managed_search_filters.rb