Skip to content

Commit

Permalink
🧹 Favor Hyrax::AdminSetCreateService
Browse files Browse the repository at this point in the history
The `Hyrax::AdminSetCreateService.find_or_create_default_admin_set` will
create a permission template; as such we don't need to include that
logic below.

Further, the newly used service is Valkyrized and more fault tolerant.
  • Loading branch information
jeremyf committed Jan 17, 2024
1 parent f2fca77 commit 33a5b16
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
end
AccountElevator.switch!(single_tenant_default.cname)

puts "\n== Creating default admin set"
admin_set = AdminSet.find(Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id)
puts "\n== Creating default admin set with permission template"
Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id

puts "\n== Creating default collection types"
Hyrax::CollectionType.find_or_create_default_collection_type
Expand All @@ -28,14 +28,6 @@
errors = Hyrax::Workflow::WorkflowImporter.load_errors
abort("Failed to process all workflows:\n #{errors.join('\n ')}") unless errors.empty?

puts "\n== Creating permission template"
begin
permission_template = admin_set.permission_template
# If the permission template is missing we will need to run the creete service
rescue
Hyrax::AdminSetCreateService.new(admin_set: admin_set, creating_user: nil).create
end

puts "\n== Finished creating single tenant resources"
end

Expand Down

0 comments on commit 33a5b16

Please sign in to comment.