Module: Hyrax::Dashboard::ManagedSearchFilters
- Extended by:
- ActiveSupport::Concern
- Included in:
- CollectionsSearchBuilder, WorksSearchBuilder
- Defined in:
- app/search_builders/hyrax/dashboard/managed_search_filters.rb
Instance Method Summary collapse
-
#apply_group_permissions(permission_types, ability = current_ability) ⇒ Object
Override to exclude ‘public’ and ‘registered’ groups from read access.
-
#discovery_permissions ⇒ Object
This includes collection/admin the user can manage and view.
Instance Method Details
#apply_group_permissions(permission_types, ability = current_ability) ⇒ Object
Override to exclude ‘public’ and ‘registered’ groups from read access.
12 13 14 15 16 17 18 19 20 21 |
# File 'app/search_builders/hyrax/dashboard/managed_search_filters.rb', line 12 def (, ability = current_ability) groups = ability.user_groups return [] if groups.empty? .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 |
#discovery_permissions ⇒ Object
This includes collection/admin the user can manage and view.
7 8 9 |
# File 'app/search_builders/hyrax/dashboard/managed_search_filters.rb', line 7 def @discovery_permissions ||= %w[edit read] end |