Skip to content

Commit e951559

Browse files
committed
Get the document model from the blacklight config
1 parent 54015b8 commit e951559

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

0 commit comments

Comments
 (0)