From d45d580e86cc121f0edbef0e662fa9d63a2a519d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Wed, 18 Apr 2018 18:00:19 +0300 Subject: [PATCH 01/31] Changelog update 180419 --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66e29f9f7..1c39b9d07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +19.04.2018 +* WHOIS: domains with deleteCandidate status do not return registration details as domains waiting to be deleted [#789](https://github.com/internetee/registry/issues/789) +* Security: Nokigiri gem update to version 1.8.2 [#823](https://github.com/internetee/registry/pull/823) +* Bug: fixed missing translation error in admin mail templates page [#818](https://github.com/internetee/registry/pull/818) +* Admin: VAT percentage info to registrar profile for setting tax rate for foreign non vat liable registrars [#623](https://github.com/internetee/registry/issues/623) +* Admin: deleteCandidate status is now stressed in domain details view [#792](https://github.com/internetee/registry/issues/792) +* Removed invoice_type from invoice db data as unused [#772](https://github.com/internetee/registry/issues/772) +* Removed valid_from from domain db data as duplicated and unused [#787](https://github.com/internetee/registry/issues/787) +* Set Not null constraint to valid_ti domain db data [#800](https://github.com/internetee/registry/issues/800) +* Removed unused methods [#797](https://github.com/internetee/registry/issues/797) +* Removed unused cron tasks [#782](https://github.com/internetee/registry/issues/782) +* Removed some monkey-patching for flash message logging [#231](https://github.com/internetee/registry/issues/231) +* Added Docker container support for dev and test environments [#821](https://github.com/internetee/registry/issues/821) +* Fix for Travis CI random test failures [#809](https://github.com/internetee/registry/pull/809) + 03.04.2018 * BUG: Fixed bug with sometimes failing bank-link payments [#642](https://github.com/internetee/registry/issues/642) * EPP: Domain and associated objects are now validated on domain renew [#678](https://github.com/internetee/registry/issues/678) From ac3bd10a22ae1c55d452b8f8d70a441b08be2635 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Wed, 18 Apr 2018 23:19:15 +0300 Subject: [PATCH 02/31] Update Rails to 4.2.10 --- Gemfile | 2 +- Gemfile.lock | 96 ++++++++++++++++++++++++++-------------------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Gemfile b/Gemfile index 9b6f97dad..54210f794 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ source 'https://rubygems.org' gem 'SyslogLogger', '2.0', require: 'syslog/logger' gem 'iso8601', '0.8.6' # for dates and times -gem 'rails', '4.2.7.1' # when update, all initializers eis_custom files needs check/update +gem 'rails', '4.2.10' # when update, all initializers eis_custom files needs check/update gem 'rest-client' # load env diff --git a/Gemfile.lock b/Gemfile.lock index efa504d8e..03193e703 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,43 +60,42 @@ GEM remote: https://rubygems.org/ specs: SyslogLogger (2.0) - actionmailer (4.2.7.1) - actionpack (= 4.2.7.1) - actionview (= 4.2.7.1) - activejob (= 4.2.7.1) + actionmailer (4.2.10) + actionpack (= 4.2.10) + actionview (= 4.2.10) + activejob (= 4.2.10) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.7.1) - actionview (= 4.2.7.1) - activesupport (= 4.2.7.1) + actionpack (4.2.10) + actionview (= 4.2.10) + activesupport (= 4.2.10) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.7.1) - activesupport (= 4.2.7.1) + actionview (4.2.10) + activesupport (= 4.2.10) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) + rails-html-sanitizer (~> 1.0, >= 1.0.3) active_model-errors_details (1.3.1) activemodel (>= 3.2.13, < 5.0.0) activesupport - activejob (4.2.7.1) - activesupport (= 4.2.7.1) + activejob (4.2.10) + activesupport (= 4.2.10) globalid (>= 0.3.0) - activemodel (4.2.7.1) - activesupport (= 4.2.7.1) + activemodel (4.2.10) + activesupport (= 4.2.10) builder (~> 3.1) - activerecord (4.2.7.1) - activemodel (= 4.2.7.1) - activesupport (= 4.2.7.1) + activerecord (4.2.10) + activemodel (= 4.2.10) + activesupport (= 4.2.10) arel (~> 6.0) activerecord-import (0.7.0) activerecord (>= 3.0) - activesupport (4.2.7.1) + activesupport (4.2.10) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) @@ -160,7 +159,7 @@ GEM unicode_utils (~> 1.4) crack (0.4.3) safe_yaml (~> 1.0.0) - crass (1.0.3) + crass (1.0.4) daemons (1.2.4) daemons-rails (1.2.1) daemons @@ -189,8 +188,8 @@ GEM railties (>= 3.0.0) figaro (1.1.1) thor (~> 0.14) - globalid (0.3.7) - activesupport (>= 4.1.0) + globalid (0.4.1) + activesupport (>= 4.2.0) grape (0.12.0) activesupport builder @@ -228,7 +227,7 @@ GEM httpi (2.4.2) rack socksify - i18n (0.8.4) + i18n (0.8.6) i18n_data (0.7.0) ice_nine (0.11.2) isikukood (0.1.2) @@ -251,8 +250,8 @@ GEM loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.6) - mime-types (>= 1.16, < 4) + mail (2.7.0) + mini_mime (>= 0.1.1) method_source (0.8.2) mime-types (3.1) mime-types-data (~> 3.2015) @@ -260,8 +259,9 @@ GEM mina (0.3.1) open4 (~> 1.3.4) rake + mini_mime (1.0.0) mini_portile2 (2.3.0) - minitest (5.10.3) + minitest (5.11.3) monetize (1.6.0) money (~> 6.8) money (6.8.3) @@ -313,35 +313,35 @@ GEM rack-test (0.6.3) rack (>= 1.0) railroady (1.3.0) - rails (4.2.7.1) - actionmailer (= 4.2.7.1) - actionpack (= 4.2.7.1) - actionview (= 4.2.7.1) - activejob (= 4.2.7.1) - activemodel (= 4.2.7.1) - activerecord (= 4.2.7.1) - activesupport (= 4.2.7.1) + rails (4.2.10) + actionmailer (= 4.2.10) + actionpack (= 4.2.10) + actionview (= 4.2.10) + activejob (= 4.2.10) + activemodel (= 4.2.10) + activerecord (= 4.2.10) + activesupport (= 4.2.10) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.7.1) + railties (= 4.2.10) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.8) - activesupport (>= 4.2.0.beta, < 5.0) + rails-dom-testing (1.0.9) + activesupport (>= 4.2.0, < 5.0) nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) rails-settings-cached (0.4.1) rails (>= 4.0.0) - railties (4.2.7.1) - actionpack (= 4.2.7.1) - activesupport (= 4.2.7.1) + railties (4.2.10) + actionpack (= 4.2.10) + activesupport (= 4.2.10) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.2.2) rake - rake (12.0.0) + rake (12.3.1) ransack (1.5.1) actionpack (>= 3.0) activerecord (>= 3.0) @@ -430,14 +430,14 @@ GEM sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.0) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - thor (0.19.4) + thor (0.20.0) thread_safe (0.3.6) tilt (1.4.1) - tzinfo (1.2.3) + tzinfo (1.2.5) thread_safe (~> 0.1) unf (0.1.4) unf_ext @@ -522,7 +522,7 @@ DEPENDENCIES que-web (= 0.4.0) que_mailer! railroady (= 1.3.0) - rails (= 4.2.7.1) + rails (= 4.2.10) rails-settings-cached (= 0.4.1) ransack (= 1.5.1) rest-client @@ -542,4 +542,4 @@ DEPENDENCIES whenever (= 0.9.4) BUNDLED WITH - 1.14.6 + 1.16.1 From 3fb7824a79d1961ab40e1784c3eeb5b6cd7a28da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Fri, 20 Apr 2018 18:45:32 +0300 Subject: [PATCH 03/31] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c39b9d07..edd7378fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -19.04.2018 +23.04.2018 * WHOIS: domains with deleteCandidate status do not return registration details as domains waiting to be deleted [#789](https://github.com/internetee/registry/issues/789) * Security: Nokigiri gem update to version 1.8.2 [#823](https://github.com/internetee/registry/pull/823) * Bug: fixed missing translation error in admin mail templates page [#818](https://github.com/internetee/registry/pull/818) From b0bec41f56b73167ec3d267b8cf8778470205262 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Tue, 24 Apr 2018 11:53:27 +0300 Subject: [PATCH 04/31] Write a test that covers missing and non-existent values --- app/views/admin/domain_versions/archive.haml | 5 +- app/views/admin/domain_versions/show.haml | 5 +- .../integration/admin/domain_versions_test.rb | 64 +++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 test/integration/admin/domain_versions_test.rb diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 5e6d8eaa9..4137064a2 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -56,7 +56,10 @@ - @versions.each do |version| - if version - domain = Domain.new(version.object.to_h) - - version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) } + - version.object_changes.to_h.each do |k, v| + - method_name = "#{k}=".to_sym + - if domain.respond_to?(method_name) + - domain.public_send("#{k}=", v.last) %tr %td= link_to(domain.name, admin_domain_version_path(version.id)) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 1a17ba3f9..9071feafb 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -1,5 +1,8 @@ - domain = Domain.new(@version.object.to_h) -- @version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) } +- @version.object_changes.to_h.each do |k, v| + - method_name = "#{k}=".to_sym + - if domain.respond_to?(method_name) + - domain.public_send("#{k}=", v.last) - if @version - children = HashWithIndifferentAccess.new(@version.children) diff --git a/test/integration/admin/domain_versions_test.rb b/test/integration/admin/domain_versions_test.rb new file mode 100644 index 000000000..8e69d5098 --- /dev/null +++ b/test/integration/admin/domain_versions_test.rb @@ -0,0 +1,64 @@ +require 'test_helper' + +class DomainVersionsTest < ActionDispatch::IntegrationTest + def setup + super + + create_domain_with_history + login_as users(:admin) + end + + def teardown + super + + delete_objects_once_done + end + + def create_domain_with_history + sql = <<-SQL.squish + INSERT INTO registrars (id, name, reg_no, email, country_code, code, + accounting_customer_code, language) + VALUES (54, 'test_registrar', 'test123', 'test@test.com', 'EE', 'TEST123', + 'test123', 'en'); + + INSERT INTO contacts (id, code, auth_info, registrar_id) + VALUES (54, 'test_code', '8b4d462aa04194ca78840a', 54); + + INSERT INTO domains (id, registrar_id, valid_to, registrant_id, + transfer_code) + VALUES (54, 54, '2018-06-23T12:14:02.732+03:00', 54, 'transfer_code'); + + INSERT INTO log_domains (item_type, item_id, event, whodunnit, object, + object_changes, created_at, nameserver_ids, tech_contact_ids, + admin_contact_ids, session, children) + VALUES ('Domain', 54, 'update', '1-AdminUser', + '{"id": 54, "registrar_id": 54, "valid_to": "2018-07-23T12:14:05.583+03:00", "registrant_id": 54, "transfer_code": "transfer_code"}', + '{"valid_from": "2017-07-23T12:14:05.583+03:00", "foo": "bar", "other_made_up_field": "value"}', + '2018-04-23 15:50:48.113491', '{}', '{}', '{}', '2018-04-23 12:44:56', + '{"null_fracdmin_contacts":[108],"tech_contacts":[109],"nameservers":[],"dnskeys":[],"legal_documents":[null],"registrant":[1]}' + ) + SQL + ActiveRecord::Base.connection.execute(sql) + end + + def delete_objects_once_done + ActiveRecord::Base.connection.execute('DELETE FROM log_domains where item_id = 54') + Domain.destroy_all + Contact.destroy_all + Registrar.destroy_all + end + + def test_removed_fields_are_not_causing_errors_in_index_view + visit admin_domain_versions_path + assert_text 'test_registrar' + assert_text 'test_registrar update 23.04.18, 18:50' + end + + def test_removed_fields_are_not_causing_errors_in_details_view + version_id = Domain.find(54).versions.last + visit admin_domain_version_path(version_id) + + assert_text 'test_registrar' + assert_text '23.04.18, 18:50 update 1-AdminUser' + end +end From a93228c579f417e84a619b8b72d5ba024d1d3b10 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Tue, 24 Apr 2018 13:19:11 +0300 Subject: [PATCH 05/31] Extract block to helper function --- app/controllers/admin/contact_versions_controller.rb | 2 ++ app/helpers/object_versions_helper.rb | 10 ++++++++++ app/views/admin/domain_versions/archive.haml | 5 +---- app/views/admin/domain_versions/show.haml | 5 +---- 4 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 app/helpers/object_versions_helper.rb diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index d066f698e..e64a86774 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -1,5 +1,7 @@ module Admin class ContactVersionsController < BaseController + include ObjectVersionsHelper + load_and_authorize_resource def index diff --git a/app/helpers/object_versions_helper.rb b/app/helpers/object_versions_helper.rb new file mode 100644 index 000000000..c8b2d8de9 --- /dev/null +++ b/app/helpers/object_versions_helper.rb @@ -0,0 +1,10 @@ +module ObjectVersionsHelper + def attach_existing_fields(version, new_object) + version.object_changes.to_h.each do |k, v| + method_name = "#{k}=".to_sym + if new_object.respond_to?(method_name) + new_object.public_send(method_name, v.last) + end + end + end +end diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 4137064a2..3f5258653 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -56,10 +56,7 @@ - @versions.each do |version| - if version - domain = Domain.new(version.object.to_h) - - version.object_changes.to_h.each do |k, v| - - method_name = "#{k}=".to_sym - - if domain.respond_to?(method_name) - - domain.public_send("#{k}=", v.last) + - attach_existing_fields(version, domain) %tr %td= link_to(domain.name, admin_domain_version_path(version.id)) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 9071feafb..3cce3e14c 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -1,8 +1,5 @@ - domain = Domain.new(@version.object.to_h) -- @version.object_changes.to_h.each do |k, v| - - method_name = "#{k}=".to_sym - - if domain.respond_to?(method_name) - - domain.public_send("#{k}=", v.last) +- attach_existing_fields(@version, domain) - if @version - children = HashWithIndifferentAccess.new(@version.children) From cec05c3943ed80c5192dd1b5dc5dbb3deb5b9b8f Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Tue, 24 Apr 2018 13:19:34 +0300 Subject: [PATCH 06/31] Test and fix contact_versions controller affected by the same bug --- .../admin/domain_versions_controller.rb | 2 + app/views/admin/contact_versions/index.haml | 2 +- app/views/admin/contact_versions/show.haml | 6 +- .../admin/contact_versions_test.rb | 60 +++++++++++++++++++ 4 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 test/integration/admin/contact_versions_test.rb diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 283c84f97..2585ab894 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -1,5 +1,7 @@ module Admin class DomainVersionsController < BaseController + include ObjectVersionsHelper + load_and_authorize_resource def index diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index 0367db3be..519161a10 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -58,7 +58,7 @@ - @versions.each do |version| - if version - contact = Contact.new(version.object.to_h) - - version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last) } + - attach_existing_fields(version, contact) %tr %td= link_to(contact.name, admin_contact_version_path(version.id)) diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index e19326fca..713f03046 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -1,5 +1,5 @@ - contact = Contact.new(@version.object.to_h) -- @version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last ) } +- attach_existing_fields(@version, contact) = render 'shared/title', name: contact.name .row @@ -41,11 +41,11 @@ %br - %dt= t(:created) + %dt= t(:created_at) %dd{class: changing_css_class(@version,"created_at")} = l(contact.created_at, format: :short) - %dt= t(:updated) + %dt= t(:updated_at) %dd{class: changing_css_class(@version,"updated_at")} = l(contact.updated_at, format: :short) diff --git a/test/integration/admin/contact_versions_test.rb b/test/integration/admin/contact_versions_test.rb new file mode 100644 index 000000000..25e44f5a1 --- /dev/null +++ b/test/integration/admin/contact_versions_test.rb @@ -0,0 +1,60 @@ +require 'test_helper' + +class ContactVersionsTest < ActionDispatch::IntegrationTest + def setup + super + + create_contact_with_history + login_as users(:admin) + end + + def teardown + super + + delete_objects_once_done + end + + def create_contact_with_history + sql = <<-SQL.squish + INSERT INTO registrars (id, name, reg_no, email, country_code, code, + accounting_customer_code, language) + VALUES (75, 'test_registrar', 'test123', 'test@test.com', 'EE', 'TEST123', + 'test123', 'en'); + + INSERT INTO contacts (id, code, auth_info, registrar_id) + VALUES (75, 'test_code', '8b4d462aa04194ca78840a', 75); + + INSERT INTO log_contacts (item_type, item_id, event, whodunnit, object, + object_changes, created_at, session, children, ident_updated_at, uuid) + VALUES ('Contact', 75, 'update', '1-AdminUser', + '{"id": 75, "code": "test_code", "auth_info": "8b4d462aa04194ca78840a", "registrar_id": 75}', + '{"other_made_up_field": "value"}', + '2018-04-23 15:50:48.113491', '2018-04-23 12:44:56', + '{"legal_documents":[null]}', null, null + ) + SQL + + ActiveRecord::Base.connection.execute(sql) + end + + def delete_objects_once_done + ActiveRecord::Base.connection.execute('DELETE from log_contacts where item_id = 75') + Domain.destroy_all + Contact.destroy_all + Registrar.destroy_all + end + + def test_removed_fields_are_not_causing_errors_in_index_view + visit admin_contact_versions_path + assert_text 'test_registrar' + assert_text 'update 23.04.18, 18:50' + end + + def test_removed_fields_are_not_causing_errors_in_details_view + version_id = Contact.find(75).versions.last + visit admin_contact_version_path(version_id) + + assert_text 'test_registrar' + assert_text '23.04.18, 18:50 update 1-AdminUser' + end +end From 764414ba34c10e1556401b379f553b1f7a2c8d6d Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Wed, 25 Apr 2018 14:34:37 +0300 Subject: [PATCH 07/31] Add new Setting to handle whois disclaimers --- app/views/admin/settings/index.haml | 1 + config/initializers/initial_settings.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/admin/settings/index.haml b/app/views/admin/settings/index.haml index c41f5cd6b..14e158ec0 100644 --- a/app/views/admin/settings/index.haml +++ b/app/views/admin/settings/index.haml @@ -99,6 +99,7 @@ = render 'setting_row', var: :registry_state = render 'setting_row', var: :registry_zip = render 'setting_row', var: :registry_country_code + = render 'setting_row', var: :registry_whois_disclaimer .row .col-md-12.text-right diff --git a/config/initializers/initial_settings.rb b/config/initializers/initial_settings.rb index 5ae521bc5..b6efea6eb 100644 --- a/config/initializers/initial_settings.rb +++ b/config/initializers/initial_settings.rb @@ -72,4 +72,5 @@ if con.present? && con.table_exists?('settings') Setting.save_default(:registry_bank_code, '689') Setting.save_default(:registry_swift, 'LHVBEE22') Setting.save_default(:registry_invoice_contact, 'Martti Õigus') + Setting.save_default(:registry_whois_disclaimer, 'Search results may not be used for commercial, advertising, recompilation, repackaging, redistribution, reuse, obscuring or other similar activities.') end From 9c606bdf2f90717bd109b53a7a578ee6af9e9cba Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Wed, 25 Apr 2018 15:28:56 +0300 Subject: [PATCH 08/31] Add disclaimer to whois JSON --- app/jobs/update_whois_record_job.rb | 2 +- app/models/whois_record.rb | 7 ++++++ test/models/whois_record_test.rb | 34 +++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 test/models/whois_record_test.rb diff --git a/app/jobs/update_whois_record_job.rb b/app/jobs/update_whois_record_job.rb index acfafa3d4..bee0e032c 100644 --- a/app/jobs/update_whois_record_job.rb +++ b/app/jobs/update_whois_record_job.rb @@ -51,4 +51,4 @@ class UpdateWhoisRecordJob < Que::Job def delete_blocked(name) delete_reserved(name) end -end \ No newline at end of file +end diff --git a/app/models/whois_record.rb b/app/models/whois_record.rb index 3ff0e9023..42ea0b2fa 100644 --- a/app/models/whois_record.rb +++ b/app/models/whois_record.rb @@ -36,6 +36,7 @@ class WhoisRecord < ActiveRecord::Base registrant = domain.registrant @disclosed = [] + h[:disclaimer] = disclaimer_text h[:name] = domain.name h[:status] = domain.statuses.map { |x| status_map[x] || x } h[:registered] = domain.registered_at.try(:to_s, :iso8601) @@ -120,4 +121,10 @@ class WhoisRecord < ActiveRecord::Base def destroy_whois_record Whois::Record.where(name: name).delete_all end + + private + + def disclaimer_text + Setting.registry_whois_disclaimer + end end diff --git a/test/models/whois_record_test.rb b/test/models/whois_record_test.rb new file mode 100644 index 000000000..ed9a087f7 --- /dev/null +++ b/test/models/whois_record_test.rb @@ -0,0 +1,34 @@ +require 'test_helper' + +class WhoisRecordTest < ActiveSupport::TestCase + def setup + super + + @domain = domains(:shop) + @record = WhoisRecord.new(domain: @domain) + end + + def test_generated_json_has_expected_values + + expected_disclaimer_text = <<-TEXT.squish + Search results may not be used for commercial, advertising, recompilation, + repackaging, redistribution, reuse, obscuring or other similar activities. + TEXT + + expected_partial_hash = { + disclaimer: expected_disclaimer_text, + name: 'shop.test', + registrant: 'John', + registrant_kind: 'priv', + email: 'john@inbox.test', + expire: '2010-07-05', + nameservers: ['ns1.bestnames.test', 'ns2.bestnames.test'], + registrar_address: 'Main Street, New York, New York, 12345', + dnssec_keys: [], + } + + expected_partial_hash.each do |key, value| + assert_equal(value, @record.generated_json[key]) + end + end +end From 449a37252fa31fe3d05970ff5527a51ed7ee0135 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Wed, 25 Apr 2018 16:59:07 +0300 Subject: [PATCH 09/31] Add disclaimer to UNIX template --- app/views/for_models/whois.erb | 2 ++ test/models/whois_record_test.rb | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/views/for_models/whois.erb b/app/views/for_models/whois.erb index 390511031..2d8db1d59 100644 --- a/app/views/for_models/whois.erb +++ b/app/views/for_models/whois.erb @@ -1,3 +1,5 @@ +<%= json['disclaimer'].scan(/\S.{0,72}\S(?=\s|$)|\S+/).join('\n') %> + Estonia .ee Top Level Domain WHOIS server Domain: diff --git a/test/models/whois_record_test.rb b/test/models/whois_record_test.rb index ed9a087f7..83822d37e 100644 --- a/test/models/whois_record_test.rb +++ b/test/models/whois_record_test.rb @@ -9,7 +9,6 @@ class WhoisRecordTest < ActiveSupport::TestCase end def test_generated_json_has_expected_values - expected_disclaimer_text = <<-TEXT.squish Search results may not be used for commercial, advertising, recompilation, repackaging, redistribution, reuse, obscuring or other similar activities. @@ -31,4 +30,17 @@ class WhoisRecordTest < ActiveSupport::TestCase assert_equal(value, @record.generated_json[key]) end end + + def test_generated_body_has_justified_disclaimer + expected_disclaimer_first_line = begin + "Search results may not be used for commercial, advertising, recompilation," + end + expected_disclaimer_second_line = begin + "repackaging, redistribution, reuse, obscuring or other similar activities" + end + @record.populate + + assert_match(expected_disclaimer_first_line, @record.body) + assert_match(expected_disclaimer_second_line, @record.body) + end end From fcab0ccedb958307bfa9e9d6e6d61445cc97a8b4 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Wed, 25 Apr 2018 17:04:54 +0300 Subject: [PATCH 10/31] Remove migrated whois_record test from Rspec test collection --- spec/models/whois_record_spec.rb | 67 -------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 spec/models/whois_record_spec.rb diff --git a/spec/models/whois_record_spec.rb b/spec/models/whois_record_spec.rb deleted file mode 100644 index c1fba57f9..000000000 --- a/spec/models/whois_record_spec.rb +++ /dev/null @@ -1,67 +0,0 @@ -require 'rails_helper' - -RSpec.describe WhoisRecord do - describe '::generate_json', db: false do - let(:registrant) { build_stubbed(:registrant) } - let(:domain) { build_stubbed(:domain, registrant: registrant) } - let(:whois_record) { described_class.new } - subject(:generated_json) { whois_record.generate_json } - - before do - allow(whois_record).to receive(:domain).and_return(domain) - end - - it 'generates registrant kind' do - expect(registrant).to receive(:kind).and_return('test kind') - expect(generated_json[:registrant_kind]).to eq('test kind') - end - - describe 'reg no' do - subject(:reg_no) { generated_json[:registrant_reg_no] } - - before do - allow(registrant).to receive(:reg_no).and_return('test reg no') - end - - context 'when registrant is legal entity' do - let(:registrant) { build_stubbed(:registrant_legal_entity) } - - it 'is present' do - expect(reg_no).to eq('test reg no') - end - end - - context 'when registrant is private entity' do - let(:registrant) { build_stubbed(:registrant_private_entity) } - - it 'is absent' do - expect(reg_no).to be_nil - end - end - end - - describe 'country code' do - subject(:country_code) { generated_json[:registrant_ident_country_code] } - - before do - allow(registrant).to receive(:ident_country_code).and_return('test country code') - end - - context 'when registrant is legal entity' do - let(:registrant) { build_stubbed(:registrant_legal_entity) } - - it 'is present' do - expect(country_code).to eq('test country code') - end - end - - context 'when registrant is private entity' do - let(:registrant) { build_stubbed(:registrant_private_entity) } - - it 'is absent' do - expect(country_code).to be_nil - end - end - end - end -end From a82db7a67a175ab83af16f1c3234020d6b7f1368 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Wed, 25 Apr 2018 16:03:13 +0300 Subject: [PATCH 11/31] Solve both sides of the missing fields bug, not only one --- app/helpers/object_versions_helper.rb | 11 ++++++++--- app/views/admin/contact_versions/index.haml | 5 +++-- app/views/admin/contact_versions/show.haml | 3 ++- app/views/admin/domain_versions/archive.haml | 3 ++- app/views/admin/domain_versions/show.haml | 3 ++- test/integration/admin/contact_versions_test.rb | 2 +- test/integration/admin/domain_versions_test.rb | 5 +++-- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/app/helpers/object_versions_helper.rb b/app/helpers/object_versions_helper.rb index c8b2d8de9..d8e00abbe 100644 --- a/app/helpers/object_versions_helper.rb +++ b/app/helpers/object_versions_helper.rb @@ -1,10 +1,15 @@ module ObjectVersionsHelper def attach_existing_fields(version, new_object) - version.object_changes.to_h.each do |k, v| - method_name = "#{k}=".to_sym + version.object_changes.to_h.each do |key, value| + method_name = "#{key}=".to_sym if new_object.respond_to?(method_name) - new_object.public_send(method_name, v.last) + new_object.public_send(method_name, value.last) end end end + + def only_present_fields(version, model) + field_names = model.column_names + version.object.to_h.select { |key, _value| field_names.include?(key) } + end end diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index 519161a10..8f293ba5d 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -57,8 +57,9 @@ %tbody - @versions.each do |version| - if version - - contact = Contact.new(version.object.to_h) - - attach_existing_fields(version, contact) + - attributes = only_present_fields(version, Contact) + - contact = Contact.new(attributes) + - attach_existing_fields(version, contact) %tr %td= link_to(contact.name, admin_contact_version_path(version.id)) diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index 713f03046..6e5af9e14 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -1,4 +1,5 @@ -- contact = Contact.new(@version.object.to_h) +- attributes = only_present_fields(@version, Contact) +- contact = Contact.new(attributes) - attach_existing_fields(@version, contact) = render 'shared/title', name: contact.name diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 3f5258653..9fdf8b000 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -55,7 +55,8 @@ %tbody - @versions.each do |version| - if version - - domain = Domain.new(version.object.to_h) + - attributes = only_present_fields(version, Domain) + - domain = Domain.new(attributes) - attach_existing_fields(version, domain) %tr diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 3cce3e14c..9a38150be 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -1,4 +1,5 @@ -- domain = Domain.new(@version.object.to_h) +- present_fields = only_present_fields(@version, Domain) +- domain = Domain.new(present_fields) - attach_existing_fields(@version, domain) - if @version diff --git a/test/integration/admin/contact_versions_test.rb b/test/integration/admin/contact_versions_test.rb index 25e44f5a1..cd67eb964 100644 --- a/test/integration/admin/contact_versions_test.rb +++ b/test/integration/admin/contact_versions_test.rb @@ -27,7 +27,7 @@ class ContactVersionsTest < ActionDispatch::IntegrationTest INSERT INTO log_contacts (item_type, item_id, event, whodunnit, object, object_changes, created_at, session, children, ident_updated_at, uuid) VALUES ('Contact', 75, 'update', '1-AdminUser', - '{"id": 75, "code": "test_code", "auth_info": "8b4d462aa04194ca78840a", "registrar_id": 75}', + '{"id": 75, "code": "test_code", "auth_info": "8b4d462aa04194ca78840a", "registrar_id": 75, "old_field": "value"}', '{"other_made_up_field": "value"}', '2018-04-23 15:50:48.113491', '2018-04-23 12:44:56', '{"legal_documents":[null]}', null, null diff --git a/test/integration/admin/domain_versions_test.rb b/test/integration/admin/domain_versions_test.rb index 8e69d5098..195433948 100644 --- a/test/integration/admin/domain_versions_test.rb +++ b/test/integration/admin/domain_versions_test.rb @@ -32,8 +32,8 @@ class DomainVersionsTest < ActionDispatch::IntegrationTest object_changes, created_at, nameserver_ids, tech_contact_ids, admin_contact_ids, session, children) VALUES ('Domain', 54, 'update', '1-AdminUser', - '{"id": 54, "registrar_id": 54, "valid_to": "2018-07-23T12:14:05.583+03:00", "registrant_id": 54, "transfer_code": "transfer_code"}', - '{"valid_from": "2017-07-23T12:14:05.583+03:00", "foo": "bar", "other_made_up_field": "value"}', + '{"id": 54, "registrar_id": 54, "valid_to": "2018-07-23T12:14:05.583+03:00", "registrant_id": 54, "transfer_code": "transfer_code", "valid_from": "2017-07-23T12:14:05.583+03:00"}', + '{"foo": "bar", "other_made_up_field": "value"}', '2018-04-23 15:50:48.113491', '{}', '{}', '{}', '2018-04-23 12:44:56', '{"null_fracdmin_contacts":[108],"tech_contacts":[109],"nameservers":[],"dnskeys":[],"legal_documents":[null],"registrant":[1]}' ) @@ -50,6 +50,7 @@ class DomainVersionsTest < ActionDispatch::IntegrationTest def test_removed_fields_are_not_causing_errors_in_index_view visit admin_domain_versions_path + assert_text 'test_registrar' assert_text 'test_registrar update 23.04.18, 18:50' end From 2c494d93737649c81a44c615d73f93bc500ab4d1 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Thu, 26 Apr 2018 08:57:28 +0300 Subject: [PATCH 12/31] Fix brakeman issue by extracting gsub into a function --- app/helpers/contact_helper.rb | 5 +++++ app/views/admin/contact_versions/show.haml | 2 +- app/views/registrant/contacts/partials/_address.haml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 app/helpers/contact_helper.rb diff --git a/app/helpers/contact_helper.rb b/app/helpers/contact_helper.rb new file mode 100644 index 000000000..6b15e3da4 --- /dev/null +++ b/app/helpers/contact_helper.rb @@ -0,0 +1,5 @@ +module ContactHelper + def printable_street(street) + street.to_s.gsub("\n", '
').html_safe + end +end diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index 6e5af9e14..38139b455 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -62,7 +62,7 @@ - if contact.street.present? %dt= t(:street) - %dd{class: changing_css_class(@version,"street")}= contact.street.to_s.gsub("\n", '
').html_safe + %dd{class: changing_css_class(@version,"street")}= printable_street(contact.street) - if contact.city.present? %dt= t(:city) diff --git a/app/views/registrant/contacts/partials/_address.haml b/app/views/registrant/contacts/partials/_address.haml index 9c0f548e3..fffef581f 100644 --- a/app/views/registrant/contacts/partials/_address.haml +++ b/app/views/registrant/contacts/partials/_address.haml @@ -8,7 +8,7 @@ %dd= @contact.org_name %dt= t(:street) - %dd= @contact.street.to_s.gsub("\n", '
').html_safe + %dd= printable_street(@contact.street) %dt= t(:city) %dd= @contact.city From 396852df5384182b574c5cbbecf130031e077c40 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Thu, 26 Apr 2018 11:44:05 +0300 Subject: [PATCH 13/31] Remove technical and administrative contacts info It's a partial solution for https://github.com/internetee/whois/issues/26 --- app/views/for_models/whois.erb | 10 +++++----- test/models/whois_record_test.rb | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/views/for_models/whois.erb b/app/views/for_models/whois.erb index 2d8db1d59..04abd3094 100644 --- a/app/views/for_models/whois.erb +++ b/app/views/for_models/whois.erb @@ -1,4 +1,4 @@ -<%= json['disclaimer'].scan(/\S.{0,72}\S(?=\s|$)|\S+/).join('\n') %> +<%= json['disclaimer'].scan(/\S.{0,72}\S(?=\s|$)|\S+/).join("\n") %> Estonia .ee Top Level Domain WHOIS server @@ -25,18 +25,18 @@ changed: <%= json['registrant_changed'].to_s.tr('T',' ').sub('+', ' +') %> <%- if json['admin_contacts'].present? -%> Administrative contact: <%- for contact in json['admin_contacts'] -%> -name: <%= contact['name'] %> +name: Not Disclosed - Visit www.internet.ee for webbased WHOIS email: Not Disclosed - Visit www.internet.ee for webbased WHOIS -changed: <%= contact['changed'].to_s.tr('T',' ').sub('+', ' +') %> +changed: Not Disclosed - Visit www.internet.ee for webbased WHOIS <%- end -%> <%- end -%> <% if json['tech_contacts'].present? %> Technical contact: <%- for contact in json['tech_contacts'] -%> -name: <%= contact['name'] %> +name: Not Disclosed - Visit www.internet.ee for webbased WHOIS email: Not Disclosed - Visit www.internet.ee for webbased WHOIS -changed: <%= contact['changed'].to_s.tr('T',' ').sub('+', ' +') %> +changed: Not Disclosed - Visit www.internet.ee for webbased WHOIS <%- end -%> <%- end -%> diff --git a/test/models/whois_record_test.rb b/test/models/whois_record_test.rb index 83822d37e..ea8de006a 100644 --- a/test/models/whois_record_test.rb +++ b/test/models/whois_record_test.rb @@ -32,15 +32,22 @@ class WhoisRecordTest < ActiveSupport::TestCase end def test_generated_body_has_justified_disclaimer - expected_disclaimer_first_line = begin - "Search results may not be used for commercial, advertising, recompilation," + expected_disclaimer = begin + 'Search results may not be used for commercial, advertising, recompilation,\n' \ + 'repackaging, redistribution, reuse, obscuring or other similar activities.' end - expected_disclaimer_second_line = begin - "repackaging, redistribution, reuse, obscuring or other similar activities" + expected_technical_contact = begin + 'Technical contact:\n' \ + 'name: Not Disclosed - Visit www.internet.ee for webbased WHOIS\n' \ + 'email: Not Disclosed - Visit www.internet.ee for webbased WHOIS\n' \ + 'changed: Not Disclosed - Visit www.internet.ee for webbased WHOIS' end - @record.populate - assert_match(expected_disclaimer_first_line, @record.body) - assert_match(expected_disclaimer_second_line, @record.body) + regexp_contact = Regexp.new(expected_technical_contact, Regexp::MULTILINE) + regexp_disclaimer = Regexp.new(expected_disclaimer, Regexp::MULTILINE) + + @record.populate + assert_match(regexp_disclaimer, @record.body) + assert_match(regexp_contact, @record.body) end end From 20d341f2e5ef45682b6a1f9252940f1158c87c2e Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Thu, 26 Apr 2018 12:18:03 +0300 Subject: [PATCH 14/31] Add handling of missing disclaimer --- app/models/whois_record.rb | 2 +- app/views/for_models/whois.erb | 2 ++ test/models/whois_record_test.rb | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/models/whois_record.rb b/app/models/whois_record.rb index 42ea0b2fa..e4ccec22f 100644 --- a/app/models/whois_record.rb +++ b/app/models/whois_record.rb @@ -36,7 +36,7 @@ class WhoisRecord < ActiveRecord::Base registrant = domain.registrant @disclosed = [] - h[:disclaimer] = disclaimer_text + h[:disclaimer] = disclaimer_text if disclaimer_text.present? h[:name] = domain.name h[:status] = domain.statuses.map { |x| status_map[x] || x } h[:registered] = domain.registered_at.try(:to_s, :iso8601) diff --git a/app/views/for_models/whois.erb b/app/views/for_models/whois.erb index 04abd3094..5bc1b30f5 100644 --- a/app/views/for_models/whois.erb +++ b/app/views/for_models/whois.erb @@ -1,5 +1,7 @@ +<%- if json['disclaimer'].present? %> <%= json['disclaimer'].scan(/\S.{0,72}\S(?=\s|$)|\S+/).join("\n") %> +<%- end %> Estonia .ee Top Level Domain WHOIS server Domain: diff --git a/test/models/whois_record_test.rb b/test/models/whois_record_test.rb index ea8de006a..9d050bc29 100644 --- a/test/models/whois_record_test.rb +++ b/test/models/whois_record_test.rb @@ -6,6 +6,7 @@ class WhoisRecordTest < ActiveSupport::TestCase @domain = domains(:shop) @record = WhoisRecord.new(domain: @domain) + @record.populate end def test_generated_json_has_expected_values @@ -46,8 +47,14 @@ class WhoisRecordTest < ActiveSupport::TestCase regexp_contact = Regexp.new(expected_technical_contact, Regexp::MULTILINE) regexp_disclaimer = Regexp.new(expected_disclaimer, Regexp::MULTILINE) - @record.populate assert_match(regexp_disclaimer, @record.body) assert_match(regexp_contact, @record.body) end + + def test_whois_record_has_no_disclaimer_if_Setting_is_blank + Setting.stubs(:registry_whois_disclaimer, '') do + refute(@record.json['disclaimer']) + refute_match(/Search results may not be used for commercial/, @record.body) + end + end end From 255706fb4530d9692b5891f7c0d8a0d853c4d40f Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Thu, 26 Apr 2018 12:30:17 +0300 Subject: [PATCH 15/31] Remove unecessary handling of newlines in contact views --- app/helpers/contact_helper.rb | 5 ----- app/views/admin/contact_versions/show.haml | 2 +- app/views/registrant/contacts/partials/_address.haml | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 app/helpers/contact_helper.rb diff --git a/app/helpers/contact_helper.rb b/app/helpers/contact_helper.rb deleted file mode 100644 index 6b15e3da4..000000000 --- a/app/helpers/contact_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module ContactHelper - def printable_street(street) - street.to_s.gsub("\n", '
').html_safe - end -end diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index 38139b455..a412b4312 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -62,7 +62,7 @@ - if contact.street.present? %dt= t(:street) - %dd{class: changing_css_class(@version,"street")}= printable_street(contact.street) + %dd{class: changing_css_class(@version,"street")}= contact.street - if contact.city.present? %dt= t(:city) diff --git a/app/views/registrant/contacts/partials/_address.haml b/app/views/registrant/contacts/partials/_address.haml index fffef581f..fe57bd393 100644 --- a/app/views/registrant/contacts/partials/_address.haml +++ b/app/views/registrant/contacts/partials/_address.haml @@ -8,7 +8,7 @@ %dd= @contact.org_name %dt= t(:street) - %dd= printable_street(@contact.street) + %dd= @contact.street %dt= t(:city) %dd= @contact.city From 3c1125879ccd67ff296ac6045be5079a28178d54 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Thu, 26 Apr 2018 15:03:09 +0300 Subject: [PATCH 16/31] Update Ruby in .ruby-version and in the Dockerfile --- .ruby-version | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruby-version b/.ruby-version index 5bc1cc43d..e75da3e63 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.2.7 +2.3.6 diff --git a/Dockerfile b/Dockerfile index 0c2c51e25..480231fc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.2 +FROM ruby:2.3 MAINTAINER maciej.szlosarczyk@internet.ee RUN apt-get update > /dev/null && apt-get install -y > /dev/null \ From a6a99df58e37311dfc0af8860f737431aba62d79 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Fri, 27 Apr 2018 10:35:42 +0300 Subject: [PATCH 17/31] Create AdminContactsTest --- spec/features/admin/contacts/list_spec.rb | 12 ---------- test/integration/admin/contacts_test.rb | 29 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 12 deletions(-) delete mode 100644 spec/features/admin/contacts/list_spec.rb create mode 100644 test/integration/admin/contacts_test.rb diff --git a/spec/features/admin/contacts/list_spec.rb b/spec/features/admin/contacts/list_spec.rb deleted file mode 100644 index 80312fb17..000000000 --- a/spec/features/admin/contacts/list_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'rails_helper' - -RSpec.feature 'Contact list', settings: false do - background do - sign_in_to_admin_area - end - - it 'is visible' do - visit admin_contacts_path - expect(page).to have_css('.contacts') - end -end diff --git a/test/integration/admin/contacts_test.rb b/test/integration/admin/contacts_test.rb new file mode 100644 index 000000000..52abd7bb0 --- /dev/null +++ b/test/integration/admin/contacts_test.rb @@ -0,0 +1,29 @@ +require 'test_helper' + +class AdminContactsTest < ActionDispatch::IntegrationTest + def setup + super + + @contact = contacts(:william) + login_as users(:admin) + end + + def teardown + super + end + + def test_display_list + visit admin_contacts_path + + assert_text('william-001') + assert_text('william-002') + assert_text('acme-ltd-001') + end + + def test_display_details + visit admin_contact_path(@contact) + + assert_text('Street Main Street City New York Postcode 12345 ' \ + 'State New York Country United States of America') + end +end From cecb60623cd99b383778f73ec87fd8433ca1fd6c Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Fri, 27 Apr 2018 10:41:43 +0300 Subject: [PATCH 18/31] Remove unecessary teardown block --- test/integration/admin/contacts_test.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/integration/admin/contacts_test.rb b/test/integration/admin/contacts_test.rb index 52abd7bb0..1f517e8cb 100644 --- a/test/integration/admin/contacts_test.rb +++ b/test/integration/admin/contacts_test.rb @@ -8,10 +8,6 @@ class AdminContactsTest < ActionDispatch::IntegrationTest login_as users(:admin) end - def teardown - super - end - def test_display_list visit admin_contacts_path From c08561fa0d8184fbf3d554e7eb788a5e4a6ad0bb Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Fri, 27 Apr 2018 14:10:16 +0300 Subject: [PATCH 19/31] Remove information about web-based whois form name fields --- app/views/for_models/whois.erb | 13 ++++++------- test/models/whois_record_test.rb | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/views/for_models/whois.erb b/app/views/for_models/whois.erb index 5bc1b30f5..02b9b1398 100644 --- a/app/views/for_models/whois.erb +++ b/app/views/for_models/whois.erb @@ -1,7 +1,6 @@ -<%- if json['disclaimer'].present? %> +<%- if json['disclaimer'].present? -%> <%= json['disclaimer'].scan(/\S.{0,72}\S(?=\s|$)|\S+/).join("\n") %> - -<%- end %> +<%- end -%> Estonia .ee Top Level Domain WHOIS server Domain: @@ -27,18 +26,18 @@ changed: <%= json['registrant_changed'].to_s.tr('T',' ').sub('+', ' +') %> <%- if json['admin_contacts'].present? -%> Administrative contact: <%- for contact in json['admin_contacts'] -%> -name: Not Disclosed - Visit www.internet.ee for webbased WHOIS +name: Not Disclosed email: Not Disclosed - Visit www.internet.ee for webbased WHOIS -changed: Not Disclosed - Visit www.internet.ee for webbased WHOIS +changed: Not Disclosed <%- end -%> <%- end -%> <% if json['tech_contacts'].present? %> Technical contact: <%- for contact in json['tech_contacts'] -%> -name: Not Disclosed - Visit www.internet.ee for webbased WHOIS +name: Not Disclosed email: Not Disclosed - Visit www.internet.ee for webbased WHOIS -changed: Not Disclosed - Visit www.internet.ee for webbased WHOIS +changed: Not Disclosed <%- end -%> <%- end -%> diff --git a/test/models/whois_record_test.rb b/test/models/whois_record_test.rb index 9d050bc29..438ee9cc4 100644 --- a/test/models/whois_record_test.rb +++ b/test/models/whois_record_test.rb @@ -39,9 +39,9 @@ class WhoisRecordTest < ActiveSupport::TestCase end expected_technical_contact = begin 'Technical contact:\n' \ - 'name: Not Disclosed - Visit www.internet.ee for webbased WHOIS\n' \ + 'name: Not Disclosed\n' \ 'email: Not Disclosed - Visit www.internet.ee for webbased WHOIS\n' \ - 'changed: Not Disclosed - Visit www.internet.ee for webbased WHOIS' + 'changed: Not Disclosed' end regexp_contact = Regexp.new(expected_technical_contact, Regexp::MULTILINE) From 15a651e51b29b0ef9b9cc7a133f205680c6daf95 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Fri, 27 Apr 2018 15:01:39 +0300 Subject: [PATCH 20/31] Fix Rubocop issues after Ruby upgrade --- .rubocop.yml | 3 +++ app/controllers/admin/blocked_domains_controller.rb | 4 +--- app/controllers/admin/contact_versions_controller.rb | 2 +- app/controllers/admin/contacts_controller.rb | 2 +- app/controllers/admin/domain_versions_controller.rb | 2 +- app/controllers/admin/domains_controller.rb | 2 +- app/controllers/admin/invoices_controller.rb | 2 +- app/controllers/admin/reserved_domains_controller.rb | 4 +--- app/controllers/epp_controller.rb | 4 ++-- app/controllers/registrant/domains_controller.rb | 2 +- app/controllers/registrar/contacts_controller.rb | 2 +- app/controllers/registrar/deposits_controller.rb | 2 +- app/controllers/registrar/domains_controller.rb | 2 +- app/models/ability.rb | 4 ++-- app/models/epp/contact.rb | 4 ++-- app/models/epp/domain.rb | 6 +++--- app/validators/domain_name_validator.rb | 2 +- app/views/epp/domains/info.xml.builder | 2 +- 18 files changed, 25 insertions(+), 26 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3d8fd0b90..497e45bbe 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,3 +2,6 @@ inherit_from: .rubocop_todo.yml Style/Alias: EnforcedStyle: prefer_alias_method + +Style/FrozenStringLiteralComment: + Enabled: false diff --git a/app/controllers/admin/blocked_domains_controller.rb b/app/controllers/admin/blocked_domains_controller.rb index d9227d773..bf5359b82 100644 --- a/app/controllers/admin/blocked_domains_controller.rb +++ b/app/controllers/admin/blocked_domains_controller.rb @@ -3,13 +3,11 @@ module Admin load_and_authorize_resource def index - params[:q] ||= {} domains = BlockedDomain.all.order(:name) @q = domains.search(params[:q]) @domains = @q.result.page(params[:page]) - @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 - + @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? end def new diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index e64a86774..834353cf4 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -26,7 +26,7 @@ module Admin versions = ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc) @q = versions.search(params[:q]) @versions = @q.result.page(params[:page]) - @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? end diff --git a/app/controllers/admin/contacts_controller.rb b/app/controllers/admin/contacts_controller.rb index 6402d09ae..b53d366ab 100644 --- a/app/controllers/admin/contacts_controller.rb +++ b/app/controllers/admin/contacts_controller.rb @@ -22,7 +22,7 @@ module Admin @contacts = @q.result.uniq.page(params[:page]) end - @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? end def search diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 2585ab894..b6245f6ea 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -43,7 +43,7 @@ module Admin versions = DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc) @q = versions.search(params[:q]) @versions = @q.result.page(params[:page]) - @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? render "admin/domain_versions/archive" end diff --git a/app/controllers/admin/domains_controller.rb b/app/controllers/admin/domains_controller.rb index 576b5f8e1..71d49a2ab 100644 --- a/app/controllers/admin/domains_controller.rb +++ b/app/controllers/admin/domains_controller.rb @@ -32,7 +32,7 @@ module Admin end end - @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? end # rubocop: enable Metrics/PerceivedComplexity diff --git a/app/controllers/admin/invoices_controller.rb b/app/controllers/admin/invoices_controller.rb index 9b97d0903..39bf06152 100644 --- a/app/controllers/admin/invoices_controller.rb +++ b/app/controllers/admin/invoices_controller.rb @@ -13,7 +13,7 @@ module Admin @deposit = Deposit.new(deposit_params.merge(registrar: r)) @invoice = @deposit.issue_prepayment_invoice - if @invoice && @invoice.persisted? + if @invoice&.persisted? flash[:notice] = t(:record_created) redirect_to [:admin, @invoice] else diff --git a/app/controllers/admin/reserved_domains_controller.rb b/app/controllers/admin/reserved_domains_controller.rb index 52a74f345..78d752866 100644 --- a/app/controllers/admin/reserved_domains_controller.rb +++ b/app/controllers/admin/reserved_domains_controller.rb @@ -4,13 +4,11 @@ module Admin before_action :set_domain, only: [:edit, :update] def index - params[:q] ||= {} domains = ReservedDomain.all.order(:name) @q = domains.search(params[:q]) @domains = @q.result.page(params[:page]) - @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 - + @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? end def new diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index 36bdcd6cc..3eba05777 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -168,7 +168,7 @@ class EppController < ApplicationController # validate legal document's type here because it may be in most of the requests @prefix = nil - if element_count('extdata > legalDocument') > 0 + if element_count('extdata > legalDocument').positive? requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES, policy: true) end @@ -279,7 +279,7 @@ class EppController < ApplicationController def optional(selector, *validations) full_selector = [@prefix, selector].compact.join(' ') el = params[:parsed_frame].css(full_selector).first - return unless el && el.text.present? + return unless el&.text.present? value = el.text validations.each do |x| diff --git a/app/controllers/registrant/domains_controller.rb b/app/controllers/registrant/domains_controller.rb index 7cde44a86..0e2f6eeaf 100644 --- a/app/controllers/registrant/domains_controller.rb +++ b/app/controllers/registrant/domains_controller.rb @@ -6,7 +6,7 @@ class Registrant::DomainsController < RegistrantController @q = domains.search(params[:q]) @domains = @q.result.page(params[:page]) end - @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? end def show diff --git a/app/controllers/registrar/contacts_controller.rb b/app/controllers/registrar/contacts_controller.rb index f5f527e1f..cb059641e 100644 --- a/app/controllers/registrar/contacts_controller.rb +++ b/app/controllers/registrar/contacts_controller.rb @@ -33,7 +33,7 @@ class Registrar @contacts = @q.result(distinct: :true).page(params[:page]) end - @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? end def download_list diff --git a/app/controllers/registrar/deposits_controller.rb b/app/controllers/registrar/deposits_controller.rb index 856b22553..ec6d13977 100644 --- a/app/controllers/registrar/deposits_controller.rb +++ b/app/controllers/registrar/deposits_controller.rb @@ -10,7 +10,7 @@ class Registrar @deposit = Deposit.new(deposit_params.merge(registrar: current_user.registrar)) @invoice = @deposit.issue_prepayment_invoice - if @invoice && @invoice.persisted? + if @invoice&.persisted? flash[:notice] = t(:please_pay_the_following_invoice) redirect_to [:registrar, @invoice] else diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb index b85923a02..774ec2e44 100644 --- a/app/controllers/registrar/domains_controller.rb +++ b/app/controllers/registrar/domains_controller.rb @@ -40,7 +40,7 @@ class Registrar end end - @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? respond_to do |format| format.html diff --git a/app/models/ability.rb b/app/models/ability.rb index 3883bbabf..6083d700f 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -13,9 +13,9 @@ class Ability case @user.class.to_s when 'AdminUser' - @user.roles.each { |role| send(role) } if @user.roles + @user.roles&.each { |role| send(role) } when 'ApiUser' - @user.roles.each { |role| send(role) } if @user.roles + @user.roles&.each { |role| send(role) } when 'RegistrantUser' static_registrant end diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index b280ceea6..699c07ab0 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -147,7 +147,7 @@ class Epp::Contact < Contact end if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) - frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + frame.css("legalDocument").first.content = doc.path if doc&.persisted? self.legal_document_id = doc.id end @@ -238,7 +238,7 @@ class Epp::Contact < Contact ) self.legal_documents = [doc] - frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + frame.css("legalDocument").first.content = doc.path if doc&.persisted? self.legal_document_id = doc.id end diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 4e0e7d44c..dcf61ddcf 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -197,7 +197,7 @@ class Epp::Domain < Domain ) self.legal_documents = [doc] - frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + frame.css("legalDocument").first.content = doc.path if doc&.persisted? self.legal_document_id = doc.id end # rubocop: enable Metrics/PerceivedComplexity @@ -472,7 +472,7 @@ class Epp::Domain < Domain at.deep_merge!(attrs_from(frame.css('rem'), current_user, 'rem')) if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) - frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + frame.css("legalDocument").first.content = doc.path if doc&.persisted? self.legal_document_id = doc.id end @@ -547,7 +547,7 @@ class Epp::Domain < Domain check_discarded if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) - frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + frame.css("legalDocument").first.content = doc.path if doc&.persisted? end if Setting.request_confirmation_on_domain_deletion_enabled && diff --git a/app/validators/domain_name_validator.rb b/app/validators/domain_name_validator.rb index 49939087c..26db4dda9 100644 --- a/app/validators/domain_name_validator.rb +++ b/app/validators/domain_name_validator.rb @@ -37,7 +37,7 @@ class DomainNameValidator < ActiveModel::EachValidator def validate_blocked(value) return true unless value - return false if BlockedDomain.where(name: value).count > 0 + return false if BlockedDomain.where(name: value).count.positive? DNS::Zone.where(origin: value).count.zero? end end diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index 2d10f8baf..850334955 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -22,7 +22,7 @@ xml.epp_head do xml.tag!('domain:contact', ac.code, 'type' => 'admin') end - if @nameservers && @nameservers.any? + if @nameservers&.any? xml.tag!('domain:ns') do @nameservers.each do |x| xml.tag!('domain:hostAttr') do From 817806f99c973a31c87fa4bab96c08ad4099be5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 3 May 2018 12:43:06 +0300 Subject: [PATCH 21/31] Changelog update 180430 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index edd7378fc..334422623 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +30.04.2018 +* Upgrade Ruby on Rails to version 4.2.10 [#826](https://github.com/internetee/registry/issues/826) +* BUG: Admin - fixed internal error in domain_versions and contact_versions views caused by removed db column [#830](https://github.com/internetee/registry/issues/830) + 23.04.2018 * WHOIS: domains with deleteCandidate status do not return registration details as domains waiting to be deleted [#789](https://github.com/internetee/registry/issues/789) * Security: Nokigiri gem update to version 1.8.2 [#823](https://github.com/internetee/registry/pull/823) From 95ed1bbf47f3df540250a38beb99f464748d9109 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Thu, 3 May 2018 16:53:01 +0300 Subject: [PATCH 22/31] Add support for asice document format --- app/models/legal_document.rb | 2 +- config/application-example.yml | 2 +- doc/epp/contact.md | 36 +++++++------- doc/epp/domain.md | 86 +++++++++++++++++----------------- lib/schemas/eis-1.0.xsd | 1 + 5 files changed, 64 insertions(+), 63 deletions(-) diff --git a/app/models/legal_document.rb b/app/models/legal_document.rb index c1f9243e3..5126e75e7 100644 --- a/app/models/legal_document.rb +++ b/app/models/legal_document.rb @@ -6,7 +6,7 @@ class LegalDocument < ActiveRecord::Base if ENV['legal_document_types'].present? TYPES = ENV['legal_document_types'].split(',').map(&:strip) else - TYPES = %w(pdf bdoc ddoc zip rar gz tar 7z odt doc docx).freeze + TYPES = %w(pdf asice bdoc ddoc zip rar gz tar 7z odt doc docx).freeze end attr_accessor :body diff --git a/config/application-example.yml b/config/application-example.yml index e61293b4c..60ae87952 100644 --- a/config/application-example.yml +++ b/config/application-example.yml @@ -67,7 +67,7 @@ contact_org_enabled: 'false' # iptables_server_ip: '127.0.0.1' # Custom legal document types. Changing this requires updating EPP extension schema for allowed legalDocEnumType values. -# System default for legal document types is: pdf,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx +# System default for legal document types is: pdf,asice,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx # legal_document_types: "pdf,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx" diff --git a/doc/epp/contact.md b/doc/epp/contact.md index b1f00aedf..1dcd9b6d2 100644 --- a/doc/epp/contact.md +++ b/doc/epp/contact.md @@ -8,7 +8,7 @@ More info at http://en.wikipedia.org/wiki/Extensible_Provisioning_Protocol Contact Mapping protocol short version: All values are limited to Unicode Latin characters if stricter limits are not specified. This includes unicode blocks -Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B, Latin Extended C, Latin Extended D, +Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B, Latin Extended C, Latin Extended D, Latin Extended Additional, Diacritics. More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode @@ -16,9 +16,9 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode Field name Min-max Field description ----------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" - 0-1 Contact id, optional, + 0-1 Contact id, optional, string: ASCII letters, numbers, ':', '-' characters, no spaces, max 100 characters, generated automatically if missing. @@ -34,7 +34,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode 1 Phone number in format \+ddd.d+ 0 Fax is not supported and must be blank or missing 1 E-mail - 1 + 1 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 1 Identifier Attribute: "type" @@ -43,8 +43,8 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode "birthday" # Birthday date in format in YYYY-MM-DD Attribute: "cc" "EE" # Country code in ISO_3166-1 aplha 2 - 0-1 Base64 encoded document - Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" + 0-1 Base64 encoded document + Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-create-command-successfully-creates-a-contact) @@ -53,7 +53,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode Field name Min-max Field description ----------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" 1 Contact id, required 1 Change container @@ -71,7 +71,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode 0-1 E-mail 0-1 Required if registrar is not the owner of the contact. 1 Contact password. Attribute: roid="String" - 0-1 + 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Identifier Attribute: "type" @@ -80,8 +80,8 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode "birthday" # Birthday date in format in YYYY-MM-DD Attribute: "cc" "EE" # Country code in ISO_3166-1 aplha 2 - 0-1 Base64 encoded document. - Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" + 0-1 Base64 encoded document. + Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id @@ -91,15 +91,15 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode Field name Min-max Field description ----------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" 1 Contact id 0-1 Required if registrar is not the owner of the contact. 1 Contact password. Attribute: roid="String" - 0-1 + 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" - 0-1 Base64 encoded document. - Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" + 0-1 Base64 encoded document. + Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-delete-command-deletes-contact) @@ -109,9 +109,9 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode Field name Min-max Field description ----------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" - 1-n Contact id + 1-n Contact id 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-check-command-returns-info-about-contact-availability) @@ -121,9 +121,9 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode Field name Min-max Field description ----------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" - 1-n Contact id + 1-n Contact id 0-1 Required if registrar is not the owner of the contact. 1 Contact password. Attribute: roid="String" 0-1 Client transaction id diff --git a/doc/epp/domain.md b/doc/epp/domain.md index 0933efe4b..fa74b004c 100644 --- a/doc/epp/domain.md +++ b/doc/epp/domain.md @@ -12,15 +12,15 @@ Domain name mapping protocol short version: Field name Min-max Field description ------------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" 1 Domain name. Can contain unicode characters. - 0-1 Registration period for domain. + 0-1 Registration period for domain. Must add up to 3m, 6m, 9m, 1y, 2y, 3y, 4y, 5y, 6y, 7y, 8y, 9y, 10y. Attribute: unit="y/m/d" Default is 1 year. - 0-1 - 2-11 + 0-1 + 2-11 1 Hostname of the nameserver 0-2 Required if nameserver hostname is under the same domain. Attribute ip="v4 / v6" @@ -30,16 +30,16 @@ Domain name mapping protocol short version: 0-1 1 Transfer code. Attribute: roid="String" - 1 + 1 0-1 Attribute: xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" - 1-n + 1-n 1 Allowed values: 0, 256, 257 1 Allowed values: 3 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14 1 Public key 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" - 1 Base64 encoded document. - Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" + 1 Base64 encoded document. + Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 0-1 Required if registering a reserved domain 0-1 Client transaction id @@ -50,27 +50,27 @@ Domain name mapping protocol short version: Field name Min-max Field description ------------------------ -------- ----------------- - 1 + 1 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" 1 Domain name. Can contain unicode characters. 0-1 Objects to add 0-n Contact reference. Attribute: type="admin / tech" - 0-n Status description. - Attribute: s="clientDeleteProhibited / clientHold / - clientRenewProhibited / clientTransferProhibited / + 0-n Status description. + Attribute: s="clientDeleteProhibited / clientHold / + clientRenewProhibited / clientTransferProhibited / clientUpdateProhibited" - 0-1 - 1 + 0-1 + 1 1 Hostname of the nameserver 0-2 Required if nameserver hostname is under the same domain. Attribute ip="v4 / v6" 0-1 Objects to remove 0-n Contact reference. Attribute: type="admin / tech" - 0-n Attribute: s="clientDeleteProhibited / clientHold / - clientRenewProhibited / clientTransferProhibited / + 0-n Attribute: s="clientDeleteProhibited / clientHold / + clientRenewProhibited / clientTransferProhibited / clientUpdateProhibited" - 0-1 - 1 + 0-1 + 1 1 Hostname of the nameserver 0-1 Attributes to change 0-1 Contact reference to the registrant @@ -80,18 +80,18 @@ Domain name mapping protocol short version: 0-1 Required if registrant is changing 0-1 Attribute: xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" - 0-1 - 1-n + 0-1 + 1-n 1 Public key - 0-1 - 1-n + 0-1 + 1-n 1 Allowed values: 0, 256, 257 1 Allowed values: 3 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14 1 Public key 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" - 0-1 Base64 encoded document. Required if registrant is changing. - Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" + 0-1 Base64 encoded document. Required if registrant is changing. + Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-updates-domain-and-adds-objects) @@ -100,14 +100,14 @@ Domain name mapping protocol short version: Field name Min-max Field description ----------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" Optional attribute: verified="yes/no" 1 Domain name. Can contain unicode characters. - 1 + 1 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" - 1 Base64 encoded document. - Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" + 1 Base64 encoded document. + Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-deletes-domain) @@ -116,9 +116,9 @@ Domain name mapping protocol short version: Field name Min-max Field description ----------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" - 1 Domain name. Can contain unicode characters. + 1 Domain name. Can contain unicode characters. Attribute: hosts="all / del / sub / none" 0-1 Required if registrar is not the owner of the domain. 1 Domain transfer code. Attribute: roid="String" @@ -130,18 +130,18 @@ Domain name mapping protocol short version: Field name Min-max Field description ----------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" - 1 Domain name. Can contain unicode characters. + 1 Domain name. Can contain unicode characters. 1 Current expiry date (ISO8601 format) - 0-1 Registration period for domain. + 0-1 Registration period for domain. Must add up to 3m, 6m, 9m, 1y, 2y, 3y, 4y, 5y, 6y, 7y, 8y, 9y, 10y. Attribute: unit="y/m/d" Default value is 1 year. - 0-1 + 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" - 0-1 Base64 encoded document. - Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" + 0-1 Base64 encoded document. + Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-renews-a-domain) @@ -152,13 +152,13 @@ Domain name mapping protocol short version: ----------------------- ------- ----------------- 1 Attribute: op="request/query/approve/reject/cancel" 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" - 1 Domain name. Can contain unicode characters. - 1 + 1 Domain name. Can contain unicode characters. + 1 1 Domain transfer code. Attribute: roid="String" - 0-1 + 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" - 0-1 Base64 encoded document. - Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" + 0-1 Base64 encoded document. + Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-transfers-a-domain) @@ -167,9 +167,9 @@ Domain name mapping protocol short version: Field name Min-max Field description ----------------------- ------- ----------------- - 1 + 1 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" - 1 Domain name. Can contain unicode characters. + 1 Domain name. Can contain unicode characters. 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-checks-a-domain) diff --git a/lib/schemas/eis-1.0.xsd b/lib/schemas/eis-1.0.xsd index 0b2ad8f89..efc9b466f 100644 --- a/lib/schemas/eis-1.0.xsd +++ b/lib/schemas/eis-1.0.xsd @@ -63,6 +63,7 @@ + From 09bb8600505d384899165f2ea95a0d50f9796f8a Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Fri, 4 May 2018 16:00:56 +0300 Subject: [PATCH 23/31] Update application-example.yml to include asice file format --- config/application-example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application-example.yml b/config/application-example.yml index 60ae87952..c89730699 100644 --- a/config/application-example.yml +++ b/config/application-example.yml @@ -68,7 +68,7 @@ contact_org_enabled: 'false' # Custom legal document types. Changing this requires updating EPP extension schema for allowed legalDocEnumType values. # System default for legal document types is: pdf,asice,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx -# legal_document_types: "pdf,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx" +# legal_document_types: "pdf,asice,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx" # From acbca42a9f38feb7ee2b0abb0b612b76aa1bb42f Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Mon, 7 May 2018 10:00:08 +0300 Subject: [PATCH 24/31] Add support for .sce legal document --- app/models/legal_document.rb | 2 +- config/application-example.yml | 4 ++-- doc/epp/contact.md | 6 +++--- doc/epp/domain.md | 10 +++++----- lib/schemas/eis-1.0.xsd | 1 + 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/models/legal_document.rb b/app/models/legal_document.rb index 5126e75e7..df7bf881b 100644 --- a/app/models/legal_document.rb +++ b/app/models/legal_document.rb @@ -6,7 +6,7 @@ class LegalDocument < ActiveRecord::Base if ENV['legal_document_types'].present? TYPES = ENV['legal_document_types'].split(',').map(&:strip) else - TYPES = %w(pdf asice bdoc ddoc zip rar gz tar 7z odt doc docx).freeze + TYPES = %w(pdf asice sce bdoc ddoc zip rar gz tar 7z odt doc docx).freeze end attr_accessor :body diff --git a/config/application-example.yml b/config/application-example.yml index c89730699..e1c8976ad 100644 --- a/config/application-example.yml +++ b/config/application-example.yml @@ -67,8 +67,8 @@ contact_org_enabled: 'false' # iptables_server_ip: '127.0.0.1' # Custom legal document types. Changing this requires updating EPP extension schema for allowed legalDocEnumType values. -# System default for legal document types is: pdf,asice,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx -# legal_document_types: "pdf,asice,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx" +# System default for legal document types is: pdf,asice,sce,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx +# legal_document_types: "pdf,asice,sce,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx" # diff --git a/doc/epp/contact.md b/doc/epp/contact.md index 1dcd9b6d2..830a6245d 100644 --- a/doc/epp/contact.md +++ b/doc/epp/contact.md @@ -44,7 +44,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode Attribute: "cc" "EE" # Country code in ISO_3166-1 aplha 2 0-1 Base64 encoded document - Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-create-command-successfully-creates-a-contact) @@ -81,7 +81,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode Attribute: "cc" "EE" # Country code in ISO_3166-1 aplha 2 0-1 Base64 encoded document. - Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id @@ -99,7 +99,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Base64 encoded document. - Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-delete-command-deletes-contact) diff --git a/doc/epp/domain.md b/doc/epp/domain.md index fa74b004c..38a4745a0 100644 --- a/doc/epp/domain.md +++ b/doc/epp/domain.md @@ -39,7 +39,7 @@ Domain name mapping protocol short version: 1 Public key 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 1 Base64 encoded document. - Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 0-1 Required if registering a reserved domain 0-1 Client transaction id @@ -91,7 +91,7 @@ Domain name mapping protocol short version: 1 Public key 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Base64 encoded document. Required if registrant is changing. - Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-updates-domain-and-adds-objects) @@ -107,7 +107,7 @@ Domain name mapping protocol short version: 1 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 1 Base64 encoded document. - Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-deletes-domain) @@ -141,7 +141,7 @@ Domain name mapping protocol short version: 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Base64 encoded document. - Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-renews-a-domain) @@ -158,7 +158,7 @@ Domain name mapping protocol short version: 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Base64 encoded document. - Attribute: type="pdf/asice/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-transfers-a-domain) diff --git a/lib/schemas/eis-1.0.xsd b/lib/schemas/eis-1.0.xsd index efc9b466f..55758ddbf 100644 --- a/lib/schemas/eis-1.0.xsd +++ b/lib/schemas/eis-1.0.xsd @@ -64,6 +64,7 @@ + From a96284cb57211adf6db27c00e9eeee884bfc3065 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Mon, 7 May 2018 10:27:35 +0300 Subject: [PATCH 25/31] Add other documents formats, such as adoc and asics --- app/models/legal_document.rb | 3 ++- config/application-example.yml | 4 ++-- doc/epp/contact.md | 6 +++--- doc/epp/domain.md | 10 +++++----- lib/schemas/eis-1.0.xsd | 4 ++++ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/models/legal_document.rb b/app/models/legal_document.rb index df7bf881b..4d75d272d 100644 --- a/app/models/legal_document.rb +++ b/app/models/legal_document.rb @@ -6,7 +6,8 @@ class LegalDocument < ActiveRecord::Base if ENV['legal_document_types'].present? TYPES = ENV['legal_document_types'].split(',').map(&:strip) else - TYPES = %w(pdf asice sce bdoc ddoc zip rar gz tar 7z odt doc docx).freeze + TYPES = %w(pdf asice asics sce scs adoc edoc bdoc ddoc zip rar gz tar 7z odt + doc docx).freeze end attr_accessor :body diff --git a/config/application-example.yml b/config/application-example.yml index e1c8976ad..bf846f23b 100644 --- a/config/application-example.yml +++ b/config/application-example.yml @@ -67,8 +67,8 @@ contact_org_enabled: 'false' # iptables_server_ip: '127.0.0.1' # Custom legal document types. Changing this requires updating EPP extension schema for allowed legalDocEnumType values. -# System default for legal document types is: pdf,asice,sce,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx -# legal_document_types: "pdf,asice,sce,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx" +# System default for legal document types is: pdf,asice,sce,asics,scs,adoc,edoc,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx +# legal_document_types: "pdf,asice,sce,asics,scs,adoc,edoc,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx" # diff --git a/doc/epp/contact.md b/doc/epp/contact.md index 830a6245d..633e16cff 100644 --- a/doc/epp/contact.md +++ b/doc/epp/contact.md @@ -44,7 +44,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode Attribute: "cc" "EE" # Country code in ISO_3166-1 aplha 2 0-1 Base64 encoded document - Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-create-command-successfully-creates-a-contact) @@ -81,7 +81,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode Attribute: "cc" "EE" # Country code in ISO_3166-1 aplha 2 0-1 Base64 encoded document. - Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id @@ -99,7 +99,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Base64 encoded document. - Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-delete-command-deletes-contact) diff --git a/doc/epp/domain.md b/doc/epp/domain.md index 38a4745a0..2e51be124 100644 --- a/doc/epp/domain.md +++ b/doc/epp/domain.md @@ -39,7 +39,7 @@ Domain name mapping protocol short version: 1 Public key 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 1 Base64 encoded document. - Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 0-1 Required if registering a reserved domain 0-1 Client transaction id @@ -91,7 +91,7 @@ Domain name mapping protocol short version: 1 Public key 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Base64 encoded document. Required if registrant is changing. - Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-updates-domain-and-adds-objects) @@ -107,7 +107,7 @@ Domain name mapping protocol short version: 1 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 1 Base64 encoded document. - Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-deletes-domain) @@ -141,7 +141,7 @@ Domain name mapping protocol short version: 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Base64 encoded document. - Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-renews-a-domain) @@ -158,7 +158,7 @@ Domain name mapping protocol short version: 0-1 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Base64 encoded document. - Attribute: type="pdf/asice/sce/bdoc/ddoc/zip/rar/gz/tar/7z" + Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z" 0-1 Client transaction id [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-transfers-a-domain) diff --git a/lib/schemas/eis-1.0.xsd b/lib/schemas/eis-1.0.xsd index 55758ddbf..ddb3602c0 100644 --- a/lib/schemas/eis-1.0.xsd +++ b/lib/schemas/eis-1.0.xsd @@ -64,8 +64,12 @@ + + + + From b75ee89520af15ea28cc4529b8f79d38a42a564a Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Tue, 8 May 2018 09:15:49 +0300 Subject: [PATCH 26/31] Fix Ruby version from 2.3.6 to 2.3.7, as it is currently used --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index e75da3e63..00355e29d 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.6 +2.3.7 From a2e8ac7937506d8b91b7e4d3bf5a7ac048fa2d0d Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Wed, 9 May 2018 11:01:22 +0300 Subject: [PATCH 27/31] Update Devise to latest version Prerequsite for Ruby upgrade to 2.5. Also enables future upgrade to Rails 5 or above. --- Gemfile | 2 +- Gemfile.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 54210f794..0af80fddf 100644 --- a/Gemfile +++ b/Gemfile @@ -52,7 +52,7 @@ gem 'liquid', '3.0.6' # for email templates # rights gem 'cancancan', '1.11.0' # autharization -gem 'devise', '3.5.4' # authenitcation +gem 'devise', '4.4.3' # authenitcation # rest api gem 'grape', '0.12.0' diff --git a/Gemfile.lock b/Gemfile.lock index 03193e703..b12b28a2d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -167,12 +167,11 @@ GEM database_cleaner (1.6.1) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (3.5.4) + devise (4.4.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) + railties (>= 4.1.0, < 6.0) responders - thread_safe (~> 0.1) warden (~> 1.2.3) diff-lcs (1.3) docile (1.1.5) @@ -350,8 +349,9 @@ GEM polyamorous (~> 1.1) rdoc (4.3.0) request_store (1.1.0) - responders (2.3.0) - railties (>= 4.2.0, < 5.1) + responders (2.4.0) + actionpack (>= 4.2.0, < 5.3) + railties (>= 4.2.0, < 5.3) rest-client (2.0.1) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) @@ -491,7 +491,7 @@ DEPENDENCIES daemons-rails (= 1.2.1) data_migrate! database_cleaner - devise (= 3.5.4) + devise (= 4.4.3) digidoc_client! epp (= 1.5.0)! epp-xml (= 1.1.0)! From 49f894f852842c6c93d718fa2a73dc647bb6789f Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Mon, 14 May 2018 11:02:56 +0300 Subject: [PATCH 28/31] Add extra logging to Directo request and responses --- app/models/directo.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/models/directo.rb b/app/models/directo.rb index 9352c9356..3e4e93e2c 100644 --- a/app/models/directo.rb +++ b/app/models/directo.rb @@ -45,8 +45,10 @@ class Directo < ActiveRecord::Base end data = builder.to_xml.gsub("\n",'') - response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s - dump_result_to_db(mappers, response) + Rails.logger.info("[Directo] XML request: #{data}") + response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false) + Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}") + dump_result_to_db(mappers, response.to_s) end STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n" @@ -165,11 +167,15 @@ class Directo < ActiveRecord::Base end data = builder.to_xml.gsub("\n",'') + Rails.logger.info("[Directo] XML request: #{data}") if debug STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n" else - response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s + response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false) + Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}") + response = response.to_s + Setting.directo_monthly_number_last = directo_next Nokogiri::XML(response).css("Result").each do |res| Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next) @@ -190,4 +196,3 @@ class Directo < ActiveRecord::Base @pricelists[account_activity.price_id] = account_activity.price end end - From 1a3ed7774cc86f87afea9ebd468ef21064344d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Fri, 25 May 2018 00:03:38 +0300 Subject: [PATCH 29/31] Changelog update 180525 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 334422623..8fe8f891a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +25.05.2018 +* GDPR: updated whois templates with configurable disclaimer [#795](https://github.com/internetee/registry/issues/795) +* GDPR: email forwarding solution to contact private domain registrants without revealing their email addresses [#824](https://github.com/internetee/registry/issues/824) +* EPP: added support for additional digitally signed doc formats like asice, sce, asics, scs, edoc, adoc [#840](https://github.com/internetee/registry/issues/840) +* Registrar: removed handling of newlines from contact form street field [#836](https://github.com/internetee/registry/issues/836) +* Ruby upgrade to version 2.3.7 [#546](https://github.com/internetee/registry/issues/546) +* Devise upgrade to version 4.4.3 [#847](https://github.com/internetee/registry/pull/847) +* Added extra logging to debug Directo integration [#848](https://github.com/internetee/registry/pull/848) + 30.04.2018 * Upgrade Ruby on Rails to version 4.2.10 [#826](https://github.com/internetee/registry/issues/826) * BUG: Admin - fixed internal error in domain_versions and contact_versions views caused by removed db column [#830](https://github.com/internetee/registry/issues/830) From f1808cfcf1cab4705b87e1ca7b60d12c7880f352 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Fri, 25 May 2018 13:55:21 +0300 Subject: [PATCH 30/31] Remove link to WHOIS controller from registrant portal --- app/views/layouts/registrant/application.haml | 54 ------------ .../layouts/registrant/application.html.erb | 84 +++++++++++++++++++ test/integration/registrant/layout_test.rb | 17 ++++ 3 files changed, 101 insertions(+), 54 deletions(-) delete mode 100644 app/views/layouts/registrant/application.haml create mode 100644 app/views/layouts/registrant/application.html.erb create mode 100644 test/integration/registrant/layout_test.rb diff --git a/app/views/layouts/registrant/application.haml b/app/views/layouts/registrant/application.haml deleted file mode 100644 index 12d161c94..000000000 --- a/app/views/layouts/registrant/application.haml +++ /dev/null @@ -1,54 +0,0 @@ -!!! 5 -%html{lang: I18n.locale.to_s} - %head - %meta{charset: "utf-8"}/ - %meta{content: "width=device-width, initial-scale=1", name: "viewport"}/ - - if content_for? :head_title - = yield :head_title - - else - %title= t(:registrant_head_title) - = csrf_meta_tags - = stylesheet_link_tag 'registrant-manifest', media: 'all' - = favicon_link_tag 'favicon.ico' - %body - / Fixed navbar - %nav.navbar.navbar-default.navbar-fixed-top - .container - .navbar-header - %button.navbar-toggle.collapsed{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"} - %span.sr-only Toggle navigation - %span.icon-bar - %span.icon-bar - %span.icon-bar - = link_to registrant_root_path, class: 'navbar-brand' do - = t(:registrant_head_title) - - if unstable_env.present? - .text-center - %small{style: 'color: #0074B3;'}= unstable_env - - if current_user - .navbar-collapse.collapse - %ul.nav.navbar-nav.public-nav - - if can? :view, Depp::Domain - - active_class = %w(registrant/domains registrant/check registrant/renew registrant/tranfer registrant/keyrelays).include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:domains), registrant_domains_path - - - active_class = %w(registrant/whois).include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:whois), registrant_whois_path - - %ul.nav.navbar-nav.navbar-right - - if user_signed_in? - %li= link_to t(:log_out, user: current_user), '/registrant/logout' - - .container - = render 'shared/flash' - = yield - - %footer.footer - .container - .row - .col-md-6 - = image_tag 'eis-logo-et.png' - .col-md-6.text-right - Version - = CURRENT_COMMIT_HASH - = javascript_include_tag 'registrant-manifest', async: true diff --git a/app/views/layouts/registrant/application.html.erb b/app/views/layouts/registrant/application.html.erb new file mode 100644 index 000000000..da081b05a --- /dev/null +++ b/app/views/layouts/registrant/application.html.erb @@ -0,0 +1,84 @@ + + + + + + <% if content_for? :head_title %> + <%= yield :head_title %> + <% else %> + + <%= t(:registrant_head_title) %> + + <% end %> + <%= csrf_meta_tags %> + <%= stylesheet_link_tag 'registrant-manifest', media: 'all' %> + <%= favicon_link_tag 'favicon.ico' %> + + + + +
+ <%= render 'shared/flash' %> + <%= yield %> +
+
+
+
+
+ <%= image_tag 'eis-logo-et.png' %> +
+
+ Version + <%= CURRENT_COMMIT_HASH %> +
+
+
+
+ <%= javascript_include_tag 'registrant-manifest', async: true %> + + diff --git a/test/integration/registrant/layout_test.rb b/test/integration/registrant/layout_test.rb new file mode 100644 index 000000000..99b447ae9 --- /dev/null +++ b/test/integration/registrant/layout_test.rb @@ -0,0 +1,17 @@ +require 'test_helper' + +class RegistrantLayoutTest < ActionDispatch::IntegrationTest + def setup + super + login_as(users(:registrant)) + + Setting.days_to_keep_business_registry_cache = 1 + travel_to Time.zone.parse('2010-07-05') + end + + def test_has_link_to_rest_whois + visit registrant_domains_url + assert(has_link?('Internet.ee', href: 'https://internet.ee')) + refute(has_link?('WHOIS', href: registrant_whois_path)) + end +end From b32809cdacfdd7b8afaa6ca4d989f81d85e8edc2 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Fri, 25 May 2018 13:58:13 +0300 Subject: [PATCH 31/31] Deprecate Registrant::WhoisController --- app/controllers/registrant/whois_controller.rb | 2 ++ config/routes.rb | 1 - test/integration/registrant/layout_test.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/registrant/whois_controller.rb b/app/controllers/registrant/whois_controller.rb index b44a0bb67..2936477eb 100644 --- a/app/controllers/registrant/whois_controller.rb +++ b/app/controllers/registrant/whois_controller.rb @@ -1,3 +1,5 @@ +# As non-GDPR compliant, this controller is deprecated. Needs to be replaced with one that relies +# on the REST WHOIS API. class Registrant::WhoisController < RegistrantController def index authorize! :view, :registrant_whois diff --git a/config/routes.rb b/config/routes.rb index 9caeef4a2..5ef26a195 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -144,7 +144,6 @@ Rails.application.routes.draw do end resources :contacts - resources :whois end diff --git a/test/integration/registrant/layout_test.rb b/test/integration/registrant/layout_test.rb index 99b447ae9..82b8026b7 100644 --- a/test/integration/registrant/layout_test.rb +++ b/test/integration/registrant/layout_test.rb @@ -12,6 +12,6 @@ class RegistrantLayoutTest < ActionDispatch::IntegrationTest def test_has_link_to_rest_whois visit registrant_domains_url assert(has_link?('Internet.ee', href: 'https://internet.ee')) - refute(has_link?('WHOIS', href: registrant_whois_path)) + refute(has_link?('WHOIS', href: 'registrant/whois')) end end