diff --git a/app/helpers/epp/domains_helper.rb b/app/helpers/epp/domains_helper.rb index b8a296ee4..9c8f72dcf 100644 --- a/app/helpers/epp/domains_helper.rb +++ b/app/helpers/epp/domains_helper.rb @@ -146,12 +146,18 @@ module Epp::DomainsHelper ## SHARED def find_domain(secure = { secure: true }) - domain = Epp::EppDomain.find_by(name: @ph[:name], registrar: current_epp_user.registrar) if secure[:secure] == true - domain = Epp::EppDomain.find_by(name: @ph[:name]) if secure[:secure] == false + domain = Epp::EppDomain.find_by(name: @ph[:name]) unless domain epp_errors << { code: '2303', msg: I18n.t('errors.messages.epp_domain_not_found'), value: { obj: 'name', val: @ph[:name] } } + return nil end + + if domain.registrar != current_epp_user.registrar && secure[:secure] == true + epp_errors << { code: '2302', msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'), value: { obj: 'name', val: @ph[:name] } } + return nil + end + domain end end diff --git a/app/models/contact.rb b/app/models/contact.rb index 73b51b96f..31f1a2989 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -4,8 +4,6 @@ class Contact < ActiveRecord::Base include EppErrors - EPP_ATTR_MAP = {} - has_one :local_address has_one :international_address has_one :disclosure, class_name: 'ContactDisclosure' diff --git a/app/models/domain_contact.rb b/app/models/domain_contact.rb index 46d961799..877613e6d 100644 --- a/app/models/domain_contact.rb +++ b/app/models/domain_contact.rb @@ -3,10 +3,6 @@ class DomainContact < ActiveRecord::Base belongs_to :contact belongs_to :domain - EPP_ATTR_MAP = { - hostname: 'hostObj' - } - def epp_code_map { '2302' => [ diff --git a/config/locales/en.yml b/config/locales/en.yml index 622982e3b..4ed9ca86d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -157,6 +157,7 @@ en: repeating_postal_info: 'Only one of each postal info types may be provided' invalid_type: 'PostalInfo type is invalid' unimplemented_command: 'Unimplemented command' + domain_exists_but_belongs_to_other_registrar: 'Domain exists but belongs to other registrar' setting_groups: codes: diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index bbee0eac1..f7e508eb2 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -46,8 +46,8 @@ describe 'EPP Domain', epp: true do it 'can not see other registrar domains' do response = epp_request(domain_info_xml, :xml, :elkdata) - expect(response[:result_code]).to eq('2303') - expect(response[:msg]).to eq('Domain not found') + expect(response[:result_code]).to eq('2302') + expect(response[:msg]).to eq('Domain exists but belongs to other registrar') end it 'transfers a domain' do