lib/ddr/models/solr_document.rb in ddr-models-1.17.1 vs lib/ddr/models/solr_document.rb in ddr-models-2.0.0.pre.1
- old
+ new
@@ -5,11 +5,10 @@
module SolrDocument
extend ActiveSupport::Concern
included do
alias_method :pid, :id
- delegate :role_based_permissions, to: :roles
end
def to_partial_path
'document'
end
@@ -204,26 +203,17 @@
def multires_image_file_path
get(Ddr::IndexFields::MULTIRES_IMAGE_FILE_PATH)
end
def roles
- @roles ||= Ddr::Managers::SolrDocumentRoleManager.new(self)
+ @roles ||= Ddr::Auth::Roles::DetachedRoleSet.from_json(access_role)
end
def access_role
- get("access_role_ssi")
+ get(Ddr::IndexFields::ACCESS_ROLE)
end
- def display_format
- get(Ddr::IndexFields::DISPLAY_FORMAT)
- end
-
- def research_help
- research_help_contact = self[Ddr::IndexFields::RESEARCH_HELP_CONTACT] || inherited_research_help_contact
- Ddr::Contacts.get(research_help_contact) if research_help_contact
- end
-
private
def targets_query
"#{Ddr::IndexFields::IS_EXTERNAL_TARGET_FOR}:#{internal_uri_for_query}"
end
@@ -244,18 +234,9 @@
Time.parse(date).localtime if date
end
def get_pid(field)
ActiveFedora::Base.pid_from_uri(get(field)) rescue nil
- end
-
- def inherited_research_help_contact
- if admin_policy_pid
- query = ActiveFedora::SolrService.construct_query_for_pids([admin_policy_pid])
- results = ActiveFedora::SolrService.query(query)
- doc = results.map { |result| ::SolrDocument.new(result) }.first
- doc[Ddr::IndexFields::RESEARCH_HELP_CONTACT]
- end
end
end
end
end