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

Instance Method Details

#enforce_show_permissions(opts = {}) ⇒ Object

Action-specific enforcement Controller “before” filter for enforcing access controls on show actions

Parameters:

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

    (optional, not currently used)



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/concerns/hydra/catalog.rb', line 13

def enforce_show_permissions(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.
  permissions_doc = super

  if permissions_doc.under_embargo? && !can?(:edit, permissions_doc)
    raise Hydra::AccessDenied.new("This item is under embargo.  You do not have sufficient access privileges to read this document.", :edit, params[:id])
  end

  permissions_doc
end

#hydra_search_service_contextObject



33
34
35
# File 'app/controllers/concerns/hydra/catalog.rb', line 33

def hydra_search_service_context
  { current_ability: current_ability }
end

#search_service_contextHash

Returns a hash of context information to pass through to the search service.

Returns:

  • (Hash)

    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