Module: Hydra::Controller::ControllerBehavior
- Extended by:
- ActiveSupport::Concern
- Included in:
- CatalogController
- Defined in:
- app/controllers/concerns/hydra/controller/controller_behavior.rb
Overview
Include this module into any of your Controller classes to add Hydra functionality
The primary function of this module is to mix in a number of other Hydra Modules, including
Hydra::AccessControlsEnforcement
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#deny_access(exception) ⇒ Object
Override this method if you wish to customize the way access is denied.
-
#search_builder(processor_chain = search_params_logic) ⇒ Object
Override blacklight to produce a search_builder that has the current collection in context.
-
#user_key ⇒ Object
defaults to using whatever you have set as the Devise authentication_key.
Instance Method Details
#deny_access(exception) ⇒ Object
Override this method if you wish to customize the way access is denied
31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/concerns/hydra/controller/controller_behavior.rb', line 31 def deny_access(exception) if exception.action == :edit redirect_to({ action: 'show' }, alert: exception.) elsif current_user and current_user.persisted? redirect_to root_path, alert: exception. else session['user_return_to'.freeze] = request.url redirect_to new_user_session_path, alert: exception. end end |
#search_builder(processor_chain = search_params_logic) ⇒ Object
Override blacklight to produce a search_builder that has the current collection in context
20 21 22 |
# File 'app/controllers/concerns/hydra/controller/controller_behavior.rb', line 20 def search_builder processor_chain = search_params_logic super.tap { |builder| builder.current_ability = current_ability } end |
#user_key ⇒ Object
defaults to using whatever you have set as the Devise authentication_key
26 27 28 |
# File 'app/controllers/concerns/hydra/controller/controller_behavior.rb', line 26 def user_key current_user.user_key if current_user end |