Skip to content

Commit 29d6d08

Browse files
authored
Merge pull request #47 from projectblacklight/blacklight-7
Blacklight 7 Support
2 parents 3aa93f9 + e951559 commit 29d6d08

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ rvm:
88
- 2.5.1
99

1010
env:
11-
- "RAILS_VERSION=5.2.0"
12-
- "RAILS_VERSION=5.1.0"
11+
- "BLACKLIGHT_VERSION=master RAILS_VERSION=5.2.1"
12+
- "RAILS_VERSION=5.2.1"
13+
- "RAILS_VERSION=5.1.6"
1314

1415
global_env:
1516
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true

blacklight-access_controls.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
1717

1818
gem.required_ruby_version = '>= 2.1.0'
1919

20-
gem.add_dependency 'blacklight', '~> 6.0'
20+
gem.add_dependency 'blacklight', '> 6.0', '< 8'
2121
gem.add_dependency 'cancancan', '~> 1.8'
2222
gem.add_dependency 'deprecation', '~> 1.0'
2323

lib/blacklight/access_controls/permissions_query.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ def permissions_doc(pid)
1313
doc
1414
end
1515

16+
# This is only valid for, and should only be used for blacklight 6
1617
def permissions_document_class
17-
SolrDocument
18+
blacklight_config.document_model
1819
end
1920

2021
protected
2122

23+
def blacklight_config
24+
CatalogController.blacklight_config
25+
end
26+
2227
# a solr query method
2328
# retrieve a solr document, given the doc id
2429
# Modeled on Blacklight::SolrHelper.get_permissions_solr_response_for_doc_id
@@ -28,7 +33,11 @@ def get_permissions_solr_response_for_doc_id(id = nil, extra_controller_params =
2833
raise Blacklight::Exceptions::RecordNotFound, 'The application is trying to retrieve permissions without specifying an asset id' if id.nil?
2934
solr_opts = permissions_solr_doc_params(id).merge(extra_controller_params)
3035
response = Blacklight.default_index.connection.get('select', params: solr_opts)
31-
solr_response = Blacklight::Solr::Response.new(response, solr_opts, document_model: permissions_document_class)
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)
3241

3342
raise Blacklight::Exceptions::RecordNotFound, "The solr permissions search handler didn't return anything for id \"#{id}\"" if solr_response.docs.empty?
3443
solr_response.docs.first
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if ENV['BLACKLIGHT_VERSION'] == 'master'
2+
gem 'blacklight', github: 'projectblacklight/blacklight'
3+
end

0 commit comments

Comments
 (0)