hydra-core 8.0.0 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba7e8c28c9a948c53ca47121118a2c4948c52827
4
- data.tar.gz: db44e15d1c9635905cb3b528ce3925f5e853b597
3
+ metadata.gz: 524755f49fc5894eebc57fe4478a9eda2837d677
4
+ data.tar.gz: cb181741d88d6800382ea2266325246e7fcfaff1
5
5
  SHA512:
6
- metadata.gz: 7e52e69c0e0301648d27a6d21982575fac30ddcc45768bbd2a09bff23350bfdbf96f922af063020675ceaa67730afc072cec4ef91df95cfa70bda09d7f64f166
7
- data.tar.gz: ff9c9d7cbd6a2a10c4dca45c351e32e38abe093a4b3553bafa587c01112e218e6019b4e28e04233794f616e547e19fab2d121a549e3816d8667b88cee220b8b7
6
+ metadata.gz: 1605b6bc8c2ed8fa7ee0db8d6e3b37d509625225b6b425b89f2ef1ecd048f6b8c4e730bc27202814525743de6d899eccc0ebd56cded63751a8cbed4524b9a702
7
+ data.tar.gz: dfaa1e040c60b9833df5c3313800f3731ca738466589bc8d6190880873ec17f50c974e81e0211a6cc2d8c3a7f9119ae6889bd7590348423daa17a19d11892d22
@@ -12,9 +12,6 @@ module Hydra::Controller::ControllerBehavior
12
12
  extend ActiveSupport::Concern
13
13
 
14
14
  included do
15
- # Other modules to auto-include
16
- include Hydra::AccessControlsEnforcement
17
-
18
15
  # Catch permission errors
19
16
  rescue_from CanCan::AccessDenied do |exception|
20
17
  if (exception.action == :edit)
@@ -27,7 +24,11 @@ module Hydra::Controller::ControllerBehavior
27
24
  end
28
25
  end
29
26
  end
30
-
27
+
28
+ # Override blacklight to produce a search_builder that has the current collection in context
29
+ def search_builder processor_chain = search_params_logic
30
+ super.tap { |builder| builder.current_ability = current_ability }
31
+ end
31
32
 
32
33
  # get the currently configured user identifier. Can be overridden to return whatever (ie. login, email, etc)
33
34
  # defaults to using whatever you have set as the Devise authentication_key
@@ -0,0 +1,5 @@
1
+ module Hydra
2
+ class SearchBuilder < Blacklight::Solr::SearchBuilder
3
+ include Hydra::AccessControlsEnforcement
4
+ end
5
+ end
@@ -62,6 +62,8 @@ module Hydra
62
62
 
63
63
  # Fedora & Solr YAML files
64
64
  invoke('active_fedora:config')
65
+
66
+ copy_file 'config/blacklight.yml', force: true
65
67
  end
66
68
 
67
69
  # Add Hydra behaviors to the user model
@@ -8,10 +8,11 @@ class CatalogController < ApplicationController
8
8
  # These before_filters apply the hydra access controls
9
9
  before_filter :enforce_show_permissions, :only=>:show
10
10
  # This applies appropriate access controls to all solr queries
11
- CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
11
+ CatalogController.search_params_logic += [:add_access_controls_to_solr_params]
12
12
 
13
13
 
14
14
  configure_blacklight do |config|
15
+ config.search_builder_class = Hydra::SearchBuilder
15
16
  config.default_solr_params = {
16
17
  :qt => 'search',
17
18
  :rows => 10
@@ -0,0 +1,9 @@
1
+ development:
2
+ adapter: solr
3
+ url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/development" %>
4
+ test: &test
5
+ adapter: solr
6
+ url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/test" %>
7
+ production:
8
+ adapter: solr
9
+ url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/blacklight-core" %>
@@ -1,4 +1,4 @@
1
1
  module HydraHead
2
- VERSION = "8.0.0"
2
+ VERSION = "8.1.0"
3
3
  end
4
4
 
@@ -10,6 +10,14 @@ describe CatalogController do
10
10
  expect(controller).to be_an_instance_of CatalogController
11
11
  end
12
12
 
13
+ describe "configuration" do
14
+ let(:config) { CatalogController.blacklight_config }
15
+ describe "search_builder_class" do
16
+ subject {config.search_builder_class }
17
+ it { is_expected.to eq Hydra::SearchBuilder }
18
+ end
19
+ end
20
+
13
21
  describe "Paths Generated by Custom Routes:" do
14
22
  # paths generated by custom routes
15
23
  it "should map {:controller=>'catalog', :action=>'index'} to GET /catalog" do
@@ -48,12 +56,6 @@ describe CatalogController do
48
56
  end
49
57
 
50
58
  describe "filters" do
51
- describe "index" do
52
- it "should trigger enforce_index_permissions" do
53
- expect(controller).to receive(:add_access_controls_to_solr_params)
54
- get :index
55
- end
56
- end
57
59
  describe "show" do
58
60
  it "should trigger enforce_show_permissions" do
59
61
  allow(controller).to receive(:current_user).and_return(nil)
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Hydra::SearchBuilder do
4
+ let(:processor_chain) { [:add_access_controls_to_solr_params] }
5
+ let(:context) { double('context') }
6
+ let(:user) { double('user', user_key: 'joe') }
7
+ let(:current_ability) { double('ability', user_groups: [], current_user: user) }
8
+
9
+ subject { described_class.new(processor_chain, context) }
10
+ before { subject.current_ability = current_ability }
11
+
12
+ it "should extend classes with the necessary Hydra modules" do
13
+ expect(Hydra::SearchBuilder.included_modules).to include(Hydra::AccessControlsEnforcement)
14
+ end
15
+
16
+ context "when a query is generated" do
17
+ it "should triggers add_access_controls_to_solr_params" do
18
+ expect(subject).to receive(:add_access_controls_to_solr_params)
19
+ subject.query
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield,
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-26 00:00:00.000000000 Z
12
+ date: 2015-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 8.0.0
48
+ version: 8.1.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 8.0.0
55
+ version: 8.1.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: jettywrapper
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -144,6 +144,7 @@ files:
144
144
  - app/models/concerns/hydra/solr.rb
145
145
  - app/models/hydra/datastream/properties.rb
146
146
  - app/models/mods_asset.rb
147
+ - app/search_builders/hydra/search_builder.rb
147
148
  - config/jetty.yml
148
149
  - config/locales/hydra.en.yml
149
150
  - hydra-core.gemspec
@@ -153,6 +154,7 @@ files:
153
154
  - lib/generators/hydra/jetty_generator.rb
154
155
  - lib/generators/hydra/templates/ability.rb
155
156
  - lib/generators/hydra/templates/catalog_controller.rb
157
+ - lib/generators/hydra/templates/config/blacklight.yml
156
158
  - lib/generators/hydra/templates/config/initializers/hydra_config.rb
157
159
  - lib/generators/hydra/templates/config/role_map.yml
158
160
  - lib/hydra-core.rb
@@ -166,12 +168,12 @@ files:
166
168
  - spec/controllers/downloads_controller_spec.rb
167
169
  - spec/factories.rb
168
170
  - spec/helpers/blacklight_helper_spec.rb
169
- - spec/lib/catalog_spec.rb
170
171
  - spec/lib/model_methods_spec.rb
171
172
  - spec/models/mods_asset_spec.rb
172
173
  - spec/models/solr_document_spec.rb
173
174
  - spec/models/user_spec.rb
174
175
  - spec/rcov.opts
176
+ - spec/search_builders/search_builder_spec.rb
175
177
  - spec/spec.opts
176
178
  - spec/spec_helper.rb
177
179
  - spec/support/app/controllers/downloads_controller.rb
@@ -221,12 +223,12 @@ test_files:
221
223
  - spec/controllers/downloads_controller_spec.rb
222
224
  - spec/factories.rb
223
225
  - spec/helpers/blacklight_helper_spec.rb
224
- - spec/lib/catalog_spec.rb
225
226
  - spec/lib/model_methods_spec.rb
226
227
  - spec/models/mods_asset_spec.rb
227
228
  - spec/models/solr_document_spec.rb
228
229
  - spec/models/user_spec.rb
229
230
  - spec/rcov.opts
231
+ - spec/search_builders/search_builder_spec.rb
230
232
  - spec/spec.opts
231
233
  - spec/spec_helper.rb
232
234
  - spec/support/app/controllers/downloads_controller.rb
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Hydra::Controller::ControllerBehavior do
4
-
5
- before do
6
- class CatalogTest < ApplicationController
7
- include Hydra::Controller::ControllerBehavior
8
- end
9
- end
10
-
11
- it "should extend classes with the necessary Hydra modules" do
12
- expect(CatalogTest.included_modules).to include(Hydra::AccessControlsEnforcement)
13
- end
14
-
15
- end