mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
Contact info command now honors disclosure
This commit is contained in:
parent
0a1c2d3d57
commit
22f753aa6c
5 changed files with 46 additions and 18 deletions
|
@ -1,26 +1,30 @@
|
||||||
if @contact.international_address
|
if @contact.international_address
|
||||||
address = @contact.international_address
|
address = @contact.international_address
|
||||||
xml.tag!('contact:postalInfo', type: 'int') do # TODO instance method of defining type
|
xml.tag!('contact:postalInfo', type: 'int') do # TODO instance method of defining type
|
||||||
xml.tag!('contact:name', address.name)
|
xml.tag!('contact:name', address.name) if @contact.disclosure.int_name
|
||||||
xml.tag!('contact:org', address.org_name)
|
xml.tag!('contact:org', address.org_name) if @contact.disclosure.int_org_name
|
||||||
xml.tag!('contact:addr') do
|
if @contact.disclosure.int_addr
|
||||||
xml.tag!('contact:street', address.street) if address.street
|
xml.tag!('contact:addr') do
|
||||||
xml.tag!('contact:street', address.street2) if address.street2
|
xml.tag!('contact:street', address.street) if address.street
|
||||||
xml.tag!('contact:street', address.street3) if address.street3
|
xml.tag!('contact:street', address.street2) if address.street2
|
||||||
xml.tag!('contact:cc', address.try(:country).try(:iso)) unless address.try(:country).nil?
|
xml.tag!('contact:street', address.street3) if address.street3
|
||||||
|
xml.tag!('contact:cc', address.try(:country).try(:iso)) unless address.try(:country).nil?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if @contact.local_address
|
if @contact.local_address
|
||||||
address = @contact.local_address
|
address = @contact.local_address
|
||||||
xml.tag!('contact:postalInfo', type: 'loc') do
|
xml.tag!('contact:postalInfo', type: 'loc') do
|
||||||
xml.tag!('contact:name', address.name)
|
xml.tag!('contact:name', address.name) if @contact.disclosure.loc_name
|
||||||
xml.tag!('contact:org', address.org_name)
|
xml.tag!('contact:org', address.org_name) if @contact.disclosure.loc_org_name
|
||||||
xml.tag!('contact:addr') do
|
if @contact.disclosure.loc_addr
|
||||||
xml.tag!('contact:street', address.street) if address.street
|
xml.tag!('contact:addr') do
|
||||||
xml.tag!('contact:street', address.street2) if address.street2
|
xml.tag!('contact:street', address.street) if address.street
|
||||||
xml.tag!('contact:street', address.street3) if address.street3
|
xml.tag!('contact:street', address.street2) if address.street2
|
||||||
xml.tag!('contact:cc', address.try(:country).try(:iso)) unless address.try(:country).nil?
|
xml.tag!('contact:street', address.street3) if address.street3
|
||||||
|
xml.tag!('contact:cc', address.try(:country).try(:iso)) unless address.try(:country).nil?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,9 +7,9 @@ xml.epp_head do
|
||||||
xml.resData do
|
xml.resData do
|
||||||
xml.tag!('contact:chkData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
xml.tag!('contact:chkData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
||||||
xml << render('/epp/contacts/postal_info')
|
xml << render('/epp/contacts/postal_info')
|
||||||
xml.tag!('contact:voice', @contact.phone)
|
xml.tag!('contact:voice', @contact.phone) if @contact.disclosure.phone
|
||||||
xml.tag!('contact:fax', @contact.fax)
|
xml.tag!('contact:fax', @contact.fax) if @contact.disclosure.fax
|
||||||
xml.tag!('contact:email', @contact.email)
|
xml.tag!('contact:email', @contact.email) if @contact.disclosure.email
|
||||||
xml.tag!('contact:clID', @current_epp_user.username) if @current_epp_user
|
xml.tag!('contact:clID', @current_epp_user.username) if @current_epp_user
|
||||||
xml.tag!('contact:crID', @contact.cr_id ) if @contact.cr_id
|
xml.tag!('contact:crID', @contact.cr_id ) if @contact.cr_id
|
||||||
xml.tag!('contact:crDate', @contact.created_at)
|
xml.tag!('contact:crDate', @contact.created_at)
|
||||||
|
|
|
@ -228,6 +228,19 @@ describe 'EPP Contact', epp: true do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'doesn\'t disclose private elements' do
|
||||||
|
Fabricate(:contact, code: 'info-4444', auth_info: '2fooBAR',
|
||||||
|
disclosure: Fabricate(:contact_disclosure, email: false, phone: false))
|
||||||
|
response = epp_request('contacts/info.xml')
|
||||||
|
contact = response[:parsed].css('resData chkData')
|
||||||
|
|
||||||
|
expect(response[:result_code]).to eq('1000')
|
||||||
|
|
||||||
|
expect(contact.css('phone').present?).to eq(false)
|
||||||
|
expect(contact.css('email').present?).to eq(false)
|
||||||
|
expect(contact.css('name').present?).to be(true)
|
||||||
|
end
|
||||||
|
|
||||||
it 'doesn\'t display unassociated object' do
|
it 'doesn\'t display unassociated object' do
|
||||||
Fabricate(:contact, code: 'info-4444')
|
Fabricate(:contact, code: 'info-4444')
|
||||||
|
|
||||||
|
|
10
spec/fabricators/contact_disclosure_fabricator.rb
Normal file
10
spec/fabricators/contact_disclosure_fabricator.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
Fabricator(:contact_disclosure) do
|
||||||
|
email true
|
||||||
|
phone true
|
||||||
|
loc_addr true
|
||||||
|
loc_name true
|
||||||
|
loc_org_name true
|
||||||
|
int_name true
|
||||||
|
int_org_name true
|
||||||
|
int_addr true
|
||||||
|
end
|
|
@ -6,4 +6,5 @@ Fabricator(:contact) do
|
||||||
ident_type 'op'
|
ident_type 'op'
|
||||||
auth_info 'ccds4324pok'
|
auth_info 'ccds4324pok'
|
||||||
international_address
|
international_address
|
||||||
|
disclosure { Fabricate(:contact_disclosure) }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue