Remove code related to Launchpad auth or 37id Users

This commit is contained in:
Mike Dalessio
2025-09-30 13:03:08 -04:00
parent 7129b711f1
commit 47370084d2
23 changed files with 55 additions and 371 deletions
+14 -30
View File
@@ -2,41 +2,25 @@
require_relative "../config/environment"
if ARGV.length < 2
puts "Usage: #{$0} <email> <tenant>"
if ARGV.length < 3
puts "Usage: #{$0} <tenant> <email> <fullname>"
exit 1
end
email_address = ARGV[0]
tenant = ARGV[1]
tenant = ARGV.shift
email_address = ARGV.shift
name = ARGV.join(" ")
def confirm(noun)
print "Is this the correct #{noun}? (y/n) "
response = $stdin.gets.chomp.downcase
exit 0 unless response == "y"
puts
end
signal_identity = SignalId::Identity.find_by!(email_address: email_address)
pp signal_identity
confirm "identity"
ApplicationRecord.with_tenant(tenant) do
signal_account = Account.sole.external_account
pp signal_account
confirm "account"
SignalId::Database.on_master do
signal_user = SignalId::User.create!(identity: signal_identity, account: signal_account)
user = User.create!(
name: signal_user.name,
email_address: signal_user.email_address,
external_user_id: signal_user.id,
password: SecureRandom.hex(36) # TODO: remove password column?
)
begin
ApplicationRecord.with_tenant(tenant) do
password = SecureRandom.hex(16)
user = User.create!(name:, email_address:, password:)
puts "Created: "
pp [ user, signal_user ]
pp user
puts "Password is: #{password.inspect}"
end
rescue Exception => e
puts "Failed with error: #{e.inspect}"
end
-1
View File
@@ -34,7 +34,6 @@ ActiveRecord::Tenanted::DatabaseTasks.migrate_all
ApplicationRecord.with_tenant(signup.tenant_name) do |tenant|
Account.sole.update! external_account: signup.signal_account
User.first.update! external_user: signup.signal_account.owner
puts "\n\nLogin to http://launchpad.localhost:3011/ as #{signup.email_address} / #{signup.password}"
end
@@ -1,21 +0,0 @@
#!/usr/bin/env ruby
require_relative "../config/environment"
ApplicationRecord.with_each_tenant do |tenant|
account = Account.sole
signal_account = account.signal_account
signal_users = SignalId::User.where(account_id: signal_account.id)
signal_users.each do |signal_user|
unless User.find_by(signal_user_id: signal_user.id)
User.create!(
name: signal_user.identity.name,
email_address: signal_user.identity.email_address,
signal_user_id: signal_user.id,
password: SecureRandom.hex(36) # TODO: remove password column?
)
end
end
end
-41
View File
@@ -1,41 +0,0 @@
#!/usr/bin/env ruby
#
# this is intended to copy a production database into beta, change the account id, and stitch the
# user accounts together properly.
#
require_relative "../config/environment"
ActiveRecord::Base.logger = Logger.new(File::NULL)
ApplicationRecord.with_each_tenant do |tenant|
puts "\n# tenant: #{tenant}"
signal_account = SignalId::Account.find_by!(queenbee_id: tenant)
puts "Found signal account #{signal_account.inspect}"
account = Account.sole
if account.tenant_id != tenant
puts "setting account tenant_id to #{tenant}"
account.update!(tenant_id: tenant, name: account.name + " (Beta)")
end
User.find_each do |user|
next if user.system? || user.external_user_id.nil?
signal_user = user.external_user
next if signal_user.nil?
next if signal_user.account == account.external_account
signal_identity = signal_user.identity
pp signal_identity
SignalId::Database.on_master do
signal_user = SignalId::User.find_or_create_by!(identity: signal_identity, account: signal_account)
puts "Created signal user #{signal_user.inspect} for identity #{signal_identity.inspect}"
user.external_user_id = signal_user.id
user.save!
end
end
end