Class: DorIndexing::Indexers::RoleMetadataIndexer
- Inherits:
-
Object
- Object
- DorIndexing::Indexers::RoleMetadataIndexer
- Defined in:
- lib/dor_indexing/indexers/role_metadata_indexer.rb
Overview
Indexes the administrative role metadata
Instance Attribute Summary collapse
-
#cocina ⇒ Object
readonly
Returns the value of attribute cocina.
Instance Method Summary collapse
-
#initialize(cocina:) ⇒ RoleMetadataIndexer
constructor
A new instance of RoleMetadataIndexer.
-
#to_solr ⇒ Hash
rubocop:disable Metrics/AbcSize.
Constructor Details
#initialize(cocina:) ⇒ RoleMetadataIndexer
Returns a new instance of RoleMetadataIndexer.
9 10 11 |
# File 'lib/dor_indexing/indexers/role_metadata_indexer.rb', line 9 def initialize(cocina:, **) @cocina = cocina end |
Instance Attribute Details
#cocina ⇒ Object (readonly)
Returns the value of attribute cocina.
7 8 9 |
# File 'lib/dor_indexing/indexers/role_metadata_indexer.rb', line 7 def cocina @cocina end |
Instance Method Details
#to_solr ⇒ Hash
rubocop:disable Metrics/AbcSize
15 16 17 18 19 20 21 |
# File 'lib/dor_indexing/indexers/role_metadata_indexer.rb', line 15 def to_solr Array(cocina.administrative.roles).each_with_object({}) do |role, solr_doc| solr_doc['apo_register_permissions_ssim'] = serialize(role.members) if role.name == 'dor-apo-manager' solr_doc["apo_role_#{role.name}_ssim"] = serialize(role.members.select { |member| member.type == 'workgroup' }) solr_doc["apo_role_person_#{role.name}_ssim"] = serialize(role.members.select { |member| member.type == 'sunetid' }) end end |