Sha256: 31b676e3c92518e33bc57720d9f6bc9eaf487d0e83565959aa04863af665c6b6
Contents?: true
Size: 921 Bytes
Versions: 8
Compression:
Stored size: 921 Bytes
Contents
# frozen_string_literal: true 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 - [::Ability.public_group_name, ::Ability.registered_group_name] : 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
8 entries across 8 versions & 1 rubygems