mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 04:58:29 +02:00
Fix rubocop error
This commit is contained in:
parent
df255b5282
commit
6408f79080
1 changed files with 19 additions and 20 deletions
|
@ -245,13 +245,8 @@ class Epp::EppDomain < Domain
|
||||||
|
|
||||||
def detach_dnskeys(dnssec_data)
|
def detach_dnskeys(dnssec_data)
|
||||||
sg = SettingGroup.dnskeys
|
sg = SettingGroup.dnskeys
|
||||||
ds_data_allowed = sg.setting(Setting::ALLOW_DS_DATA).value == '0' ? false : true
|
|
||||||
key_data_allowed = sg.setting(Setting::ALLOW_KEY_DATA).value == '0' ? false : true
|
|
||||||
|
|
||||||
if dnssec_data[:ds_data].any? && !ds_data_allowed
|
return false unless validate_dnssec_data(dnssec_data, sg)
|
||||||
errors.add(:base, :ds_data_not_allowed)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
to_delete = []
|
to_delete = []
|
||||||
dnssec_data[:ds_data].each do |x|
|
dnssec_data[:ds_data].each do |x|
|
||||||
|
@ -263,11 +258,6 @@ class Epp::EppDomain < Domain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if dnssec_data[:key_data].any? && !key_data_allowed
|
|
||||||
errors.add(:base, :key_data_not_allowed)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
to_delete = []
|
to_delete = []
|
||||||
dnssec_data[:key_data].each do |x|
|
dnssec_data[:key_data].each do |x|
|
||||||
ds = dnskeys.where(public_key: x[:public_key])
|
ds = dnskeys.where(public_key: x[:public_key])
|
||||||
|
@ -455,6 +445,24 @@ class Epp::EppDomain < Domain
|
||||||
|
|
||||||
res[:max_sig_life] = parsed_frame.css('maxSigLife').first.try(:text)
|
res[:max_sig_life] = parsed_frame.css('maxSigLife').first.try(:text)
|
||||||
|
|
||||||
|
res = parse_ds_data_from_frame(parsed_frame, res)
|
||||||
|
parse_key_data_from_frame(parsed_frame, res)
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_key_data_from_frame(parsed_frame, res)
|
||||||
|
parsed_frame.xpath('keyData').each do |x|
|
||||||
|
res[:key_data] << {
|
||||||
|
flags: x.css('flags').first.try(:text),
|
||||||
|
protocol: x.css('protocol').first.try(:text),
|
||||||
|
alg: x.css('alg').first.try(:text),
|
||||||
|
public_key: x.css('pubKey').first.try(:text)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
res
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_ds_data_from_frame(parsed_frame, res)
|
||||||
parsed_frame.css('dsData').each do |x|
|
parsed_frame.css('dsData').each do |x|
|
||||||
data = {
|
data = {
|
||||||
ds_key_tag: x.css('keyTag').first.try(:text),
|
ds_key_tag: x.css('keyTag').first.try(:text),
|
||||||
|
@ -474,15 +482,6 @@ class Epp::EppDomain < Domain
|
||||||
res[:ds_data] << data
|
res[:ds_data] << data
|
||||||
end
|
end
|
||||||
|
|
||||||
parsed_frame.xpath('keyData').each do |x|
|
|
||||||
res[:key_data] << {
|
|
||||||
flags: x.css('flags').first.try(:text),
|
|
||||||
protocol: x.css('protocol').first.try(:text),
|
|
||||||
alg: x.css('alg').first.try(:text),
|
|
||||||
public_key: x.css('pubKey').first.try(:text)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
res
|
res
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue