mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 17:53:35 +02:00
Import tech contacts too
This commit is contained in:
parent
d5a7704b87
commit
968e383f9e
6 changed files with 25 additions and 6 deletions
|
@ -84,7 +84,7 @@ class Contact < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def to_s
|
||||
name
|
||||
name || '[no name]'
|
||||
end
|
||||
|
||||
def ident_valid_format?
|
||||
|
|
|
@ -73,9 +73,9 @@ class Dnskey < ActiveRecord::Base
|
|||
hex = [domain.name_in_wire_format, flags_hex, protocol_hex, alg_hex, public_key_hex].join
|
||||
bin = self.class.hex_to_bin(hex)
|
||||
|
||||
if Setting.ds_algorithm == 1
|
||||
if ds_digest_type == 1
|
||||
self.ds_digest = Digest::SHA1.hexdigest(bin).upcase
|
||||
elsif Setting.ds_algorithm == 2
|
||||
elsif ds_digest_type == 2
|
||||
self.ds_digest = Digest::SHA256.hexdigest(bin).upcase
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,5 +10,6 @@ module Legacy
|
|||
has_many :object_states, -> { where('valid_to IS NULL') }, foreign_key: :object_id
|
||||
has_many :dnskeys, foreign_key: :keysetid, primary_key: :keyset
|
||||
has_many :domain_contact_maps, foreign_key: :domainid
|
||||
has_many :nsset_contact_maps, foreign_key: :nssetid, primary_key: :nsset
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@ module Legacy
|
|||
class DomainContactMap < Db
|
||||
self.table_name = :domain_contact_map
|
||||
|
||||
belongs_to :contact, foreign_key: :contactid, primary_key: :legacy_id, class_name: '::Contact'
|
||||
# belongs_to :contact, foreign_key: :contactid, primary_key: :legacy_id, class_name: '::Contact'
|
||||
end
|
||||
end
|
||||
|
|
5
app/models/legacy/nsset_contact_map.rb
Normal file
5
app/models/legacy/nsset_contact_map.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
module Legacy
|
||||
class NssetContactMap < Db
|
||||
self.table_name = :nsset_contact_map
|
||||
end
|
||||
end
|
|
@ -164,6 +164,8 @@ namespace :import do
|
|||
start = Time.now.to_f
|
||||
puts '-----> Importing domains...'
|
||||
|
||||
# domain_status_map = {}
|
||||
|
||||
domain_columns = [
|
||||
"name",
|
||||
"registered_at",
|
||||
|
@ -255,7 +257,7 @@ namespace :import do
|
|||
x.registrant
|
||||
]
|
||||
|
||||
# domain contacts
|
||||
# admin contacts
|
||||
x.domain_contact_maps.each do |dc|
|
||||
domain_contacts << [
|
||||
'admin', # TODO: Where to get real contact type?
|
||||
|
@ -266,6 +268,17 @@ namespace :import do
|
|||
]
|
||||
end
|
||||
|
||||
# tech contacts
|
||||
x.nsset_contact_maps.each do |dc|
|
||||
domain_contacts << [
|
||||
'tech', # TODO: Where to get real contact type?
|
||||
user,
|
||||
user,
|
||||
x.id,
|
||||
dc.contactid
|
||||
]
|
||||
end
|
||||
|
||||
# domain statuses
|
||||
x.object_states.each do |state|
|
||||
domain_statuses << [
|
||||
|
@ -304,7 +317,7 @@ namespace :import do
|
|||
key.alg,
|
||||
key.key,
|
||||
3, # ds_alg
|
||||
Setting.ds_algorithm, # ds_digest_type
|
||||
1, # ds_digest_type /SHA1)
|
||||
user,
|
||||
user,
|
||||
x.id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue