Class: Blacklight::AccessControls::SearchBuilder
- Inherits:
-
SearchBuilder
- Object
- SearchBuilder
- Blacklight::AccessControls::SearchBuilder
- Defined in:
- lib/blacklight/access_controls/search_builder.rb
Overview
SearchBuilder that restricts access via Solr.
Note: solr_access_filters_logic is an Array of Symbols. It sets defaults. Each symbol identifies a method that must be in this class, taking two parameters (permission_types, ability). Can be changed in local apps or by plugins, e.g.:
Blacklight::AccessControls::SearchBuilder.solr_access_filters_logic += [:new_method]
Blacklight::AccessControls::SearchBuilder.solr_access_filters_logic.delete(:we_dont_want)
Instance Attribute Summary collapse
-
#ability ⇒ Object
readonly
Returns the value of attribute ability.
-
#permission_types ⇒ Object
readonly
Returns the value of attribute permission_types.
Instance Method Summary collapse
- #default_permission_types ⇒ Object
-
#initialize(scope, ability:, permission_types: default_permission_types) ⇒ SearchBuilder
constructor
A new instance of SearchBuilder.
Constructor Details
#initialize(scope, ability:, permission_types: default_permission_types) ⇒ SearchBuilder
Returns a new instance of SearchBuilder.
23 24 25 26 27 28 29 30 31 |
# File 'lib/blacklight/access_controls/search_builder.rb', line 23 def initialize(scope, ability:, permission_types: ) if self.class.included_modules.include? Blacklight::AccessControls::Enforcement raise 'You may not use Blacklight::AccessControls::SearchBuilder and ' \ 'include Blacklight::AccessControls::Enforcement on SearchBuilder at the same time' end super(scope) @ability = ability @permission_types = end |
Instance Attribute Details
#ability ⇒ Object (readonly)
Returns the value of attribute ability.
33 34 35 |
# File 'lib/blacklight/access_controls/search_builder.rb', line 33 def ability @ability end |
#permission_types ⇒ Object (readonly)
Returns the value of attribute permission_types.
33 34 35 |
# File 'lib/blacklight/access_controls/search_builder.rb', line 33 def @permission_types end |
Instance Method Details
#default_permission_types ⇒ Object
35 36 37 |
# File 'lib/blacklight/access_controls/search_builder.rb', line 35 def %w[discover read] end |