Allow other registrars to see that domain is registered already

This commit is contained in:
Martin Lensment 2014-09-18 11:30:31 +03:00
parent 8d24fe7b00
commit 4eed47fdf1
5 changed files with 11 additions and 10 deletions

View file

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

View file

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

View file

@ -3,10 +3,6 @@ class DomainContact < ActiveRecord::Base
belongs_to :contact
belongs_to :domain
EPP_ATTR_MAP = {
hostname: 'hostObj'
}
def epp_code_map
{
'2302' => [

View file

@ -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:

View file

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