fixed dnssec update checking logic

This commit is contained in:
dinsmol 2021-10-04 17:33:43 +03:00
parent 3a90b52879
commit ad7a9bf921

View file

@ -169,26 +169,26 @@ module Epp
def parsed_response_for_dnskey(value) def parsed_response_for_dnskey(value)
doc = Nokogiri::Slop params[:parsed_frame].css(value).to_html doc = Nokogiri::Slop params[:parsed_frame].css(value).to_html
return true if doc.document.children.empty? return true if doc.document.children.empty?
store = [] store = []
if value == 'add' case value
doc.document.add.children.each_with_index do |x, i| when 'add'
doc.document.add.children.each_with_index do |_x, i|
store << doc.document.add.children[i].name store << doc.document.add.children[i].name
end end
elsif value == 'chg' when 'chg'
doc.document.chg.children.each_with_index do |x, i| doc.document.chg.children.each_with_index do |_x, i|
store << doc.document.chg.children[i].name store << doc.document.chg.children[i].name
end end
else else
doc.document.rem.children.each_with_index do |x, i| doc.document.rem.children.each_with_index do |_x, i|
store << doc.document.rem.children[i].name store << doc.document.rem.children[i].name
end end
end end
return true if store.size == 1 and store[0] == "keyData" return true if store.size.positive? && store.include?('keyData')
store.empty? store.empty?
end end
@ -209,10 +209,9 @@ module Epp
return if parsed_response_for_dnskey('rem') return if parsed_response_for_dnskey('rem')
end end
return epp_errors.add(:epp_errors, epp_errors.add(:epp_errors,
code: '2304', code: '2304',
msg: "#{I18n.t(:object_status_prohibits_operation)} msg: "#{I18n.t(:object_status_prohibits_operation)} :serverObjUpdateProhibited")
:serverObjUpdateEnabled")
end end
end end