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:
Matt Farnsworth 2015-11-13 19:06:12 +02:00
parent 334179fae9
commit 9ca17e6b4a

View file

@ -60,6 +60,11 @@ xml.epp_head do
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
def tag_key_data(xml, key)
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
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)
end
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)
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)
end
end