mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 01:03:35 +02:00
Story #107192666 - refactor to add stricter inclusion rules
reformatted block, white space changes, indent for surounding if any? pull up find_all? if *_allowed then check if allowed.any?
This commit is contained in:
parent
334179fae9
commit
9ca17e6b4a
1 changed files with 34 additions and 29 deletions
|
@ -60,6 +60,11 @@ xml.epp_head do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @domain.dnskeys.any?
|
||||||
|
ds_data = Setting.ds_data_allowed ? @domain.dnskeys.find_all { |key| key.ds_digest.present? } : []
|
||||||
|
key_data = Setting.key_data_allowed ? @domain.dnskeys.find_all { |key| key.ds_digest.blank? } : []
|
||||||
|
|
||||||
|
# is there any reason to include <extension> without <secDNS:infData>
|
||||||
xml.extension do
|
xml.extension do
|
||||||
def tag_key_data(xml, key)
|
def tag_key_data(xml, key)
|
||||||
xml.tag!('secDNS:keyData') do
|
xml.tag!('secDNS:keyData') do
|
||||||
|
@ -82,17 +87,17 @@ xml.epp_head do
|
||||||
|
|
||||||
xml.tag!('secDNS:infData', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1') do
|
xml.tag!('secDNS:infData', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1') do
|
||||||
if Setting.ds_data_allowed
|
if Setting.ds_data_allowed
|
||||||
(@domain.dnskeys.find_all { |key| key.ds_digest.present? }).sort.each do |key|
|
ds_data.sort.each do |key|
|
||||||
tag_ds_data(xml, key)
|
tag_ds_data(xml, key)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(@domain.dnskeys.find_all { |key| key.ds_digest.blank? }).sort.each do |key|
|
key_data.sort.each do |key|
|
||||||
tag_key_data(xml, key)
|
tag_key_data(xml, key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end if @domain.dnskeys.any? && (Setting.ds_data_allowed ? @domain.dnskeys.any? { |key| key.ds_digest.present? } : Setting.key_data_allowed)
|
end if key_data.present? || ds_data.present?
|
||||||
|
end
|
||||||
render('epp/shared/trID', builder: xml)
|
render('epp/shared/trID', builder: xml)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue