Module: Hydra::Catalog
- Extended by:
- ActiveSupport::Concern
- Includes:
- Blacklight::AccessControls::Catalog, Blacklight::Catalog
- Included in:
- CatalogController
- Defined in:
- app/controllers/concerns/hydra/catalog.rb
Instance Method Summary collapse
-
#enforce_show_permissions(opts = {}) ⇒ Object
Action-specific enforcement Controller “before” filter for enforcing access controls on show actions.
- #hydra_search_service_context ⇒ Object
-
#search_service_context ⇒ Hash
A hash of context information to pass through to the search service.
Instance Method Details
#enforce_show_permissions(opts = {}) ⇒ Object
Action-specific enforcement Controller “before” filter for enforcing access controls on show actions
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/concerns/hydra/catalog.rb', line 13 def (opts={}) # The "super" method comes from blacklight-access_controls. # It will check the read permissions for the record. # By default, it will return a Hydra::PermissionsSolrDocument # that contains the permissions fields for that record # so that you can perform additional permissions checks. = super if . && !can?(:edit, ) raise Hydra::AccessDenied.new("This item is under embargo. You do not have sufficient access privileges to read this document.", :edit, params[:id]) end end |
#hydra_search_service_context ⇒ Object
33 34 35 |
# File 'app/controllers/concerns/hydra/catalog.rb', line 33 def hydra_search_service_context { current_ability: current_ability } end |
#search_service_context ⇒ Hash
Returns a hash of context information to pass through to the search service.
29 30 31 |
# File 'app/controllers/concerns/hydra/catalog.rb', line 29 def search_service_context ((super if defined?(super)) || {}).merge(hydra_search_service_context) end |