From c0cf697938040bc87ea6afbe9e32557794ea068c Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Thu, 5 Nov 2015 16:57:24 +0200 Subject: [PATCH 01/13] Story #104525314 - feature: admin can accept/reject pendingDelete{Confirmation} pending_json is not required --- app/views/admin/domains/form/_pending_delete.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/domains/form/_pending_delete.haml b/app/views/admin/domains/form/_pending_delete.haml index 6924a2b30..e555242a4 100644 --- a/app/views/admin/domains/form/_pending_delete.haml +++ b/app/views/admin/domains/form/_pending_delete.haml @@ -1,4 +1,4 @@ -- if (status == DomainStatus::PENDING_DELETE && f.object.pending_json.present?) +- if (status == DomainStatus::PENDING_DELETE || status == DomainStatus::PENDING_DELETE_CONFIRMATION) = link_to(t(:apply_pending), admin_domain_pending_delete_path(f.object.id, f.object.id), method: :patch, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') From 98e27f94d558770c98f02cac8350aee3582471e8 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Thu, 5 Nov 2015 18:32:04 +0200 Subject: [PATCH 02/13] Story #104525314 - fix -- should not show apply/delete pending for new status values --- app/views/admin/shared/form/_statuses.haml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/admin/shared/form/_statuses.haml b/app/views/admin/shared/form/_statuses.haml index 697abad44..27be8d032 100644 --- a/app/views/admin/shared/form/_statuses.haml +++ b/app/views/admin/shared/form/_statuses.haml @@ -9,8 +9,9 @@ .pull-left= t(:status) .pull-right - if model == 'domain' - = render 'admin/domains/form/pending_update', f: f, status: s - = render 'admin/domains/form/pending_delete', f: f, status: s + .hide-when-new + = render 'admin/domains/form/pending_update', f: f, status: s + = render 'admin/domains/form/pending_delete', f: f, status: s = link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style) .panel-body .form-group @@ -37,6 +38,7 @@ if el.find('.js-disabled-value') el.find('.js-disabled-value').remove() el.find('.js-select').show() + el.find('.hide-when-new').hide() el.find('.js-destroy-status').show() $(document).on 'click', '.js-destroy-status', (e) -> From c40a282a63177f9220dc977e3ae38fad813ce67f Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 09:30:05 +0200 Subject: [PATCH 03/13] Story #104525314 - change button text to accept/reject delete --- app/views/admin/domains/form/_pending_delete.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/domains/form/_pending_delete.haml b/app/views/admin/domains/form/_pending_delete.haml index e555242a4..2e199d0b7 100644 --- a/app/views/admin/domains/form/_pending_delete.haml +++ b/app/views/admin/domains/form/_pending_delete.haml @@ -1,8 +1,8 @@ - if (status == DomainStatus::PENDING_DELETE || status == DomainStatus::PENDING_DELETE_CONFIRMATION) - = link_to(t(:apply_pending), admin_domain_pending_delete_path(f.object.id, f.object.id), + = link_to(t(:accept_delete), admin_domain_pending_delete_path(f.object.id, f.object.id), method: :patch, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') - = link_to(t(:delete_pending), admin_domain_pending_delete_path(f.object.id, f.object.id), + = link_to(t(:reject_delete), admin_domain_pending_delete_path(f.object.id, f.object.id), method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') From 95bf081b5354a003e917815261873a3e6a65e776 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 11:09:37 +0200 Subject: [PATCH 04/13] Story #104525314 - feature reject combination of delete with deleteProhibited --- app/models/domain.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/domain.rb b/app/models/domain.rb index b70dbe9ae..77c76bd40 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -116,6 +116,11 @@ class Domain < ActiveRecord::Base validate :status_is_consistant def status_is_consistant has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE)) + unless has_error + if (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE, DomainStatus::FORCE_DELETE]).any? + has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED + end + end errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error end From 3d7f8e28669856b6122a837d2859343f3f4d354f Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 11:15:05 +0200 Subject: [PATCH 05/13] Story #104525314 - fix:admin could not confirm reject pending, refactor registrant confirm --- app/models/domain.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 77c76bd40..2cc2d233e 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -449,6 +449,7 @@ class Domain < ActiveRecord::Base # rubocop: disable Metrics/CyclomaticComplexity def registrant_update_confirmable?(token) return true if Rails.env.development? + return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any? return false unless pending_update? return false if registrant_verification_token.blank? return false if registrant_verification_asked_at.blank? @@ -698,7 +699,7 @@ class Domain < ActiveRecord::Base end def pending_delete? - statuses.include?(DomainStatus::PENDING_DELETE) && !statuses.include?(DomainStatus::FORCE_DELETE) + (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE]).any? end def pending_delete_confirmation? From ea230e70ca48e6af59c1ec104cb0d1cc6f0a1400 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 11:16:00 +0200 Subject: [PATCH 06/13] Story #104525314 - clean up, remove dev hacks, allow dev to verify end user experience --- app/models/domain.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 2cc2d233e..8554d37fa 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -448,7 +448,6 @@ class Domain < ActiveRecord::Base # rubocop: disable Metrics/CyclomaticComplexity def registrant_update_confirmable?(token) - return true if Rails.env.development? return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any? return false unless pending_update? return false if registrant_verification_token.blank? @@ -459,7 +458,6 @@ class Domain < ActiveRecord::Base end def registrant_delete_confirmable?(token) - return true if Rails.env.development? return false unless pending_delete? return false if registrant_verification_token.blank? return false if registrant_verification_asked_at.blank? From 8050059ad2591caf7ba075646d2c54b7b3169928 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 11:18:06 +0200 Subject: [PATCH 07/13] Story #104525314 - clean up, remove redundant logic, simplfy --- app/models/domain.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 8554d37fa..97cb60c48 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -450,19 +450,15 @@ class Domain < ActiveRecord::Base def registrant_update_confirmable?(token) return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any? return false unless pending_update? - return false if registrant_verification_token.blank? - return false if registrant_verification_asked_at.blank? - return false if token.blank? - return false if registrant_verification_token != token + return false unless registrant_verification_asked? + return false unless registrant_verification_token == token true end def registrant_delete_confirmable?(token) return false unless pending_delete? - return false if registrant_verification_token.blank? - return false if registrant_verification_asked_at.blank? - return false if token.blank? - return false if registrant_verification_token != token + return false unless registrant_verification_asked? + return false unless registrant_verification_token == token true end # rubocop: enable Metrics/CyclomaticComplexity From 1722e00e8c4cda881bc703cf41598e25434a185e Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Mon, 9 Nov 2015 17:09:54 +0200 Subject: [PATCH 08/13] Story #104525314 - Test: fix bd85e0b33ccd0c431223cbcf4423825e38ea5d4a paren required --- spec/epp/domain_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 4c5ba2118..8e3997649 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -2444,9 +2444,9 @@ describe 'EPP Domain', epp: true do }) response = epp_plain_request(xml) - response[:results][0][:msg].should start_with + response[:results][0][:msg].should start_with( "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': "\ - "[facet 'enumeration'] The value 'invalidStatus' is not an element of the set " + "[facet 'enumeration'] The value 'invalidStatus' is not an element of the set ") response[:results][0][:result_code].should == '2001' end From 8a14bf05f8d805f5976dc9adab9464601af5c5e8 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Mon, 9 Nov 2015 18:59:04 +0200 Subject: [PATCH 09/13] Story #104525314 - EPP user must respect serverDeleteProhibited --- app/models/epp/domain.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 9a9e51b4e..a0b75500a 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -776,12 +776,12 @@ class Epp::Domain < Domain ### ABILITIES ### - # depricated -- this is redundant TODO: try to remove + def can_be_deleted? begin errors.add(:base, :domain_status_prohibits_operation) return false - end if statuses.include?(DomainStatus::CLIENT_DELETE_PROHIBITED) + end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED].any? true end From 2cf7dd3a5c7951fefa82465bf9f1e044c959d284 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 10 Nov 2015 11:25:09 +0200 Subject: [PATCH 10/13] Story #104525314 - fix typo, missing paren --- app/models/epp/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index a0b75500a..7df26cc38 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -781,7 +781,7 @@ class Epp::Domain < Domain begin errors.add(:base, :domain_status_prohibits_operation) return false - end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED].any? + end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED].any?) true end From 9f4651bdaa3a2dceed333285d7f0becd933604a7 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 10 Nov 2015 14:41:38 +0200 Subject: [PATCH 11/13] Story #107192666 - bugfix: check content before determining XML format. Only use DS if DS present.:wq --- app/views/epp/domains/info.xml.builder | 39 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index c4827f29f..e7962002c 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -61,19 +61,34 @@ xml.epp_head do end xml.extension do + def tag_key_data(xml, key) + xml.tag!('secDNS:keyData') do + xml.tag!('secDNS:flags', key.flags) + xml.tag!('secDNS:protocol', key.protocol) + xml.tag!('secDNS:alg', key.alg) + xml.tag!('secDNS:pubKey', key.public_key) + end + end + + def tag_ds_data(xml, key) + xml.tag!('secDNS:dsData') do + xml.tag!('secDNS:keyTag', key.ds_key_tag) + xml.tag!('secDNS:alg', key.ds_alg) + xml.tag!('secDNS:digestType', key.ds_digest_type) + xml.tag!('secDNS:digest', key.ds_digest) + tag_key_data(xml, key) if key.public_key.present? + end + end + xml.tag!('secDNS:infData', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1') do - @domain.dnskeys.sort.each do |key| - xml.tag!('secDNS:dsData') do - xml.tag!('secDNS:keyTag', key.ds_key_tag) - xml.tag!('secDNS:alg', key.ds_alg) - xml.tag!('secDNS:digestType', key.ds_digest_type) - xml.tag!('secDNS:digest', key.ds_digest) - xml.tag!('secDNS:keyData') do - xml.tag!('secDNS:flags', key.flags) - xml.tag!('secDNS:protocol', key.protocol) - xml.tag!('secDNS:alg', key.alg) - xml.tag!('secDNS:pubKey', key.public_key) - end + # might not have ds in first key? maybe check any? k.ds_digest if requirements change (DS not accepted by EIS) + if @domain.dnskeys[0].ds_digest.blank? + @domain.dnskeys.sort.each do |key| + tag_key_data(xml, key) + end + else + @domain.dnskeys.sort.each do |key| + tag_ds_data(xml, key) end end end From ef845e42797e8f3aa0cb9bbca7848cdb79561888 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 10 Nov 2015 14:55:26 +0200 Subject: [PATCH 12/13] Story #104525314 - fix typo,2cf7dd3a5c7951fefa82465bf9f1e044c959d284 misplaced paren --- app/models/epp/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 7df26cc38..f59df6ddc 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -781,7 +781,7 @@ class Epp::Domain < Domain begin errors.add(:base, :domain_status_prohibits_operation) return false - end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED].any?) + end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED]).any? true end From 7d9272c60c90ba27f272a9495829a121ff26ca43 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 10 Nov 2015 19:29:44 +0200 Subject: [PATCH 13/13] Story #107192666 - ensure domains/info page shows keyData or dsData/keyData --- .../registrar/domains/partials/_dnskeys.haml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/views/registrar/domains/partials/_dnskeys.haml b/app/views/registrar/domains/partials/_dnskeys.haml index fc5961849..46dcd0fce 100644 --- a/app/views/registrar/domains/partials/_dnskeys.haml +++ b/app/views/registrar/domains/partials/_dnskeys.haml @@ -19,7 +19,22 @@ - if x.css('digest').text.present? %dt= t(:ds_digest) %dd= x.css('digest').text + - @data.css('keyData').each do |x| + %dl.dl-horizontal + %dt= t(:flag) + %dd= x.css('flags').text + %dt= t(:protocol) + %dd= x.css('protocol').text + + %dt= t(:algorithm) + %dd= x.css('alg').text + + %dt= t(:public_key) + %dd= x.css('pubKey').text + + - @data.css('keyData').each do |x| + %dl.dl-horizontal %dt= t(:flag) %dd= x.css('flags').text @@ -27,7 +42,7 @@ %dd= x.css('protocol').text %dt= t(:algorithm) - %dd= x.css('keyData > alg').text + %dd= x.css('alg').text %dt= t(:public_key) %dd= x.css('pubKey').text