mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 18:59:38 +02:00
Remove dsData with keys option
This commit is contained in:
parent
b4545bae08
commit
218caa892e
3 changed files with 39 additions and 32 deletions
|
@ -146,7 +146,7 @@ class Epp::EppDomain < Domain
|
||||||
def domain_contact_list_from(frame)
|
def domain_contact_list_from(frame)
|
||||||
res = []
|
res = []
|
||||||
frame.css('contact').each do |x|
|
frame.css('contact').each do |x|
|
||||||
c = Contact.find_by(code: x.text).try(:id)
|
c = Contact.find_by(code: x.text)
|
||||||
|
|
||||||
# contact = Contact.find_by(code: x[:contact])
|
# contact = Contact.find_by(code: x[:contact])
|
||||||
# unless contact
|
# unless contact
|
||||||
|
@ -154,16 +154,16 @@ class Epp::EppDomain < Domain
|
||||||
# next
|
# next
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# if k == :admin && contact.bic?
|
|
||||||
# add_epp_error('2306', 'contact', x[:contact], [:domain_contacts, :admin_contact_can_be_only_citizen])
|
|
||||||
# next
|
|
||||||
# end
|
|
||||||
|
|
||||||
unless c
|
unless c
|
||||||
add_epp_error('2303', 'contact', x.text, [:domain_contacts, :not_found])
|
add_epp_error('2303', 'contact', x.text, [:domain_contacts, :not_found])
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if x['type'] == 'admin' && c.bic?
|
||||||
|
add_epp_error('2306', 'contact', x.text, [:domain_contacts, :admin_contact_can_be_only_citizen])
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
res << {
|
res << {
|
||||||
contact_id: Contact.find_by(code: x.text).try(:id),
|
contact_id: Contact.find_by(code: x.text).try(:id),
|
||||||
contact_type: x['type'],
|
contact_type: x['type'],
|
||||||
|
@ -175,6 +175,14 @@ class Epp::EppDomain < Domain
|
||||||
end
|
end
|
||||||
|
|
||||||
def dnskeys_attrs(frame, action)
|
def dnskeys_attrs(frame, action)
|
||||||
|
if frame.css('dsData').any? && !Setting.ds_data_allowed
|
||||||
|
errors.add(:base, :ds_data_not_allowed)
|
||||||
|
end
|
||||||
|
|
||||||
|
if frame.xpath('keyData').any? && !Setting.key_data_allowed
|
||||||
|
errors.add(:base, :key_data_not_allowed)
|
||||||
|
end
|
||||||
|
|
||||||
res = []
|
res = []
|
||||||
# res = { ds_data: [], key_data: [] }
|
# res = { ds_data: [], key_data: [] }
|
||||||
|
|
||||||
|
@ -495,7 +503,7 @@ class Epp::EppDomain < Domain
|
||||||
|
|
||||||
def validate_dnssec_data(dnssec_data)
|
def validate_dnssec_data(dnssec_data)
|
||||||
ds_data_allowed?(dnssec_data)
|
ds_data_allowed?(dnssec_data)
|
||||||
ds_data_with_keys_allowed?(dnssec_data)
|
# ds_data_with_keys_allowed?(dnssec_data)
|
||||||
key_data_allowed?(dnssec_data)
|
key_data_allowed?(dnssec_data)
|
||||||
|
|
||||||
errors.empty?
|
errors.empty?
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# otherwise rake not working 100%
|
# otherwise rake not working 100%
|
||||||
if ActiveRecord::Base.connected? && ActiveRecord::Base.connection.table_exists?('settings')
|
if ActiveRecord::Base.connected? && ActiveRecord::Base.connection.table_exists?('settings')
|
||||||
Setting.disclosure_name = true if Setting.disclosure_name.nil?
|
Setting.disclosure_name = true if Setting.disclosure_name.nil?
|
||||||
Setting.disclosure_name = true if Setting.disclosure_name.nil?
|
Setting.disclosure_name = true if Setting.disclosure_name.nil?
|
||||||
Setting.disclosure_org_name = true if Setting.disclosure_org_name.nil?
|
Setting.disclosure_org_name = true if Setting.disclosure_org_name.nil?
|
||||||
|
@ -15,7 +15,6 @@ if ActiveRecord::Base.connected? && ActiveRecord::Base.connection.table_exists?(
|
||||||
|
|
||||||
Setting.save_default(:ds_algorithm, 2)
|
Setting.save_default(:ds_algorithm, 2)
|
||||||
Setting.save_default(:ds_data_allowed, true)
|
Setting.save_default(:ds_data_allowed, true)
|
||||||
Setting.save_default(:ds_data_with_key_allowed, true)
|
|
||||||
Setting.save_default(:key_data_allowed, true)
|
Setting.save_default(:key_data_allowed, true)
|
||||||
|
|
||||||
Setting.save_default(:dnskeys_min_count, 0)
|
Setting.save_default(:dnskeys_min_count, 0)
|
||||||
|
|
|
@ -540,32 +540,32 @@ describe 'EPP Domain', epp: true do
|
||||||
ds.public_key.should == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f'
|
ds.public_key.should == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'prohibits dsData with key' do
|
# it 'prohibits dsData with key' do
|
||||||
Setting.ds_data_with_key_allowed = false
|
# Setting.ds_data_with_key_allowed = false
|
||||||
|
|
||||||
xml = domain_create_xml({}, {
|
# xml = domain_create_xml({}, {
|
||||||
_anonymus: [
|
# _anonymus: [
|
||||||
{ dsData: {
|
# { dsData: {
|
||||||
keyTag: { value: '12345' },
|
# keyTag: { value: '12345' },
|
||||||
alg: { value: '3' },
|
# alg: { value: '3' },
|
||||||
digestType: { value: '1' },
|
# digestType: { value: '1' },
|
||||||
digest: { value: '49FD46E6C4B45C55D4AC' },
|
# digest: { value: '49FD46E6C4B45C55D4AC' },
|
||||||
keyData: {
|
# keyData: {
|
||||||
flags: { value: '0' },
|
# flags: { value: '0' },
|
||||||
protocol: { value: '3' },
|
# protocol: { value: '3' },
|
||||||
alg: { value: '5' },
|
# alg: { value: '5' },
|
||||||
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
# pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}]
|
# }]
|
||||||
})
|
# })
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
# response = epp_plain_request(xml, :xml)
|
||||||
response[:result_code].should == '2306'
|
# response[:result_code].should == '2306'
|
||||||
response[:msg].should == 'dsData object with key data is not allowed'
|
# response[:msg].should == 'dsData object with key data is not allowed'
|
||||||
|
|
||||||
create_settings
|
# create_settings
|
||||||
end
|
# end
|
||||||
|
|
||||||
it 'prohibits dsData' do
|
it 'prohibits dsData' do
|
||||||
Setting.ds_data_allowed = false
|
Setting.ds_data_allowed = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue