Replace hostObj with hostAttr

This commit is contained in:
Martin Lensment 2015-01-21 13:19:50 +02:00
parent 1d7b289a10
commit e0c22db7b1
5 changed files with 356 additions and 313 deletions

View file

@ -128,14 +128,9 @@ class Epp::DomainsController < EppController
ret = true ret = true
# TODO: Verify contact presence if registrant is juridical # TODO: Verify contact presence if registrant is juridical
attrs_present = epp_request_valid?('name', 'ns', 'registrant', 'legalDocument') attrs_present = epp_request_valid?('name', 'ns', 'registrant', 'legalDocument', 'hostAttr')
ret = false unless attrs_present ret = false unless attrs_present
if params[:parsed_frame].css('hostObj').any?
epp_errors << { code: '2306', msg: I18n.t('host_obj_is_not_allowed') }
ret = false
end
if params[:parsed_frame].css('dsData').count > 0 && params[:parsed_frame].css('create > keyData').count > 0 if params[:parsed_frame].css('dsData').count > 0 && params[:parsed_frame].css('create > keyData').count > 0
epp_errors << { code: '2306', msg: I18n.t('ds_data_and_key_data_must_not_exists_together') } epp_errors << { code: '2306', msg: I18n.t('ds_data_and_key_data_must_not_exists_together') }
ret = false ret = false

View file

@ -177,7 +177,7 @@ class Epp::EppDomain < Domain
ns_list.each do |ns_attrs| ns_list.each do |ns_attrs|
nameserver = nameservers.where(ns_attrs) nameserver = nameservers.where(ns_attrs)
if nameserver.blank? if nameserver.blank?
add_epp_error('2303', 'hostObj', ns_attrs[:hostname], [:nameservers, :not_found]) add_epp_error('2303', 'hostAttr', ns_attrs[:hostname], [:nameservers, :not_found])
else else
to_delete << nameserver to_delete << nameserver
end end
@ -509,12 +509,6 @@ class Epp::EppDomain < Domain
res << host_attr.delete_if { |_k, v| v.blank? } res << host_attr.delete_if { |_k, v| v.blank? }
end end
parsed_frame.css('hostObj').each do |x|
res << {
hostname: x.text
}
end
res res
end end

View file

@ -21,10 +21,10 @@ class Nameserver < ActiveRecord::Base
def epp_code_map def epp_code_map
{ {
'2302' => [ '2302' => [
[:hostname, :taken, { value: { obj: 'hostObj', val: hostname } }] [:hostname, :taken, { value: { obj: 'hostAttr', val: hostname } }]
], ],
'2005' => [ '2005' => [
[:hostname, :invalid, { value: { obj: 'hostObj', val: hostname } }], [:hostname, :invalid, { value: { obj: 'hostAttr', val: hostname } }],
[:ipv4, :invalid, { value: { obj: 'hostAddr', val: ipv4 } }], [:ipv4, :invalid, { value: { obj: 'hostAddr', val: ipv4 } }],
[:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }] [:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }]
], ],

File diff suppressed because it is too large Load diff

View file

@ -506,7 +506,7 @@ describe 'EPP Domain', epp: true do
expect(response[:msg]).to eq('Hostname is invalid') expect(response[:msg]).to eq('Hostname is invalid')
end end
it 'does not allow hostObj' do it 'checks hostAttr presence' do
xml = domain_create_xml({ xml = domain_create_xml({
ns: [ ns: [
{ {
@ -519,8 +519,8 @@ describe 'EPP Domain', epp: true do
}) })
response = epp_request(xml, :xml) response = epp_request(xml, :xml)
expect(response[:result_code]).to eq('2306') expect(response[:result_code]).to eq('2003')
expect(response[:msg]).to eq('hostObj object is not allowed') expect(response[:msg]).to eq('Required parameter missing: hostAttr')
end end
it 'creates domain with nameservers with ips' do it 'creates domain with nameservers with ips' do
@ -1041,8 +1041,16 @@ describe 'EPP Domain', epp: true do
add: [ add: [
{ {
ns: [ ns: [
{ hostObj: { value: 'ns1.example.com' } }, {
{ hostObj: { value: 'ns2.example.com' } } hostAttr: [
{ hostName: { value: 'ns1.example.com' } }
]
},
{
hostAttr: [
{ hostName: { value: 'ns2.example.com' } }
]
}
] ]
}, },
_anonymus: [ _anonymus: [
@ -1131,8 +1139,16 @@ describe 'EPP Domain', epp: true do
add: [ add: [
{ {
ns: [ ns: [
{ hostObj: { value: 'ns1.example.com' } }, {
{ hostObj: { value: 'ns2.example.com' } } hostAttr: [
{ hostName: { value: 'ns1.example.com' } }
]
},
{
hostAttr: [
{ hostName: { value: 'ns2.example.com' } }
]
}
] ]
}, },
_anonymus: [ _anonymus: [
@ -1169,7 +1185,11 @@ describe 'EPP Domain', epp: true do
rem: [ rem: [
{ {
ns: [ ns: [
{ hostObj: { value: 'ns1.example.com' } } {
hostAttr: [
{ hostName: { value: 'ns1.example.com' } }
]
}
] ]
}, },
_anonymus: [ _anonymus: [
@ -1238,7 +1258,11 @@ describe 'EPP Domain', epp: true do
xml = domain_update_xml({ xml = domain_update_xml({
add: [ add: [
ns: [ ns: [
{ hostObj: { value: 'ns1.example.com' } } {
hostAttr: [
{ hostName: { value: 'ns1.example.com' } }
]
}
] ]
] ]
}) })