Module: Hyrax::EnsureWellFormedAdminSetService

Defined in:
app/services/hyrax/ensure_well_formed_admin_set_service.rb

Overview

Note:

For historical reasons, we lazily apply the default admin set to curation concerns that don’t already have an admin set.

This “service” ensures that we have a well formed AdminSet.

Class Method Summary collapse

Class Method Details

.call(admin_set_id: nil) ⇒ #to_s

Returns an admin_set_id; if you provide a “present” admin_set_id, this service will return that.

Parameters:

  • admin_set_id (String, nil) (defaults to: nil)

Returns:

  • (#to_s)

    an admin_set_id; if you provide a “present” admin_set_id, this service will return that.

See Also:

Since:

  • v3.0.0



21
22
23
24
25
# File 'app/services/hyrax/ensure_well_formed_admin_set_service.rb', line 21

def self.call(admin_set_id: nil)
  admin_set_id = admin_set_id.presence&.to_s || Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s
  Hyrax::PermissionTemplate.find_or_create_by!(source_id: admin_set_id)
  admin_set_id
end