Module: Blacklight::AccessControls::Catalog

Extended by:
ActiveSupport::Concern
Defined in:
lib/blacklight/access_controls/catalog.rb

Overview

This is behavior for the catalog controller.

Instance Method Summary collapse

Instance Method Details

#enforce_show_permissions(_opts = {}) ⇒ Object

Controller “before” filter for enforcing access controls on show actions.

Parameters:

  • _opts (Hash) (defaults to: {})

    (optional, not currently used)



11
12
13
14
15
16
17
# File 'lib/blacklight/access_controls/catalog.rb', line 11

def enforce_show_permissions(_opts = {})
  permissions = current_ability.permissions_doc(params[:id])
  unless can? :read, permissions
    raise Blacklight::AccessControls::AccessDenied.new('You do not have sufficient access privileges to read this document, which has been marked private.', :read, params[:id])
  end
  permissions
end

#search_builderObject

This will work for BL 6, but will need to move to SearchService in BL 7



20
21
22
# File 'lib/blacklight/access_controls/catalog.rb', line 20

def search_builder
  Blacklight::AccessControls::SearchBuilder.new(self, ability: current_ability)
end