Skip to content

Commit

Permalink
Add site admin to tenant admin group when seeding
Browse files Browse the repository at this point in the history
  • Loading branch information
alhafoudh committed Dec 8, 2023
1 parent d3dc85f commit 61e2098
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
tenant = Tenant.find_or_create_by!(name: 'Dummy Tenant')

ENV['SITE_ADMIN_EMAILS'].to_s.split(',').each.with_index(1) do |email, i|
tenant.users.find_or_create_by!(email: email, name: "Site ADMIN User #{i}")
tenant.users.find_or_create_by!(email: email, name: "Site ADMIN User #{i}").tap do |user|
user.groups << tenant.admin_group
user.save!
end
end

api_connection = Govbox::ApiConnection.find_or_create_by!(sub: "SPL_Irvin_83300252_KK_24022023", api_token_private_key: File.read(Rails.root + "security/govbox_api_fix.pem"))
Expand Down

0 comments on commit 61e2098

Please sign in to comment.