Dnskey removing

This commit is contained in:
Martin Lensment 2014-10-02 14:59:47 +03:00
parent c8863df4c5
commit 4b76e2ceec
4 changed files with 85 additions and 9 deletions

View file

@ -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],

View file

@ -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')