blacklight-access_controls 0.7.0.rc1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/VERSION +1 -1
- data/blacklight-access_controls.gemspec +1 -1
- data/lib/blacklight/access_controls/catalog.rb +1 -1
- data/lib/blacklight/access_controls/permissions_query.rb +11 -2
- data/spec/test_app_templates/Gemfile.extra +3 -0
- data/spec/unit/blacklight/access_controls/search_builder_spec.rb +2 -1
- data/spec/unit/catalog_spec.rb +14 -2
- data/spec/unit/enforcement_spec.rb +2 -1
- metadata +15 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1432718300b52451d466cc04768b4c9c0e96f6cd642618fe6634d7de19a98dc0
|
4
|
+
data.tar.gz: 8ecd44bb67934ca4e5e2eab5f97211fefef0c30b35b74896f96737e08ded9977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '018a2d0bce5a6e1f41cce61631117535fa9fdddc80ea598d2ef16a1a76633ba9c70f1f5c075e4625cd924c22a1fe7233296d6e0437a3247f505ea2085c5116d3'
|
7
|
+
data.tar.gz: 2c4a64bb4342cf51bbbc6e1d8690bdbc713b1ce9b84ab978ac8fe0db16803b50a9e5c2b837591e950c246fc75fab4078fc68e9c208aebe9fe7fbd2943c9dd598
|
data/.travis.yml
CHANGED
@@ -5,10 +5,12 @@ notifications:
|
|
5
5
|
email: false
|
6
6
|
|
7
7
|
rvm:
|
8
|
-
- 2.
|
8
|
+
- 2.5.1
|
9
9
|
|
10
10
|
env:
|
11
|
-
- "RAILS_VERSION=5.
|
11
|
+
- "BLACKLIGHT_VERSION=master RAILS_VERSION=5.2.1"
|
12
|
+
- "RAILS_VERSION=5.2.1"
|
13
|
+
- "RAILS_VERSION=5.1.6"
|
12
14
|
|
13
15
|
global_env:
|
14
16
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.0
|
1
|
+
0.7.0
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
|
18
18
|
gem.required_ruby_version = '>= 2.1.0'
|
19
19
|
|
20
|
-
gem.add_dependency 'blacklight', '
|
20
|
+
gem.add_dependency 'blacklight', '> 6.0', '< 8'
|
21
21
|
gem.add_dependency 'cancancan', '~> 1.8'
|
22
22
|
gem.add_dependency 'deprecation', '~> 1.0'
|
23
23
|
|
@@ -18,7 +18,7 @@ module Blacklight
|
|
18
18
|
|
19
19
|
# This will work for BL 6, but will need to move to SearchService in BL 7
|
20
20
|
def search_builder
|
21
|
-
Blacklight::AccessControls::SearchBuilder.new(self, current_ability)
|
21
|
+
Blacklight::AccessControls::SearchBuilder.new(self, ability: current_ability)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -13,12 +13,17 @@ module Blacklight::AccessControls
|
|
13
13
|
doc
|
14
14
|
end
|
15
15
|
|
16
|
+
# This is only valid for, and should only be used for blacklight 6
|
16
17
|
def permissions_document_class
|
17
|
-
|
18
|
+
blacklight_config.document_model
|
18
19
|
end
|
19
20
|
|
20
21
|
protected
|
21
22
|
|
23
|
+
def blacklight_config
|
24
|
+
CatalogController.blacklight_config
|
25
|
+
end
|
26
|
+
|
22
27
|
# a solr query method
|
23
28
|
# retrieve a solr document, given the doc id
|
24
29
|
# Modeled on Blacklight::SolrHelper.get_permissions_solr_response_for_doc_id
|
@@ -28,7 +33,11 @@ module Blacklight::AccessControls
|
|
28
33
|
raise Blacklight::Exceptions::RecordNotFound, 'The application is trying to retrieve permissions without specifying an asset id' if id.nil?
|
29
34
|
solr_opts = permissions_solr_doc_params(id).merge(extra_controller_params)
|
30
35
|
response = Blacklight.default_index.connection.get('select', params: solr_opts)
|
31
|
-
|
36
|
+
|
37
|
+
# Passing :blacklight_config is required for Blacklight 7, :document_model is required for Blacklight 6
|
38
|
+
solr_response = Blacklight::Solr::Response.new(response, solr_opts,
|
39
|
+
blacklight_config: blacklight_config,
|
40
|
+
document_model: permissions_document_class)
|
32
41
|
|
33
42
|
raise Blacklight::Exceptions::RecordNotFound, "The solr permissions search handler didn't return anything for id \"#{id}\"" if solr_response.docs.empty?
|
34
43
|
solr_response.docs.first
|
@@ -28,8 +28,9 @@ RSpec.describe Blacklight::AccessControls::SearchBuilder do
|
|
28
28
|
let(:ability) { instance_double(Ability, user_groups: [], current_user: user) }
|
29
29
|
|
30
30
|
it 'is called with debug' do
|
31
|
-
|
31
|
+
allow(Rails.logger).to receive(:debug)
|
32
32
|
search_builder.send(:apply_gated_discovery, {})
|
33
|
+
expect(Rails.logger).to have_received(:debug).with(/^Solr parameters/)
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
data/spec/unit/catalog_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
describe Blacklight::AccessControls::Catalog do
|
3
|
+
RSpec.describe Blacklight::AccessControls::Catalog do
|
4
4
|
let(:controller) { CatalogController.new }
|
5
5
|
|
6
6
|
describe '#enforce_show_permissions' do
|
7
|
-
subject { controller.
|
7
|
+
subject { controller.enforce_show_permissions }
|
8
8
|
|
9
9
|
let(:params) { { id: doc.id } }
|
10
10
|
|
@@ -38,4 +38,16 @@ describe Blacklight::AccessControls::Catalog do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
|
+
|
42
|
+
describe '#search_builder' do
|
43
|
+
subject { controller.search_builder }
|
44
|
+
|
45
|
+
before do
|
46
|
+
allow(controller).to receive(:current_ability).and_return(instance_double(Ability))
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'creates a search_builder' do
|
50
|
+
expect(subject).to be_kind_of Blacklight::AccessControls::SearchBuilder
|
51
|
+
end
|
52
|
+
end
|
41
53
|
end
|
@@ -40,8 +40,9 @@ describe Blacklight::AccessControls::Enforcement do
|
|
40
40
|
let(:ability) { instance_double(Ability, user_groups: [], current_user: user) }
|
41
41
|
|
42
42
|
it 'is called with debug' do
|
43
|
-
|
43
|
+
allow(Rails.logger).to receive(:debug)
|
44
44
|
controller.send(:apply_gated_discovery, {})
|
45
|
+
expect(Rails.logger).to have_received(:debug).with(/^Solr parameters/)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-access_controls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -11,22 +11,28 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2018-
|
14
|
+
date: 2018-10-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: blacklight
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- - "
|
20
|
+
- - ">"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '6.0'
|
23
|
+
- - "<"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '8'
|
23
26
|
type: :runtime
|
24
27
|
prerelease: false
|
25
28
|
version_requirements: !ruby/object:Gem::Requirement
|
26
29
|
requirements:
|
27
|
-
- - "
|
30
|
+
- - ">"
|
28
31
|
- !ruby/object:Gem::Version
|
29
32
|
version: '6.0'
|
33
|
+
- - "<"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '8'
|
30
36
|
- !ruby/object:Gem::Dependency
|
31
37
|
name: cancancan
|
32
38
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,6 +274,7 @@ files:
|
|
268
274
|
- spec/factories/user.rb
|
269
275
|
- spec/spec_helper.rb
|
270
276
|
- spec/support/solr_support.rb
|
277
|
+
- spec/test_app_templates/Gemfile.extra
|
271
278
|
- spec/test_app_templates/blacklight.yml
|
272
279
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
273
280
|
- spec/unit/ability_spec.rb
|
@@ -290,12 +297,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
290
297
|
version: 2.1.0
|
291
298
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
292
299
|
requirements:
|
293
|
-
- - "
|
300
|
+
- - ">="
|
294
301
|
- !ruby/object:Gem::Version
|
295
|
-
version:
|
302
|
+
version: '0'
|
296
303
|
requirements: []
|
297
304
|
rubyforge_project:
|
298
|
-
rubygems_version: 2.7.
|
305
|
+
rubygems_version: 2.7.6
|
299
306
|
signing_key:
|
300
307
|
specification_version: 4
|
301
308
|
summary: Access controls for blacklight-based applications
|
@@ -303,6 +310,7 @@ test_files:
|
|
303
310
|
- spec/factories/user.rb
|
304
311
|
- spec/spec_helper.rb
|
305
312
|
- spec/support/solr_support.rb
|
313
|
+
- spec/test_app_templates/Gemfile.extra
|
306
314
|
- spec/test_app_templates/blacklight.yml
|
307
315
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
308
316
|
- spec/unit/ability_spec.rb
|