hydra-core 10.7.0 → 11.0.0.rc1

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
  SHA256:
3
- metadata.gz: 7fe0e77d02df92e63332dfe2a0ef486481c65aa7c5181922de794a6b73d17498
4
- data.tar.gz: '08b6a798b74846db15e6a6c84052dd8145ca468155e5fa7270fbe71dc1b36dc8'
3
+ metadata.gz: 19d850d13eafcff9bae87313b3cebc8105112e7a88ba647d5990e9cd8e11ade4
4
+ data.tar.gz: fff6f63fd06dfb2ecf1e2b1d156c125bba73f5a4ecc705c0f4446d6262e69f0e
5
5
  SHA512:
6
- metadata.gz: 76df79ed1ee09194a704ab8709d10ee29348f3421d1620da21807867370a8d872777e91e7f2cebc964708722b93d618bddf85732586b34266b848e7d4a2ec6b9
7
- data.tar.gz: bd5a1bccbae0bfdd9e8f58128f41c94f04c128c6d83f7413b8dd8b47b6d4e09e1f11e5fc9d8a588e29342d71db77b96b206c026a8c76b29010f766fe8e077157
6
+ metadata.gz: ec47478235d34b1f5f80b225b2b3fd1e63d5a45b37341043d21e05dbff9c2efbebf20d029058ed8a3d4677f04aeeea2d1bab0d5241c611aea58ccb169d57cdfe
7
+ data.tar.gz: 024e396c84e36581c5468e9ee7817fa014dff09913e885ba9d3bf27e42edef22c10e299590eae227e50d5083f87bba44d1843ec77c21c7a3d73c2abd78891ca5
@@ -3,6 +3,11 @@ module Hydra::Catalog
3
3
  include Blacklight::Catalog
4
4
  include Blacklight::AccessControls::Catalog
5
5
 
6
+ # This will work for BL 6, but will need to move to SearchService in BL 7
7
+ def search_builder
8
+ Hydra::AccessControls::SearchBuilder.new(self, ability: current_ability)
9
+ end
10
+
6
11
  # Action-specific enforcement
7
12
  # Controller "before" filter for enforcing access controls on show actions
8
13
  # @param [Hash] opts (optional, not currently used)
@@ -125,7 +125,11 @@ module Hydra
125
125
  unless response.headers["Last-Modified"] || response.headers["ETag"]
126
126
  Rails.logger.warn("Response may be buffered instead of streaming, best to set a Last-Modified or ETag header")
127
127
  end
128
- self.response_body = iostream
128
+ iostream.each do |in_buff|
129
+ response.stream.write in_buff
130
+ end
131
+ ensure
132
+ response.stream.close
129
133
  end
130
134
 
131
135
  def default_file
@@ -4,7 +4,7 @@ version = File.read(File.expand_path("../../HYDRA_VERSION", __FILE__)).strip
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield, Justin Coyne & many more. See https://github.com/projecthydra/hydra-head/contributors"]
6
6
  gem.email = ["hydra-tech@googlegroups.com"]
7
- gem.homepage = "https://github.com/samvera/hydra-head/tree/master/hydra-core"
7
+ gem.homepage = "http://projecthydra.org"
8
8
  gem.summary = %q{Hydra-Head Rails Engine (requires Rails3) }
9
9
  gem.description = %q{Hydra-Head is a Rails Engine containing the core code for a Hydra application. The full hydra stack includes: Blacklight, Fedora, Solr, active-fedora, solrizer, and om}
10
10
 
@@ -18,10 +18,10 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.required_ruby_version = '>= 1.9.3'
20
20
 
21
- gem.add_dependency 'hydra-access-controls', version
22
21
  gem.add_dependency "railties", '>= 4.0.0', '< 6'
22
+ gem.add_dependency 'hydra-access-controls', version
23
23
 
24
- gem.add_development_dependency 'rails-controller-testing', '~> 1'
25
- gem.add_development_dependency 'rspec-rails', '~> 3.1'
26
24
  gem.add_development_dependency 'sqlite3', '~> 1.3'
25
+ gem.add_development_dependency 'rspec-rails', '~> 3.1'
26
+ gem.add_development_dependency 'factory_bot_rails', '~> 4.8.2'
27
27
  end
@@ -49,14 +49,6 @@ module Hydra
49
49
  end
50
50
  end
51
51
 
52
- # Add Hydra to the SearchBuilder
53
- def inject_hydra_search_builder_behavior
54
- insert_into_file "app/models/search_builder.rb", after: "include Blacklight::Solr::SearchBuilderBehavior\n" do
55
- " # Add a filter query to restrict the search to documents the current user has access to\n" \
56
- " include Hydra::AccessControlsEnforcement\n"
57
- end
58
- end
59
-
60
52
  # Copy all files in templates/config directory to host config
61
53
  def create_configuration_files
62
54
 
@@ -79,7 +71,7 @@ module Hydra
79
71
  def create_conneg_configuration
80
72
  file_path = "config/initializers/mime_types.rb"
81
73
  append_to_file file_path do
82
- "Mime::Type.register \"application/n-triples\", :nt\n" +
74
+ "Mime::Type.register \"application/n-triples\", :nt\n" +
83
75
  "Mime::Type.register \"application/ld+json\", :jsonld\n" +
84
76
  "Mime::Type.register \"text/turtle\", :ttl"
85
77
  end
@@ -89,7 +81,7 @@ module Hydra
89
81
  file_path = "app/models/solr_document.rb"
90
82
  if File.exists?(file_path)
91
83
  inject_into_file file_path, :before => /end\Z/ do
92
- "\n # Do content negotiation for AF models. \n" +
84
+ "\n # Do content negotiation for AF models. \n" +
93
85
  "\n use_extension( Hydra::ContentNegotiation )\n"
94
86
  end
95
87
  end
@@ -1,3 +1,3 @@
1
1
  module HydraHead
2
- VERSION = "10.7.0"
2
+ VERSION = "11.0.0.rc1"
3
3
  end
@@ -0,0 +1,11 @@
1
+ FactoryBot.define do
2
+ sequence :email do |n|
3
+ "person#{n}@example.com"
4
+ end
5
+
6
+ factory :user do
7
+ email
8
+ password 'password'
9
+ end
10
+
11
+ end
@@ -32,7 +32,7 @@ describe User do
32
32
  end
33
33
 
34
34
  describe "#groups" do
35
- let(:user) { described_class.new }
35
+ let(:user) { FactoryBot.create(:user) }
36
36
  let(:mock_service) { double }
37
37
  before do
38
38
  user.group_service = mock_service
@@ -1,23 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe SearchBuilder do
4
- let(:processor_chain) { [:add_access_controls_to_solr_params] }
5
- let(:context) { double('context') }
3
+ describe Hydra::AccessControls::SearchBuilder do
4
+ let(:config) { CatalogController.blacklight_config }
5
+ let(:context) { double('context', blacklight_config: config) }
6
6
  let(:user) { double('user', user_key: 'joe') }
7
- let(:current_ability) { double('ability', user_groups: [], current_user: user) }
7
+ let(:current_ability) do
8
+ double('ability', user_groups: [], current_user: user)
9
+ end
10
+
8
11
  let(:search_builder) { described_class }
9
12
 
10
13
  subject do
11
- search_builder.new(processor_chain, context)
12
- end
13
-
14
- it "extends classes with the necessary Hydra modules" do
15
- expect(described_class.included_modules).to include(Hydra::AccessControlsEnforcement)
14
+ search_builder.new(context, ability: current_ability)
16
15
  end
17
16
 
18
17
  context "when a query is generated" do
19
18
  it "triggers add_access_controls_to_solr_params" do
20
- expect(subject).to receive(:add_access_controls_to_solr_params)
19
+ expect(subject).to receive(:apply_gated_discovery)
21
20
  subject.query
22
21
  end
23
22
  end
@@ -1,6 +1,4 @@
1
- # frozen_string_literal: true
2
-
3
- ENV['RAILS_ENV'] ||= 'test'
1
+ ENV["RAILS_ENV"] ||= "test"
4
2
 
5
3
  require 'engine_cart'
6
4
  path = File.expand_path(File.join('..', '..', '..', '.internal_test_app'), __FILE__)
@@ -9,19 +7,15 @@ EngineCart.load_application! path
9
7
  require 'bundler/setup'
10
8
  require 'rspec/rails'
11
9
  require 'hydra-core'
10
+ require "factory_bot"
11
+ require "factories"
12
12
 
13
- require 'simplecov'
14
- require 'coveralls'
13
+ if ENV['COVERAGE']
14
+ require 'simplecov'
15
+ require 'simplecov-rcov'
15
16
 
16
- SimpleCov.root(File.expand_path('../..', __dir__))
17
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
18
- [
19
- SimpleCov::Formatter::HTMLFormatter,
20
- Coveralls::SimpleCov::Formatter
21
- ]
22
- )
23
- SimpleCov.start('rails') do
24
- add_filter %r{lib/generators/.*\.rb}
17
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
18
+ SimpleCov.start
25
19
  end
26
20
 
27
21
  ActiveFedora::Base.logger = Logger.new(STDOUT)
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: 10.7.0
4
+ version: 11.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield,
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-08-21 00:00:00.000000000 Z
12
+ date: 2018-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: hydra-access-controls
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - '='
19
- - !ruby/object:Gem::Version
20
- version: 10.7.0
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - '='
26
- - !ruby/object:Gem::Version
27
- version: 10.7.0
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: railties
30
16
  requirement: !ruby/object:Gem::Requirement
@@ -46,19 +32,33 @@ dependencies:
46
32
  - !ruby/object:Gem::Version
47
33
  version: '6'
48
34
  - !ruby/object:Gem::Dependency
49
- name: rails-controller-testing
35
+ name: hydra-access-controls
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 11.0.0.rc1
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 11.0.0.rc1
48
+ - !ruby/object:Gem::Dependency
49
+ name: sqlite3
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1'
54
+ version: '1.3'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1'
61
+ version: '1.3'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rspec-rails
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -74,19 +74,19 @@ dependencies:
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3.1'
76
76
  - !ruby/object:Gem::Dependency
77
- name: sqlite3
77
+ name: factory_bot_rails
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.3'
82
+ version: 4.8.2
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.3'
89
+ version: 4.8.2
90
90
  description: 'Hydra-Head is a Rails Engine containing the core code for a Hydra application.
91
91
  The full hydra stack includes: Blacklight, Fedora, Solr, active-fedora, solrizer,
92
92
  and om'
@@ -131,6 +131,7 @@ files:
131
131
  - spec/controllers/catalog_controller_spec.rb
132
132
  - spec/controllers/downloads_controller_spec.rb
133
133
  - spec/controllers/ip_based_ability_spec.rb
134
+ - spec/factories.rb
134
135
  - spec/helpers/blacklight_helper_spec.rb
135
136
  - spec/models/content_negotiation/replacing_graph_finder_spec.rb
136
137
  - spec/models/solr_document_spec.rb
@@ -145,7 +146,7 @@ files:
145
146
  - spec/support/matchers/solr_matchers.rb
146
147
  - spec/unit/hydra-head-engine_spec.rb
147
148
  - spec/unit/hydra-head_spec.rb
148
- homepage: https://github.com/samvera/hydra-head/tree/master/hydra-core
149
+ homepage: http://projecthydra.org
149
150
  licenses:
150
151
  - APACHE2
151
152
  metadata: {}
@@ -160,11 +161,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
161
  version: 1.9.3
161
162
  required_rubygems_version: !ruby/object:Gem::Requirement
162
163
  requirements:
163
- - - ">="
164
+ - - ">"
164
165
  - !ruby/object:Gem::Version
165
- version: '0'
166
+ version: 1.3.1
166
167
  requirements: []
167
- rubygems_version: 3.0.1
168
+ rubyforge_project:
169
+ rubygems_version: 2.7.1
168
170
  signing_key:
169
171
  specification_version: 4
170
172
  summary: Hydra-Head Rails Engine (requires Rails3)
@@ -173,6 +175,7 @@ test_files:
173
175
  - spec/controllers/catalog_controller_spec.rb
174
176
  - spec/controllers/downloads_controller_spec.rb
175
177
  - spec/controllers/ip_based_ability_spec.rb
178
+ - spec/factories.rb
176
179
  - spec/helpers/blacklight_helper_spec.rb
177
180
  - spec/models/content_negotiation/replacing_graph_finder_spec.rb
178
181
  - spec/models/solr_document_spec.rb