mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Dnskey removing
This commit is contained in:
parent
c8863df4c5
commit
4b76e2ceec
4 changed files with 85 additions and 9 deletions
|
@ -15,6 +15,9 @@ class Dnskey < ActiveRecord::Base
|
|||
[:protocol, :invalid, { value: { obj: 'protocol', val: protocol } }],
|
||||
[:flags, :invalid, { value: { obj: 'flags', val: flags } }]
|
||||
],
|
||||
'2303' => [
|
||||
[:base, :dnskey_not_found, { value: { obj: 'pubKey', val: public_key } }]
|
||||
],
|
||||
'2306' => [
|
||||
[:alg, :blank],
|
||||
[:protocol, :blank],
|
||||
|
|
|
@ -51,6 +51,7 @@ class Epp::EppDomain < Domain
|
|||
detach_contacts(self.class.parse_contacts_from_frame(parsed_frame))
|
||||
detach_nameservers(self.class.parse_nameservers_from_frame(parsed_frame))
|
||||
detach_statuses(self.class.parse_statuses_from_frame(parsed_frame))
|
||||
detach_dnskeys(self.class.parse_dnskeys_from_frame(parsed_frame))
|
||||
|
||||
errors.empty?
|
||||
end
|
||||
|
@ -173,6 +174,20 @@ class Epp::EppDomain < Domain
|
|||
end
|
||||
end
|
||||
|
||||
def detach_dnskeys(dnskey_list)
|
||||
to_delete = []
|
||||
dnskey_list.each do |x|
|
||||
dnskey = dnskeys.where(public_key: x[:public_key])
|
||||
if dnskey.blank?
|
||||
add_epp_error('2303', 'pubKey', x[:public_key], [:dnskeys, :not_found])
|
||||
else
|
||||
to_delete << dnskey
|
||||
end
|
||||
end
|
||||
|
||||
dnskeys.delete(to_delete)
|
||||
end
|
||||
|
||||
### RENEW ###
|
||||
|
||||
def renew(cur_exp_date, period, unit = 'y')
|
||||
|
|
|
@ -106,6 +106,8 @@ en:
|
|||
taken: 'Status already exists on this domain'
|
||||
registrar:
|
||||
blank: 'Registrar is missing'
|
||||
dnskeys:
|
||||
not_found: 'Dnskey was not found'
|
||||
|
||||
domain:
|
||||
<<: *epp_domain_ar_attributes
|
||||
|
|
|
@ -571,9 +571,29 @@ describe 'EPP Domain', epp: true do
|
|||
{ hostObj: { value: 'ns2.example.com' } }
|
||||
]
|
||||
},
|
||||
{ contact: { value: 'mak21', attrs: { type: 'tech' } } },
|
||||
{ status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } },
|
||||
{ status: { value: '', attrs: { s: 'clientUpdateProhibited' } } }
|
||||
dnssec: [
|
||||
{
|
||||
dnskey: {
|
||||
flags: { value: '0' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '5' },
|
||||
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
||||
}
|
||||
},
|
||||
{
|
||||
dnskey: {
|
||||
flags: { value: '256' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '254' },
|
||||
pubKey: { value: '841936717ae427ace63c28d04918569a841936717ae427ace63c28d0' }
|
||||
}
|
||||
}
|
||||
],
|
||||
_other: [
|
||||
{ contact: { value: 'mak21', attrs: { type: 'tech' } } },
|
||||
{ status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } },
|
||||
{ status: { value: '', attrs: { s: 'clientUpdateProhibited' } } }
|
||||
]
|
||||
]
|
||||
})
|
||||
|
||||
|
@ -600,6 +620,8 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
expect(d.domain_statuses.last.value).to eq('clientUpdateProhibited')
|
||||
|
||||
expect(d.dnskeys.count).to eq(2)
|
||||
|
||||
response = epp_request(xml, :xml)
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2302')
|
||||
|
@ -633,9 +655,29 @@ describe 'EPP Domain', epp: true do
|
|||
{ hostObj: { value: 'ns2.example.com' } }
|
||||
]
|
||||
},
|
||||
{ contact: { value: 'mak21', attrs: { type: 'tech' } } },
|
||||
{ status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } },
|
||||
{ status: { value: '', attrs: { s: 'clientUpdateProhibited' } } }
|
||||
dnssec: [
|
||||
{
|
||||
dnskey: {
|
||||
flags: { value: '0' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '5' },
|
||||
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
||||
}
|
||||
},
|
||||
{
|
||||
dnskey: {
|
||||
flags: { value: '256' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '254' },
|
||||
pubKey: { value: '841936717ae427ace63c28d04918569a841936717ae427ace63c28d0' }
|
||||
}
|
||||
}
|
||||
],
|
||||
_other: [
|
||||
{ contact: { value: 'mak21', attrs: { type: 'tech' } } },
|
||||
{ status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } },
|
||||
{ status: { value: '', attrs: { s: 'clientUpdateProhibited' } } }
|
||||
]
|
||||
]
|
||||
})
|
||||
|
||||
|
@ -648,14 +690,28 @@ describe 'EPP Domain', epp: true do
|
|||
{ hostObj: { value: 'ns1.example.com' } }
|
||||
]
|
||||
},
|
||||
{ contact: { value: 'mak21', attrs: { type: 'tech' } } },
|
||||
{ status: { value: '', attrs: { s: 'clientHold' } } }
|
||||
dnssec: [
|
||||
{
|
||||
dnskey: {
|
||||
flags: { value: '0' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '5' },
|
||||
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
||||
}
|
||||
}
|
||||
],
|
||||
_other: [
|
||||
{ contact: { value: 'mak21', attrs: { type: 'tech' } } },
|
||||
{ status: { value: '', attrs: { s: 'clientHold' } } }
|
||||
]
|
||||
]
|
||||
})
|
||||
|
||||
d = Domain.last
|
||||
expect(d.dnskeys.count).to eq(2)
|
||||
|
||||
epp_request(xml, :xml)
|
||||
response = epp_request(xml, :xml)
|
||||
expect(d.dnskeys.count).to eq(1)
|
||||
|
||||
expect(d.domain_statuses.count).to eq(1)
|
||||
expect(d.domain_statuses.first.value).to eq('clientUpdateProhibited')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue