Disabled contact org

This commit is contained in:
Priit Tark 2015-03-10 10:56:55 +02:00
parent 67f23d2769
commit 94a3b7beff
5 changed files with 40 additions and 6 deletions

View file

@ -99,6 +99,7 @@ class Epp::ContactsController < EppController
msg: I18n.t('errors.messages.required_attribute_missing', key: 'ident country code missing')
}
end
contact_org_disabled
@prefix = nil
requires 'extension > extdata > ident'
end
@ -111,6 +112,7 @@ class Epp::ContactsController < EppController
msg: I18n.t('errors.messages.required_parameter_missing', key: 'add, rem or chg')
}
end
contact_org_disabled
requires 'id', 'authInfo > pw'
@prefix = nil
end
@ -120,4 +122,13 @@ class Epp::ContactsController < EppController
requires 'id', 'authInfo > pw'
@prefix = nil
end
def contact_org_disabled
return true if ENV['contact_org_enabled'] == 'true'
return true if params[:parsed_frame].css('postalInfo org').text.blank?
epp_errors << {
code: '2306',
msg: I18n.t(:parameter_value_policy_error)
}
end
end

View file

@ -3,6 +3,10 @@
app_name: .EE Registry
zonefile_export_dir: 'export/zonefiles'
# Contact epp will not accept org value by default
# and returns 2306 "Parameter value policy error"
contact_org_enabled: 'false'
# You can use `rake secret` to generate a secure secret key.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!

View file

@ -489,3 +489,4 @@ en:
sign_this_request: 'Sign this request'
revoke_this_certificate: 'Revoke this certificate'
crt_revoked: 'CRT (revoked)'
parameter_value_policy_error: 'Parameter value policy error'

View file

@ -16,7 +16,7 @@ Contact Mapping protocol short version:
<contact:id> 0-1 Contact id, optional, generated automatically if missing
<contact:postalInfo> 1 Postal information container
<contact:name> 1 Full name of the contact
<contact:org> 0-1 Name of organization
<contact:org> 0 Org is not supported and should be blank
<contact:addr> 1 Address container
<contact:street> 0-n Street name
<contact:city> 1 City name
@ -47,7 +47,7 @@ Contact Mapping protocol short version:
<contact:chg> 1 Change container
<contact:postalInfo> 1 Postal information container
<contact:name> 0-1 Full name of the contact
<contact:org> 0-1 Name of organization
<contact:org> 0 Org is not supported and should be blank
<contact:addr> 0-1 Address container
<contact:street> 0-n Street name
<contact:city> 0-1 City name

View file

@ -138,15 +138,20 @@ describe 'EPP Contact', epp: true do
end
it 'successfully saves custom code' do
response = create_request(
{ id: { value: '12345' } }
)
response = create_request({ id: { value: '12345' } })
response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000'
Contact.last.code.should == 'registrar1:12345'
end
it 'should return parameter value policy errror' do
response = create_request({ postalInfo: { org: { value: 'should not save' } } })
response[:msg].should == 'Parameter value policy error'
response[:result_code].should == '2306'
Contact.last.org_name.should == nil
end
end
context 'update command' do
@ -269,6 +274,19 @@ describe 'EPP Contact', epp: true do
Contact.find_by(code: 'sh8013').ident_type.should == 'birthday'
end
it 'should return parameter value policy errror for org update' do
response = update_request({
id: { value: 'sh8013' },
chg: {
postalInfo: { org: { value: 'should not save' } }
}
})
response[:msg].should == 'Parameter value policy error'
response[:result_code].should == '2306'
Contact.find_by(code: 'sh8013').org_name.should == nil
end
end
context 'delete command' do