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
|
||||
|
||||
def info_contact
|
||||
handle_errors and return unless has_rights?
|
||||
@contact = find_contact
|
||||
handle_errors(@contact) and return unless @contact
|
||||
render 'epp/contacts/info'
|
||||
|
@ -88,7 +89,8 @@ module Epp::ContactsHelper
|
|||
def has_rights?
|
||||
authInfo = @ph.try(:[], :authInfo).try(:[], :pw) || @ph.try(:[], :chg).try(:[], :authInfo).try(:[], :pw) || []
|
||||
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 } }
|
||||
return false
|
||||
|
|
|
@ -158,7 +158,7 @@ describe 'EPP Contact', epp: true do
|
|||
expect(response[:results].count).to eq 1
|
||||
end
|
||||
|
||||
it 'returns info about contact' do
|
||||
it 'returns info about contact availability' do
|
||||
Fabricate(:contact, code: 'check-1234')
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
response = epp_request('contacts/info.xml')
|
||||
|
@ -204,10 +204,8 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
end
|
||||
|
||||
it 'doesn\'t display unassociated object', pending: true do
|
||||
pending 'until new contact rights systems is implemented'
|
||||
Fabricate(:contact, name:"Johnny Awesome", created_by_id: '240', code: 'info-4444')
|
||||
Fabricate(:epp_user, id: 240)
|
||||
it 'doesn\'t display unassociated object' do
|
||||
Fabricate(:contact, name:"Johnny Awesome", code: 'info-4444')
|
||||
|
||||
response = epp_request('contacts/info.xml')
|
||||
expect(response[:result_code]).to eq('2201')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue