Merge pull request #1747 from internetee/1745-hide-contact-name-on-contact-info

EPP: Hide name from contactInfo if no auth provided
This commit is contained in:
Timo Võhmar 2020-11-19 16:53:58 +02:00 committed by GitHub
commit 678514dcbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 4 deletions

View file

@ -14,7 +14,11 @@ xml.epp_head do
end
xml.tag!('contact:postalInfo', type: 'int') do
xml.tag!('contact:name', @contact.name)
if can? :view_full_info, @contact, @password
xml.tag!('contact:name', @contact.name)
else
xml.tag!('contact:name', 'No access')
end
if can? :view_full_info, @contact, @password
xml.tag!('contact:org', @contact.org_name) if @contact.org_name.present?

View file

@ -13,5 +13,5 @@
- registrant = Contact.find_by_code(x.text)
%tr
%td= x['type']
%td= registrant.name
%td= registrant.registrar == current_registrar_user.registrar ? registrant.name : 'N/A'
%td= x.text

View file

@ -23,7 +23,7 @@
<% registrant = Contact.find_by_code(@data.css('registrant').text) %>
<dt><%= t('.registrant') %></dt>
<dd><%= "#{registrant.name} (#{@data.css('registrant').text})" %></dd>
<dd><%= registrant.registrar == current_registrar_user.registrar ? "#{registrant.name} (#{@data.css('registrant').text})" : @data.css('registrant').text %></dd>
<dt><%= t('.registered') %></dt>
<dd><%= @data.css('crDate').text %></dd>

View file

@ -44,7 +44,7 @@ class EppContactInfoBaseTest < EppTestCase
contact: xml_schema).text
end
def test_hides_password_when_current_registrar_is_not_sponsoring
def test_hides_password_and_name_when_current_registrar_is_not_sponsoring
non_sponsoring_registrar = registrars(:goodnames)
@contact.update!(registrar: non_sponsoring_registrar)
@ -70,6 +70,7 @@ class EppContactInfoBaseTest < EppTestCase
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_nil response_xml.at_xpath('//contact:authInfo', contact: xml_schema)
assert_equal 'No access', response_xml.at_xpath('//contact:name', contact: xml_schema).text
end
private