hydra-core 9.0.1 → 9.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: e650d3c0f70cb2d90248936821667a93f48119f1
4
- data.tar.gz: e1a5c28dde2dc3921dc0246adae37f51ce0f8ba1
3
+ metadata.gz: 35097c74f8d0a475d310fbf00ad56ca0ea227df3
4
+ data.tar.gz: 6d0c147bd22aabd48138d458b311af2e77d0053f
5
5
  SHA512:
6
- metadata.gz: b6a6294fa68a61b50d5f1745ca0252015056b95486c3e02d8d3c2522df1da39aba14328cbd2ab2e524601d8c4be9d29f589a3439b7717f0063e11afb0ac5239d
7
- data.tar.gz: 8874b3851b280c03c07773dedd99abde81c7945eddaf58ab02b755a647c1fbff8ae26bb2cfa64f02494e966a3dca85b6d443672c7ce258d453665231f0f68ebe
6
+ metadata.gz: b9bbda263576781c0898c3f7ad95e0118322ea652da45f234765c761281b013474accfe223e8381948b0b00f979a1ef49f1cd5a7d96ca6a5669c032470c13306
7
+ data.tar.gz: c81a296754a2c0d646073b1f22f5cbc90d85a64481286bb306667b05073a683dde1ff5dc751a338d6204b1611855b31c7b75864574bd41ef48b6570c16c5d9a3
@@ -12,14 +12,16 @@ 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, with: :deny_access
20
17
  end
21
18
 
22
- # get the currently configured user identifier. Can be overridden to return whatever (ie. login, email, etc)
19
+ # Override blacklight to produce a search_builder that has the current collection in context
20
+ def search_builder processor_chain = search_params_logic
21
+ super.tap { |builder| builder.current_ability = current_ability }
22
+ end
23
+
24
+ # get the currently configured user identifier. Can be overridden to return whatever (ie. login, email, etc)
23
25
  # defaults to using whatever you have set as the Devise authentication_key
24
26
  def user_key
25
27
  current_user.user_key if current_user
@@ -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,10 @@
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" %>
10
+
@@ -1,3 +1,3 @@
1
1
  module HydraHead
2
- VERSION = "9.0.1"
2
+ VERSION = "9.1.0"
3
3
  end
@@ -1,10 +1,15 @@
1
1
  # An EXAMPLE Basic Model for Assets that conform to Hydra commonMetadata cModel and have basic MODS metadata (currently "Article" is the MODS exemplar)
2
2
  class ModsAsset < ActiveFedora::Base
3
-
3
+ extend Deprecation
4
+
5
+ def initialize(*)
6
+ Deprecation.warn(ModsAsset, "ModsAsset is deprecated and will be removed in hydra-head 10")
7
+ super
8
+ end
9
+
4
10
  ## Convenience methods for manipulating the rights metadata datastream
5
11
  include Hydra::AccessControls::Permissions
6
-
12
+
7
13
  # adds helpful methods for basic hydra objects
8
14
  include Hydra::ModelMethods
9
-
10
15
  end
@@ -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: 9.0.1
4
+ version: 9.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-01-30 00:00:00.000000000 Z
12
+ date: 2015-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 9.0.1
34
+ version: 9.1.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 9.0.1
41
+ version: 9.1.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: jettywrapper
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -129,7 +129,7 @@ files:
129
129
  - app/models/concerns/hydra/models.rb
130
130
  - app/models/concerns/hydra/solr.rb
131
131
  - app/models/hydra/datastream/properties.rb
132
- - app/models/mods_asset.rb
132
+ - app/search_builders/hydra/search_builder.rb
133
133
  - config/jetty.yml
134
134
  - config/locales/hydra.en.yml
135
135
  - hydra-core.gemspec
@@ -138,11 +138,13 @@ files:
138
138
  - lib/generators/hydra/jetty_generator.rb
139
139
  - lib/generators/hydra/templates/ability.rb
140
140
  - lib/generators/hydra/templates/catalog_controller.rb
141
+ - lib/generators/hydra/templates/config/blacklight.yml
141
142
  - lib/generators/hydra/templates/config/initializers/hydra_config.rb
142
143
  - lib/generators/hydra/templates/config/role_map.yml
143
144
  - lib/hydra-core.rb
144
145
  - lib/hydra-head/engine.rb
145
146
  - lib/hydra-head/version.rb
147
+ - lib/mods_asset.rb
146
148
  - lib/railties/active-fedora.rake
147
149
  - lib/railties/hydra_jetty.rake
148
150
  - spec/.gitignore
@@ -150,11 +152,11 @@ files:
150
152
  - spec/controllers/downloads_controller_spec.rb
151
153
  - spec/factories.rb
152
154
  - spec/helpers/blacklight_helper_spec.rb
153
- - spec/lib/catalog_spec.rb
154
155
  - spec/lib/model_methods_spec.rb
155
156
  - spec/models/solr_document_spec.rb
156
157
  - spec/models/user_spec.rb
157
158
  - spec/rcov.opts
159
+ - spec/search_builders/search_builder_spec.rb
158
160
  - spec/spec.opts
159
161
  - spec/spec_helper.rb
160
162
  - spec/support/app/controllers/downloads_controller.rb
@@ -200,11 +202,11 @@ test_files:
200
202
  - spec/controllers/downloads_controller_spec.rb
201
203
  - spec/factories.rb
202
204
  - spec/helpers/blacklight_helper_spec.rb
203
- - spec/lib/catalog_spec.rb
204
205
  - spec/lib/model_methods_spec.rb
205
206
  - spec/models/solr_document_spec.rb
206
207
  - spec/models/user_spec.rb
207
208
  - spec/rcov.opts
209
+ - spec/search_builders/search_builder_spec.rb
208
210
  - spec/spec.opts
209
211
  - spec/spec_helper.rb
210
212
  - 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