mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Contact#info auth info check
This commit is contained in:
parent
c1f90754d1
commit
91f373379a
2 changed files with 7 additions and 7 deletions
|
@ -33,6 +33,7 @@ module Epp::ContactsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def info_contact
|
def info_contact
|
||||||
|
handle_errors and return unless has_rights?
|
||||||
@contact = find_contact
|
@contact = find_contact
|
||||||
handle_errors(@contact) and return unless @contact
|
handle_errors(@contact) and return unless @contact
|
||||||
render 'epp/contacts/info'
|
render 'epp/contacts/info'
|
||||||
|
@ -88,7 +89,8 @@ module Epp::ContactsHelper
|
||||||
def has_rights?
|
def has_rights?
|
||||||
authInfo = @ph.try(:[], :authInfo).try(:[], :pw) || @ph.try(:[], :chg).try(:[], :authInfo).try(:[], :pw) || []
|
authInfo = @ph.try(:[], :authInfo).try(:[], :pw) || @ph.try(:[], :chg).try(:[], :authInfo).try(:[], :pw) || []
|
||||||
id = @ph[:id]
|
id = @ph[:id]
|
||||||
return true if (id && authInfo && find_contact.auth_info == authInfo)
|
|
||||||
|
return true if (id && authInfo && !find_contact.nil? && find_contact.auth_info == authInfo)
|
||||||
|
|
||||||
epp_errors << { code: '2201', msg: t('errors.messages.epp_authorization_error'), value: { obj: 'pw', val: authInfo } }
|
epp_errors << { code: '2201', msg: t('errors.messages.epp_authorization_error'), value: { obj: 'pw', val: authInfo } }
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -158,7 +158,7 @@ describe 'EPP Contact', epp: true do
|
||||||
expect(response[:results].count).to eq 1
|
expect(response[:results].count).to eq 1
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns info about contact' do
|
it 'returns info about contact availability' do
|
||||||
Fabricate(:contact, code: 'check-1234')
|
Fabricate(:contact, code: 'check-1234')
|
||||||
|
|
||||||
response = epp_request(contact_check_xml( ids: [{ id: 'check-1234'}, { id: 'check-4321' }] ), :xml)
|
response = epp_request(contact_check_xml( ids: [{ id: 'check-1234'}, { id: 'check-4321' }] ), :xml)
|
||||||
|
@ -192,7 +192,7 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns info about contact' do
|
it 'returns info about contact' do
|
||||||
Fabricate(:contact, name: "Johnny Awesome", created_by_id: '1', code: 'info-4444')
|
Fabricate(:contact, name: "Johnny Awesome", created_by_id: '1', code: 'info-4444', auth_info: '2fooBAR')
|
||||||
Fabricate(:address)
|
Fabricate(:address)
|
||||||
|
|
||||||
response = epp_request('contacts/info.xml')
|
response = epp_request('contacts/info.xml')
|
||||||
|
@ -204,10 +204,8 @@ describe 'EPP Contact', epp: true do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'doesn\'t display unassociated object', pending: true do
|
it 'doesn\'t display unassociated object' do
|
||||||
pending 'until new contact rights systems is implemented'
|
Fabricate(:contact, name:"Johnny Awesome", code: 'info-4444')
|
||||||
Fabricate(:contact, name:"Johnny Awesome", created_by_id: '240', code: 'info-4444')
|
|
||||||
Fabricate(:epp_user, id: 240)
|
|
||||||
|
|
||||||
response = epp_request('contacts/info.xml')
|
response = epp_request('contacts/info.xml')
|
||||||
expect(response[:result_code]).to eq('2201')
|
expect(response[:result_code]).to eq('2201')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue