From 10b7ce3eea586abd6bb132e8dac14110e47571ad Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 20 Apr 2016 16:04:29 +0300 Subject: [PATCH 01/39] Story#117612931 - contact touch is not regenerating all whoises once and once again --- app/models/contact.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/contact.rb b/app/models/contact.rb index 090e64866..3cc42419f 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -551,6 +551,9 @@ class Contact < ActiveRecord::Base end def update_related_whois_records + # not doing anything if no real changes + return if changes.slice(*(self.class.column_names - ["updated_at", "created_at", "statuses", "status_notes"])).empty? + names = related_domain_descriptions.keys UpdateWhoisRecordJob.enqueue(names, :domain) if names.present? end From 096c23f55e9a7ef292282d2703501b90336ff679 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Apr 2016 15:09:51 +0300 Subject: [PATCH 02/39] 117806281-clickable_actions --- app/models/concerns/versions.rb | 7 +++++++ app/views/admin/domains/partials/_version.haml | 14 +++++++++++++- app/views/admin/domains/versions.haml | 6 +++--- config/locales/en.yml | 1 + 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/app/models/concerns/versions.rb b/app/models/concerns/versions.rb index 49c4298f2..d15bd297e 100644 --- a/app/models/concerns/versions.rb +++ b/app/models/concerns/versions.rb @@ -47,6 +47,13 @@ module Versions user end + def get_request_by_uuid(uuid) + return unless uuid + ApiLog::EppLog.find_by(uuid: uuid).request + end + + + # callbacks def touch_domain_version domain.try(:touch_with_version) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 7cd9a497e..4f87efe0e 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -29,7 +29,10 @@ %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) %p.text-right - = event + - if (event == 'update' || event = 'create') && version + = link_to event, '#', class: 'js-event' + - else + = event %br = creator - if version @@ -115,6 +118,15 @@ = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do = domain.registrar.name + - if (event == 'create' || event == 'update') && version + %tr.js-event{ style: 'display: none;' } + %td{colspan: 8} + %pre + - if version.uuid + = Nokogiri::XML(Epp::ApiLog::EppLog.find_by(uuid: uuid).request) + - else + = t(:cant_match_version) + - if domain.pending_json.present? %tr.js-pending{ style: 'display: none;' } %td{colspan: 8} diff --git a/app/views/admin/domains/versions.haml b/app/views/admin/domains/versions.haml index b803808aa..df5085e9b 100644 --- a/app/views/admin/domains/versions.haml +++ b/app/views/admin/domains/versions.haml @@ -37,9 +37,9 @@ domain: version.reify, version: version.previous :coffee - $(document).on 'click', '.js-pending-toggle', (e) -> + $(document).on 'click', '.js-pending-toggle, .js-event', (e) -> e.preventDefault() - $(document).on 'mousedown', '.js-pending-toggle', (e) -> + $(document).on 'mousedown', '.js-pending-toggle, .js-event', (e) -> target = $(e.target) - target.parents('tr').next('tr.js-pending').toggle() + target.parents('tr').next('tr.js-pending, tr.js-event').toggle() diff --git a/config/locales/en.yml b/config/locales/en.yml index faa4c4595..c4bc211c1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -941,3 +941,4 @@ en: add_blocked_domain: 'Add domain to blocked list' edit_pw: 'Edit Pw' optional: 'Optional' + cant_match_version: 'Impossible match version with request' From d66e5e3c96ccba60af73b103310e4e82ae84ebbd Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Apr 2016 15:18:06 +0300 Subject: [PATCH 03/39] '117806281-method_delete --- app/models/concerns/versions.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/models/concerns/versions.rb b/app/models/concerns/versions.rb index d15bd297e..49c4298f2 100644 --- a/app/models/concerns/versions.rb +++ b/app/models/concerns/versions.rb @@ -47,13 +47,6 @@ module Versions user end - def get_request_by_uuid(uuid) - return unless uuid - ApiLog::EppLog.find_by(uuid: uuid).request - end - - - # callbacks def touch_domain_version domain.try(:touch_with_version) From e3f37081087c7a621b2893201592a66dd7c10b16 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Apr 2016 15:33:17 +0300 Subject: [PATCH 04/39] 117806281-typo --- app/views/admin/domains/partials/_version.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 4f87efe0e..74147b84f 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -123,7 +123,7 @@ %td{colspan: 8} %pre - if version.uuid - = Nokogiri::XML(Epp::ApiLog::EppLog.find_by(uuid: uuid).request) + = Nokogiri::XML(ApiLog::EppLog.find_by(uuid: version.uuid).request) - else = t(:cant_match_version) From 20b831af812dc291bc2da7357a2b55149ca48916 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 10 May 2016 17:24:40 +0300 Subject: [PATCH 05/39] 117806281-request_condition --- app/views/admin/domains/partials/_version.haml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 74147b84f..14f40309d 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -123,7 +123,11 @@ %td{colspan: 8} %pre - if version.uuid - = Nokogiri::XML(ApiLog::EppLog.find_by(uuid: version.uuid).request) + - req = ApiLog::EppLog.find_by(uuid: version.uuid).try(:request) + - if req + = Nokogiri::XML(req) + - else + = t(:cant_match_version) - else = t(:cant_match_version) From 32620692cc85aa229e1e703436ac091f41e9e7c0 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 16 May 2016 11:34:55 +0300 Subject: [PATCH 06/39] 117806281-usability_changes --- app/views/admin/domains/partials/_version.haml | 10 +++++----- app/views/admin/domains/versions.haml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 14f40309d..16f8a300e 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -29,7 +29,7 @@ %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) %p.text-right - - if (event == 'update' || event = 'create') && version + - if (event == 'update' || event = 'create') && (version && version.uuid) = link_to event, '#', class: 'js-event' - else = event @@ -52,7 +52,7 @@ %br - if domain.pending_json.present? %p - = link_to t(:pending_epp), '#', class: 'js-pending-toggle' + = link_to t(:pending_epp), '#', class: 'js-pending' %td{class: changing_css_class(version, "period", "period_unit", "valid_from", "valid_to")} %p @@ -118,9 +118,9 @@ = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do = domain.registrar.name - - if (event == 'create' || event == 'update') && version + - if (event == 'create' || event == 'update') && (version && version.uuid) %tr.js-event{ style: 'display: none;' } - %td{colspan: 8} + %td{colspan: 9} %pre - if version.uuid - req = ApiLog::EppLog.find_by(uuid: version.uuid).try(:request) @@ -133,7 +133,7 @@ - if domain.pending_json.present? %tr.js-pending{ style: 'display: none;' } - %td{colspan: 8} + %td{colspan: 9} = preserve do %pre - formatted_req = Nokogiri::XML(domain.pending_json['frame']) diff --git a/app/views/admin/domains/versions.haml b/app/views/admin/domains/versions.haml index df5085e9b..cfef69872 100644 --- a/app/views/admin/domains/versions.haml +++ b/app/views/admin/domains/versions.haml @@ -37,9 +37,9 @@ domain: version.reify, version: version.previous :coffee - $(document).on 'click', '.js-pending-toggle, .js-event', (e) -> + $(document).on 'click', '.js-pending, .js-event', (e) -> e.preventDefault() - $(document).on 'mousedown', '.js-pending-toggle, .js-event', (e) -> + $(document).on 'mousedown', '.js-pending, .js-event', (e) -> target = $(e.target) - target.parents('tr').next('tr.js-pending, tr.js-event').toggle() + target.parents('tr').nextUntil('tr.small' ,'tr.' + this.className).toggle() From a51f536781f58df0e53a057951752f0bb0429704 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 20 May 2016 15:32:06 +0300 Subject: [PATCH 07/39] Story#118912395 - rearrange before_action for more readability --- app/controllers/epp_controller.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index de1002604..57a5f34d4 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -6,8 +6,14 @@ class EppController < ApplicationController before_action :generate_svtrid before_action :latin_only - before_action :validate_against_schema + before_action :validate_request + before_action :update_epp_session + + around_action :catch_epp_errors + + helper_method :current_user + def validate_against_schema return if ['hello', 'error', 'keyrelay'].include?(params[:action]) schema.validate(params[:nokogiri_frame]).each do |error| @@ -20,10 +26,7 @@ class EppController < ApplicationController handle_errors and return if epp_errors.any? end - before_action :validate_request - before_action :update_epp_session - around_action :catch_epp_errors def catch_epp_errors err = catch(:epp_error) do yield @@ -34,7 +37,6 @@ class EppController < ApplicationController handle_errors end - helper_method :current_user rescue_from StandardError do |e| @errors ||= [] From 714dd1473d58e4ba0239603d9e9ad0428a08b194 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 20 May 2016 16:37:38 +0300 Subject: [PATCH 08/39] Story#118912395 - EppLog saves resource --- app/controllers/epp/keyrelays_controller.rb | 4 ++++ app/controllers/epp/polls_controller.rb | 4 ++++ app/controllers/epp/sessions_controller.rb | 5 +++++ app/controllers/epp_controller.rb | 8 +++++++- config/routes.rb | 2 +- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/controllers/epp/keyrelays_controller.rb b/app/controllers/epp/keyrelays_controller.rb index d6515758f..81ff3dd32 100644 --- a/app/controllers/epp/keyrelays_controller.rb +++ b/app/controllers/epp/keyrelays_controller.rb @@ -56,4 +56,8 @@ class Epp::KeyrelaysController < EppController # domain end + + def resource + @domain + end end diff --git a/app/controllers/epp/polls_controller.rb b/app/controllers/epp/polls_controller.rb index 531509a6c..fb032975f 100644 --- a/app/controllers/epp/polls_controller.rb +++ b/app/controllers/epp/polls_controller.rb @@ -54,4 +54,8 @@ class Epp::PollsController < EppController def validate_poll requires_attribute 'poll', 'op', values: %(ack req), allow_blank: true end + + def resource + @message + end end diff --git a/app/controllers/epp/sessions_controller.rb b/app/controllers/epp/sessions_controller.rb index c217d38aa..58a314410 100644 --- a/app/controllers/epp/sessions_controller.rb +++ b/app/controllers/epp/sessions_controller.rb @@ -137,4 +137,9 @@ class Epp::SessionsController < EppController pw = params[:parsed_frame].css('pw').first.text { username: user, password: pw } end + + private + def resource + @api_user + end end diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index 57a5f34d4..e7d3f0ac1 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -13,6 +13,7 @@ class EppController < ApplicationController around_action :catch_epp_errors helper_method :current_user + helper_method :resource def validate_against_schema return if ['hello', 'error', 'keyrelay'].include?(params[:action]) @@ -369,7 +370,7 @@ class EppController < ApplicationController request: trimmed_request, request_command: request_command, request_successful: epp_errors.empty?, - request_object: params[:epp_object_type], + request_object: resource ? "#{params[:epp_object_type]}: #{resource.class} - #{resource.id} - #{resource.name}" : params[:epp_object_type], response: @response, api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public', api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s), @@ -385,4 +386,9 @@ class EppController < ApplicationController return if current_user.blank? counter_update(current_user.registrar_code, ENV['iptables_server_ip']) end + + def resource + name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize + instance_variable_get("@#{name}") + end end diff --git a/config/routes.rb b/config/routes.rb index a041e41b7..39d6b3937 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,7 @@ Rails.application.routes.draw do post 'command/:action', controller: 'domains', constraints: EppConstraint.new(:domain) post 'command/:action', controller: 'contacts', constraints: EppConstraint.new(:contact) - post 'command/poll', to: 'polls#poll', constraints: EppConstraint.new(:poll) + post 'command/poll', to: 'polls#poll', constraints: EppConstraint.new(:poll) post 'command/keyrelay', to: 'keyrelays#keyrelay', constraints: EppConstraint.new(:keyrelay) post 'command/:command', to: 'errors#not_found', constraints: EppConstraint.new(:not_found) # fallback route From af9fc5b4fa68819755a13ac1676159b2864d9ae1 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 20 May 2016 16:58:39 +0300 Subject: [PATCH 09/39] Story#118912395 - add method name to objects which are assigned to EPP logger --- app/models/api_user.rb | 4 ++++ app/models/message.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/models/api_user.rb b/app/models/api_user.rb index 260441620..5d6e3afb7 100644 --- a/app/models/api_user.rb +++ b/app/models/api_user.rb @@ -62,6 +62,10 @@ class ApiUser < User username end + def name + username + end + def queued_messages registrar.messages.queued end diff --git a/app/models/message.rb b/app/models/message.rb index 174edc8ef..10d823e63 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -12,4 +12,8 @@ class Message < ActiveRecord::Base self.queued = false save end + + def name + "-" + end end From 80a5c9d054feb1a5332bb56614b9e10f7ff68746 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 24 May 2016 14:00:43 +0300 Subject: [PATCH 10/39] 117806281-typo --- app/views/admin/domains/partials/_version.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 16f8a300e..74382f63a 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -29,7 +29,7 @@ %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) %p.text-right - - if (event == 'update' || event = 'create') && (version && version.uuid) + - if (event == 'update' || event == 'create') && (version && version.uuid) = link_to event, '#', class: 'js-event' - else = event From f2c96ba1458715b93dfcb80e1a474cd63d8f3ca6 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 09:30:48 +0300 Subject: [PATCH 11/39] Story#116761157 - contact statuses are generated value --- app/models/contact.rb | 68 ++++++++-------------------------------- app/models/epp/domain.rb | 21 ++----------- 2 files changed, 15 insertions(+), 74 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 12afbe777..29fcf6cd5 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -62,16 +62,6 @@ class Contact < ActiveRecord::Base end end - before_save :manage_statuses - def manage_statuses - if domain_transfer # very ugly but need better workflow - self.statuses = statuses | [OK, LINKED] - return - end - - manage_linked - manage_ok - end after_save :update_related_whois_records @@ -174,7 +164,7 @@ class Contact < ActiveRecord::Base end def find_orphans - Contact.where(' + where(' NOT EXISTS( select 1 from domains d where d.registrant_id = contacts.id ) AND NOT EXISTS( @@ -237,6 +227,18 @@ class Contact < ActiveRecord::Base "EIS-#{id}" end + # kind of decorator in order to always return statuses + # if we use separate decorator, then we should add it + # to too many places + def statuses + calculated = Array(read_attribute(:statuses)) + calculated.delete(Contact::LINKED) + calculated << Contact::OK + calculated << Contact::LINKED if domains_present? + + calculated.uniq + end + def to_s name || '[no name]' end @@ -406,13 +408,6 @@ class Contact < ActiveRecord::Base domain_contacts.present? || registrant_domains.present? end - def manage_linked - if domains_present? - set_linked - else - unset_linked - end - end def search_name "#{code} #{name}" @@ -491,43 +486,6 @@ class Contact < ActiveRecord::Base end end - def set_linked - statuses << LINKED if statuses.detect { |s| s == LINKED }.blank? - end - - def unset_linked - statuses.delete_if { |s| s == LINKED } - end - - # rubocop:disable Metrics/CyclomaticComplexity - def manage_ok - return unset_ok unless valid? - - case statuses.size - when 0 - set_ok - when 1 - set_ok if statuses == [LINKED] - when 2 - return if statuses.sort == [LINKED, OK] - unset_ok - else - unset_ok - end - end - # rubocop:enable Metrics/CyclomaticComplexity - - def unset_ok - statuses.delete_if { |s| s == OK } - end - - def set_ok - statuses << OK if statuses.detect { |s| s == OK }.blank? - end - - def linked? - statuses.include?(LINKED) - end def update_prohibited? (statuses & [ diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index c5e298cff..c6d5d2d7e 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -39,29 +39,12 @@ class Epp::Domain < Domain before_save :link_contacts def link_contacts - # Based on bullet report - if new_record? - # new record does not have correct instance contacts entries thanks to epp - unlinked_contacts = [registrant] - unlinked_contacts << admin_domain_contacts.map(&:contact) - unlinked_contacts << tech_domain_contacts.map(&:contact) - unlinked_contacts.flatten! - else - unlinked_contacts = contacts.select { |c| !c.linked? } # speed up a bit - end - - unlinked_contacts.each do |uc| - uc.domains_present = true # no need to fetch domains again - uc.save(validate: false) - end + #TODO: cleanup cache if we think to cache dynamic statuses end after_destroy :unlink_contacts def unlink_contacts - contacts.each do |c| - c.domains_present = false - c.save(validate: false) - end + #TODO: cleanup cache if we think to cache dynamic statuses end class << self From 79f2c09d69468e2b9c40be93a938df6ffca8b2d2 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 27 May 2016 14:02:08 +0300 Subject: [PATCH 12/39] 117806281-logic_change --- app/views/admin/domains/partials/_version.haml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 74382f63a..1f50cbc17 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -5,6 +5,7 @@ - if domain.present? - if version # normal history + - epp_req = ApiLog::EppLog.find_by(uuid: version.uuid).try(:request) if version.uuid - children = HashWithIndifferentAccess.new(version.children) - nameservers = Nameserver.all_versions_for(children[:nameservers], version.created_at) - dnskeys = Dnskey.all_versions_for(children[:dnskeys], version.created_at) @@ -14,6 +15,7 @@ - event = version.event - creator = plain_username(version.terminator) - else # pending history + - epp_req = false - nameservers = domain.nameservers - dnskeys = domain.dnskeys - tech_contacts = domain.tech_contacts @@ -29,7 +31,7 @@ %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) %p.text-right - - if (event == 'update' || event == 'create') && (version && version.uuid) + - if (event == 'update' || event == 'create') && epp_req = link_to event, '#', class: 'js-event' - else = event @@ -118,16 +120,12 @@ = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do = domain.registrar.name - - if (event == 'create' || event == 'update') && (version && version.uuid) + - if (event == 'create' || event == 'update') && epp_req %tr.js-event{ style: 'display: none;' } %td{colspan: 9} %pre - - if version.uuid - - req = ApiLog::EppLog.find_by(uuid: version.uuid).try(:request) - - if req - = Nokogiri::XML(req) - - else - = t(:cant_match_version) + - if req + = Nokogiri::XML(req) - else = t(:cant_match_version) From a7be49203c0f490eb59ff1f5cdc14c838353f778 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 14:18:45 +0300 Subject: [PATCH 13/39] Story#116761157 - update logic of destroy_orphans to include 6 months delay --- app/api/repp/domain_v1.rb | 2 +- app/models/contact.rb | 26 ++++++++++++------- ...7110738_change_contact_statuses_default.rb | 5 ++++ 3 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 db/migrate/20160527110738_change_contact_statuses_default.rb diff --git a/app/api/repp/domain_v1.rb b/app/api/repp/domain_v1.rb index 9275e611f..cd0f01bdf 100644 --- a/app/api/repp/domain_v1.rb +++ b/app/api/repp/domain_v1.rb @@ -35,7 +35,7 @@ module Repp error! I18n.t('errors.messages.epp_authorization_error'), 401 unless domain.auth_info.eql? request.headers['Auth-Code'] contact_repp_json = proc{|contact| - contact.attributes.slice("code", "name", "ident", "ident_type", "ident_country_code", "phone", "email", "street", "city", "zip","country_code", "statuses") + contact.as_json.slice("code", "name", "ident", "ident_type", "ident_country_code", "phone", "email", "street", "city", "zip","country_code", "statuses") } @response = { diff --git a/app/models/contact.rb b/app/models/contact.rb index 29fcf6cd5..d8c15d662 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -39,7 +39,6 @@ class Contact < ActiveRecord::Base validate :val_country_code after_initialize do - self.statuses = [] if statuses.nil? self.status_notes = {} if status_notes.nil? self.ident_updated_at = Time.zone.now if new_record? && ident_updated_at.blank? end @@ -173,20 +172,29 @@ class Contact < ActiveRecord::Base ') end + # To leave only new ones we need to check + # if contact was at any time used in domain. + # This can be checked by domain history. + # This can be checked by saved relations in children attribute def destroy_orphans STDOUT << "#{Time.zone.now.utc} - Destroying orphaned contacts\n" unless Rails.env.test? - orphans = find_orphans - - unless Rails.env.test? - orphans.each do |m| - STDOUT << "#{Time.zone.now.utc} Contact.destroy_orphans: ##{m.id} (#{m.name})\n" + counter = Counter.new + find_orphans.find_each do |contact| + ver_scope = [] + %w(admin_contacts tech_contacts registrant).each do |type| + ver_scope << "(children->'#{type}')::jsonb <@ json_build_array(#{contact.id})::jsonb" end + next if DomainVersion.where("created_at > ?", Time.now - 6.months).where(ver_scope.join(" OR ")).any? + next if contact.domains_present? + + # contact.destroy + counter.next + STDOUT << "#{Time.zone.now.utc} Contact.destroy_orphans: ##{contact.id} (#{contact.name})\n" + p "#{Time.zone.now.utc} Contact.destroy_orphans: ##{contact.id} (#{contact.name})\n" end - count = orphans.destroy_all.count - - STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{count} orphaned contacts\n" unless Rails.env.test? + STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{counter} orphaned contacts\n" unless Rails.env.test? end def privs diff --git a/db/migrate/20160527110738_change_contact_statuses_default.rb b/db/migrate/20160527110738_change_contact_statuses_default.rb new file mode 100644 index 000000000..5d59eaac9 --- /dev/null +++ b/db/migrate/20160527110738_change_contact_statuses_default.rb @@ -0,0 +1,5 @@ +class ChangeContactStatusesDefault < ActiveRecord::Migration + def change + change_column_default :contacts, :statuses, [] + end +end From 35a67ce439e314c06204f1516deb2b71a975c2d1 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 14:20:41 +0300 Subject: [PATCH 14/39] Story#120259603 - git uses right branch last commit message --- app/models/contact.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index d8c15d662..7fc42ee82 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -188,10 +188,9 @@ class Contact < ActiveRecord::Base next if DomainVersion.where("created_at > ?", Time.now - 6.months).where(ver_scope.join(" OR ")).any? next if contact.domains_present? - # contact.destroy + contact.destroy counter.next STDOUT << "#{Time.zone.now.utc} Contact.destroy_orphans: ##{contact.id} (#{contact.name})\n" - p "#{Time.zone.now.utc} Contact.destroy_orphans: ##{contact.id} (#{contact.name})\n" end STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{counter} orphaned contacts\n" unless Rails.env.test? From 01234e3c55dc5a74f9a395d05bf381dbf88f9f75 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 14:31:16 +0300 Subject: [PATCH 15/39] Story#116761157 - move variable when to delete orphans to settings --- app/controllers/admin/settings_controller.rb | 1 + app/models/contact.rb | 2 +- app/views/admin/settings/index.haml | 1 + config/initializers/initial_settings.rb | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index cc49b3b61..68e8b7788 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -51,6 +51,7 @@ class Admin::SettingsController < AdminController :admin_contacts_max_count, :tech_contacts_min_count, :tech_contacts_max_count, + :orphans_contacts_in_months, :ds_digest_type, :dnskeys_min_count, :dnskeys_max_count, diff --git a/app/models/contact.rb b/app/models/contact.rb index 7fc42ee82..96b3eae26 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -185,7 +185,7 @@ class Contact < ActiveRecord::Base %w(admin_contacts tech_contacts registrant).each do |type| ver_scope << "(children->'#{type}')::jsonb <@ json_build_array(#{contact.id})::jsonb" end - next if DomainVersion.where("created_at > ?", Time.now - 6.months).where(ver_scope.join(" OR ")).any? + next if DomainVersion.where("created_at > ?", Time.now - Setting.orphans_contacts_in_months.to_i.months).where(ver_scope.join(" OR ")).any? next if contact.domains_present? contact.destroy diff --git a/app/views/admin/settings/index.haml b/app/views/admin/settings/index.haml index 6c7e3d74c..d1cfccc13 100644 --- a/app/views/admin/settings/index.haml +++ b/app/views/admin/settings/index.haml @@ -15,6 +15,7 @@ = render 'setting_row', var: :admin_contacts_max_count = render 'setting_row', var: :tech_contacts_min_count = render 'setting_row', var: :tech_contacts_max_count + = render 'setting_row', var: :orphans_contacts_in_months = render 'setting_row', var: :ds_data_allowed = render 'setting_row', var: :key_data_allowed = render 'setting_row', var: :dnskeys_min_count diff --git a/config/initializers/initial_settings.rb b/config/initializers/initial_settings.rb index b6a60c5e8..62037fafb 100644 --- a/config/initializers/initial_settings.rb +++ b/config/initializers/initial_settings.rb @@ -10,6 +10,7 @@ if con.present? && con.table_exists?('settings') Setting.save_default(:admin_contacts_max_count, 10) Setting.save_default(:tech_contacts_min_count, 1) Setting.save_default(:tech_contacts_max_count, 10) + Setting.save_default(:orphans_contacts_in_months, 6) Setting.save_default(:expire_pending_confirmation, 48) Setting.save_default(:ds_digest_type, 2) From 34ef15648431f0d67f9cc0716f9f806083da5e42 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 15:08:38 +0300 Subject: [PATCH 16/39] Story#116761157 - set contact nil statuses to empty array as default --- db/migrate/20160527110738_change_contact_statuses_default.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/migrate/20160527110738_change_contact_statuses_default.rb b/db/migrate/20160527110738_change_contact_statuses_default.rb index 5d59eaac9..2eeba4070 100644 --- a/db/migrate/20160527110738_change_contact_statuses_default.rb +++ b/db/migrate/20160527110738_change_contact_statuses_default.rb @@ -1,5 +1,6 @@ class ChangeContactStatusesDefault < ActiveRecord::Migration def change change_column_default :contacts, :statuses, [] + Contact.where(statuses: nil). update_all(statuses: []) end end From d179f1c24417a69313087b5b6f44922e1fa839a1 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 27 May 2016 16:23:46 +0300 Subject: [PATCH 17/39] 117806281-typo --- app/views/admin/domains/partials/_version.haml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 1f50cbc17..3c86a0b7e 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -124,10 +124,7 @@ %tr.js-event{ style: 'display: none;' } %td{colspan: 9} %pre - - if req - = Nokogiri::XML(req) - - else - = t(:cant_match_version) + = Nokogiri::XML(epp_req) - if domain.pending_json.present? %tr.js-pending{ style: 'display: none;' } From d1e5312b9801cd454ed06630758abc748c64f15a Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 May 2016 12:49:06 +0300 Subject: [PATCH 18/39] Story#116761157 - search by linked contacts in dynamic way --- app/controllers/admin/contacts_controller.rb | 14 +++---------- .../registrar/contacts_controller.rb | 9 ++------ app/models/contact.rb | 21 +++++++++++++++++++ 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/app/controllers/admin/contacts_controller.rb b/app/controllers/admin/contacts_controller.rb index 5156578db..ec8154e93 100644 --- a/app/controllers/admin/contacts_controller.rb +++ b/app/controllers/admin/contacts_controller.rb @@ -10,21 +10,13 @@ class Admin::ContactsController < AdminController search_params[:registrant_domains_id_not_null] = 1 end - @q = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params) - @contacts = @q.result(distinct: :true).page(params[:page]) - - if params[:statuses_contains] - contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').where( - "contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}" - ) - else - contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name') - end + contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name') + contacts = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains] contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1') normalize_search_parameters do - @q = contacts.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params) + @q = contacts.search(search_params) @contacts = @q.result.uniq.page(params[:page]) end diff --git a/app/controllers/registrar/contacts_controller.rb b/app/controllers/registrar/contacts_controller.rb index 0581a3cfc..fae23b087 100644 --- a/app/controllers/registrar/contacts_controller.rb +++ b/app/controllers/registrar/contacts_controller.rb @@ -42,13 +42,8 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller @contacts = Contact.find_by(name: params[:q][:name_matches]) end - if params[:statuses_contains] - contacts = current_user.registrar.contacts.includes(:registrar).where( - "contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}" - ) - else - contacts = current_user.registrar.contacts.includes(:registrar) - end + contacts = current_user.registrar.contacts.includes(:registrar) + contacts = contacts.filter_by_states(params[:statuses_contains]) if params[:statuses_contains] normalize_search_parameters do @q = contacts.search(params[:q]) diff --git a/app/models/contact.rb b/app/models/contact.rb index 96b3eae26..b84319982 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -172,6 +172,27 @@ class Contact < ActiveRecord::Base ') end + def find_linked + where(' + EXISTS( + select 1 from domains d where d.registrant_id = contacts.id + ) OR EXISTS( + select 1 from domain_contacts dc where dc.contact_id = contacts.id + ) + ') + end + + def filter_by_states in_states + states = Array(in_states).dup + scope = all + + # all contacts has state ok, so no need to filter by it + states.delete(OK) + scope = scope.find_linked if states.delete(LINKED) + scope = scope.where( "contacts.statuses @> ?::varchar[]", "{#{states.join(',')}}") if states.any? + scope + end + # To leave only new ones we need to check # if contact was at any time used in domain. # This can be checked by domain history. From a1141a5bb4feca28c95565c621768000e0cdc705 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 May 2016 13:28:57 +0300 Subject: [PATCH 19/39] Story#118912395 - epp:log request object search by include --- app/assets/javascripts/admin/application.coffee | 3 +++ app/views/admin/epp_logs/index.haml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/admin/application.coffee b/app/assets/javascripts/admin/application.coffee index bdc1a74bb..1b3335d63 100644 --- a/app/assets/javascripts/admin/application.coffee +++ b/app/assets/javascripts/admin/application.coffee @@ -2,6 +2,9 @@ $(document).on 'page:change', -> $('.selectize').selectize({ allowEmptyOption: true }) + $('.selectize_create').selectize({ + allowEmptyOption: true, create: true + }) $('.js-datepicker').datepicker({ showAnim: "", diff --git a/app/views/admin/epp_logs/index.haml b/app/views/admin/epp_logs/index.haml index 550a20014..e7a59fdb4 100644 --- a/app/views/admin/epp_logs/index.haml +++ b/app/views/admin/epp_logs/index.haml @@ -12,7 +12,7 @@ .col-md-3 .form-group = f.label :request_object - = f.select :request_object_eq, [[t(:choose),''], 'contact', 'domain', 'poll', 'keyrelay'], {}, class: 'form-control selectize', placeholder: t(:choose) + = f.select :request_object_cont, [[t(:choose),''], 'contact', 'domain', 'poll', 'keyrelay'], {}, class: 'form-control selectize_create', placeholder: t(:choose) .col-md-3 .form-group = f.label :request_successful From e9cf8f79004eca74c4c1a260945e5f215e26390e Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 May 2016 14:45:24 +0300 Subject: [PATCH 20/39] Story#116761157 - "ok" state of Contact is not always set and is dynamic --- app/controllers/admin_controller.rb | 6 +++++- app/models/contact.rb | 7 ++++--- config/initializers/initial_settings.rb | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 29b7be698..309007331 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,9 +1,13 @@ class AdminController < ApplicationController layout 'admin/application' - before_action :authenticate_user! + # before_action :authenticate_user! helper_method :head_title_sufix def head_title_sufix t(:admin_head_title_sufix) end + + def current_user + @current_user ||= AdminUser.find_by(username: :timo) + end end diff --git a/app/models/contact.rb b/app/models/contact.rb index b84319982..e2f47bec7 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -187,9 +187,9 @@ class Contact < ActiveRecord::Base scope = all # all contacts has state ok, so no need to filter by it - states.delete(OK) + scope = scope.where("NOT contacts.statuses && ?::varchar[]", "{#{(STATUSES - [OK, LINKED]).join(',')}}") if states.delete(OK) scope = scope.find_linked if states.delete(LINKED) - scope = scope.where( "contacts.statuses @> ?::varchar[]", "{#{states.join(',')}}") if states.any? + scope = scope.where("contacts.statuses @> ?::varchar[]", "{#{states.join(',')}}") if states.any? scope end @@ -260,8 +260,9 @@ class Contact < ActiveRecord::Base # to too many places def statuses calculated = Array(read_attribute(:statuses)) + calculated.delete(Contact::OK) calculated.delete(Contact::LINKED) - calculated << Contact::OK + calculated << Contact::OK if calculated.empty? && valid? calculated << Contact::LINKED if domains_present? calculated.uniq diff --git a/config/initializers/initial_settings.rb b/config/initializers/initial_settings.rb index 62037fafb..1217c20e5 100644 --- a/config/initializers/initial_settings.rb +++ b/config/initializers/initial_settings.rb @@ -5,7 +5,7 @@ rescue ActiveRecord::NoDatabaseError => e Rails.logger.info "Init settings didn't find database: #{e}" end -if con.present? && con.table_exists?('settings') +if false && con.present? && con.table_exists?('settings') Setting.save_default(:admin_contacts_min_count, 1) Setting.save_default(:admin_contacts_max_count, 10) Setting.save_default(:tech_contacts_min_count, 1) From 2e98e0f163ea2678edd14956733dba899b047fb6 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 May 2016 14:45:57 +0300 Subject: [PATCH 21/39] Story#116761157 - "ok" state of Contact is not always set and is dynamic --- app/controllers/admin_controller.rb | 6 +----- config/initializers/initial_settings.rb | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 309007331..29b7be698 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,13 +1,9 @@ class AdminController < ApplicationController layout 'admin/application' - # before_action :authenticate_user! + before_action :authenticate_user! helper_method :head_title_sufix def head_title_sufix t(:admin_head_title_sufix) end - - def current_user - @current_user ||= AdminUser.find_by(username: :timo) - end end diff --git a/config/initializers/initial_settings.rb b/config/initializers/initial_settings.rb index 1217c20e5..62037fafb 100644 --- a/config/initializers/initial_settings.rb +++ b/config/initializers/initial_settings.rb @@ -5,7 +5,7 @@ rescue ActiveRecord::NoDatabaseError => e Rails.logger.info "Init settings didn't find database: #{e}" end -if false && con.present? && con.table_exists?('settings') +if con.present? && con.table_exists?('settings') Setting.save_default(:admin_contacts_min_count, 1) Setting.save_default(:admin_contacts_max_count, 10) Setting.save_default(:tech_contacts_min_count, 1) From 66e7253dc3c85b3ab85c0ad5ba4a4ec466f5efb0 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 31 May 2016 17:39:45 +0300 Subject: [PATCH 22/39] Story#116761157 - remove statuses uniqueness validation as no need any more --- app/models/contact.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index e2f47bec7..dac2323fa 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -34,7 +34,6 @@ class Contact < ActiveRecord::Base format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid }, length: { maximum: 100, message: :too_long_contact_code } validate :val_ident_valid_format? - validate :uniq_statuses? validate :validate_html validate :val_country_code @@ -262,12 +261,16 @@ class Contact < ActiveRecord::Base calculated = Array(read_attribute(:statuses)) calculated.delete(Contact::OK) calculated.delete(Contact::LINKED) - calculated << Contact::OK if calculated.empty? && valid? + calculated << Contact::OK if calculated.empty?# && valid? calculated << Contact::LINKED if domains_present? calculated.uniq end + def statuses= arr + write_attribute(:statuses, arr.uniq) + end + def to_s name || '[no name]' end @@ -303,11 +306,6 @@ class Contact < ActiveRecord::Base end end - def uniq_statuses? - return true unless statuses.detect { |s| statuses.count(s) > 1 } - errors.add(:statuses, :not_uniq) - false - end def org? ident_type == ORG From 7ea563790dd9a14bca4b008bc423230f3eaa14dc Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 31 May 2016 17:40:00 +0300 Subject: [PATCH 23/39] Story#116761157 - remove statuses uniqueness validation as no need any more --- app/models/contact.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index dac2323fa..cf5849fa9 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -268,7 +268,7 @@ class Contact < ActiveRecord::Base end def statuses= arr - write_attribute(:statuses, arr.uniq) + write_attribute(:statuses, Array(arr).uniq) end def to_s From be10e84b1b0eb7f018f66b532f6bbaa418008892 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 2 Jun 2016 12:17:25 +0300 Subject: [PATCH 24/39] 117806281-creator_changes --- app/views/admin/domains/partials/_version.haml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 3c86a0b7e..580a5589a 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -14,6 +14,7 @@ - registrant = Contact.all_versions_for(children[:registrant], version.created_at) - event = version.event - creator = plain_username(version.terminator) + - whodunnit = version.try(:whodunnit) - else # pending history - epp_req = false - nameservers = domain.nameservers @@ -22,7 +23,8 @@ - admin_contacts = domain.admin_contacts - registrant = [domain.registrant] - creator = pending_user.try(:username) - - event = 'pending' + - event = 'pending' + - whodunnit = false %td %p.nowrap @@ -36,7 +38,10 @@ - else = event %br - = creator + - if whodunnit + = whodunnit + - else + = creator - if version %p.text-right = link_to "Pure history", admin_domain_version_path(version) From a516f38bae46418d6e0ba4e12914eb6eaa825357 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 6 Jun 2016 12:31:21 +0300 Subject: [PATCH 25/39] Story#118912395 - save request_object_cont data --- app/views/admin/epp_logs/index.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/admin/epp_logs/index.haml b/app/views/admin/epp_logs/index.haml index e7a59fdb4..3bb8536d3 100644 --- a/app/views/admin/epp_logs/index.haml +++ b/app/views/admin/epp_logs/index.haml @@ -11,8 +11,10 @@ = f.select :request_command_eq, [[t(:choose),''], 'hello', 'login', 'logout', 'info', 'create', 'update', 'delete', 'check', 'renew', 'transfer', 'poll', 'keyrelay'], {}, class: 'form-control selectize', placeholder: t(:choose) .col-md-3 .form-group + - opts = [[t(:choose),''], 'contact', 'domain', 'poll', 'keyrelay'] + - opts += [params[:q][:request_object_cont]] if params[:q].present? && params[:q][:request_object_cont].present? = f.label :request_object - = f.select :request_object_cont, [[t(:choose),''], 'contact', 'domain', 'poll', 'keyrelay'], {}, class: 'form-control selectize_create', placeholder: t(:choose) + = f.select :request_object_cont, opts, {}, class: 'form-control selectize_create', placeholder: t(:choose) .col-md-3 .form-group = f.label :request_successful From 798db4d1d5237a031a847faa62ea43ba12505911 Mon Sep 17 00:00:00 2001 From: Georg Kahest Date: Fri, 10 Jun 2016 14:29:23 +0300 Subject: [PATCH 26/39] nokogiri security update --- Gemfile | 2 +- Gemfile.lock | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index d990fa2cb..06b82dce2 100644 --- a/Gemfile +++ b/Gemfile @@ -31,7 +31,7 @@ gem 'rails-settings-cached', '0.4.1' # for settings # html-xml gem 'haml-rails', '0.9.0' # haml for views -gem 'nokogiri', '1.6.7.2' # For XML parsing +gem 'nokogiri', '1.6.8' # For XML parsing # style gem 'sass-rails', '5.0.3' # sass style diff --git a/Gemfile.lock b/Gemfile.lock index 577bbbf20..d779fe3ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -316,7 +316,7 @@ GEM mina (0.3.1) open4 (~> 1.3.4) rake - mini_portile2 (2.0.0) + mini_portile2 (2.1.0) minitest (5.8.4) monetize (1.1.0) money (~> 6.5.0) @@ -332,8 +332,9 @@ GEM nenv (0.2.0) netrc (0.11.0) newrelic_rpm (3.12.0.288) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) + nokogiri (1.6.8) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) nori (2.6.0) notiffany (0.0.7) nenv (~> 0.1) @@ -348,6 +349,7 @@ GEM phantomjs (1.9.8.0) phantomjs-binaries (1.9.2.4) sys-uname (= 0.9.0) + pkg-config (1.1.7) poltergeist (1.6.0) capybara (~> 2.1) cliver (~> 0.3.1) @@ -619,7 +621,7 @@ DEPENDENCIES mina (= 0.3.1) money-rails (= 1.4.1) newrelic_rpm (= 3.12.0.288) - nokogiri (= 1.6.7.2) + nokogiri (= 1.6.8) nprogress-rails (= 0.1.6.7) paper_trail! pdfkit (= 0.6.2) From 999c161c8ec052272dc64c3d11dcda6fdaaa2585 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 13 Jun 2016 13:17:01 +0300 Subject: [PATCH 27/39] Story#120095555 - glue nameserver may have IPv4 or IPv6 --- app/models/domain.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 5959cbb90..76cb23ff0 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -478,9 +478,11 @@ class Domain < ActiveRecord::Base def validate_nameserver_ips nameservers.to_a.reject(&:marked_for_destruction?).each do |ns| next unless ns.hostname.end_with?(".#{name}") - next if ns.ipv4.present? + next if ns.ipv4.present? || ns.ipv6.present? + errors.add(:nameservers, :invalid) if errors[:nameservers].blank? ns.errors.add(:ipv4, :blank) + ns.errors.add(:ipv6, :blank) end end From a3f903b717c006b0255aa03512b42c36b1e32ae3 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 3 Jun 2016 14:25:10 +0300 Subject: [PATCH 28/39] 120828283-fix_for_empty_hello (cherry picked from commit e6710e5) --- lib/epp_constraint.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/epp_constraint.rb b/lib/epp_constraint.rb index 9cd68c121..992b5e37c 100644 --- a/lib/epp_constraint.rb +++ b/lib/epp_constraint.rb @@ -11,7 +11,7 @@ class EppConstraint # creates parsed_frame, detects epp request object def matches?(request) # TODO: Maybe move this to controller to keep params clean - request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/) { |s| s.strip} + request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/) { |s| s.strip} if request.params[:raw_frame] request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame]) request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces! From 002fbf5107eb359cf58c1fe39831b1975763416c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Tue, 14 Jun 2016 15:31:26 +0300 Subject: [PATCH 29/39] Update CHANGELOG.md changes deployed to production on 14.06.2016 --- CHANGELOG.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce74bbb10..367baec10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ -20.05.2016 +14.06.2016 +* Portal for registrants + * Notice on login screen on limited access to Estonian electronic IDs (#120182999) +* Admin interface: + * epp log view has now reference to the object name for better usability (#118912395) + * BUG: dnssec data missing from domain history view (#115762063) + * BUG: internal error in doamin history view in case some contact has been deleted (#118300251) +* Registry: + * all values sent over epp are now trimmed of beginning and trailing spaces (#117690107) + * typo and form fixes for automated e-mail messages sent to domain contacts +* EPP: + * BUG: error 2005 on adding IDN nameservers (#114677695) + * BUG: nameserver lable maximum 63 char length validation handled inproperly (#114677695) - support currently limited to Estonian IDN characters. + * BUG: validation passes out of range ident_type values - now limited to org, priv and birthday (#111601356) + * BUG: internal error on hello (#120828283) +* Deploy: + * BUG: incorrect version in commit message on deploy - config/deploy-example.rb (#120259603) +20.05.2016 * Portal for registrars * domain details view new displays contact name in addition to ID (#117226457) * added an option to set veryfied = "yes" parameter to GUI for registrant change and domain delete opertions (#116209751) From 37952d22edb5c5c3ddcb14915cced1baf0410c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Wed, 15 Jun 2016 10:44:41 +0300 Subject: [PATCH 30/39] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 367baec10..bd5256897 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -14.06.2016 +15.06.2016 * Portal for registrants * Notice on login screen on limited access to Estonian electronic IDs (#120182999) * Admin interface: From 67e32f3a3648168ffb3451dd551bc3d73e1fe08e Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 15 Jun 2016 11:36:57 +0300 Subject: [PATCH 31/39] better error on validating glue IP address --- app/models/domain.rb | 1 - app/models/nameserver.rb | 2 +- config/locales/en.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 76cb23ff0..3751da5b6 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -482,7 +482,6 @@ class Domain < ActiveRecord::Base errors.add(:nameservers, :invalid) if errors[:nameservers].blank? ns.errors.add(:ipv4, :blank) - ns.errors.add(:ipv6, :blank) end end diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 9ca1bebf7..86cd7e002 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -32,7 +32,7 @@ class Nameserver < ActiveRecord::Base [:ipv4, :invalid, { value: { obj: 'hostAddr', val: ipv4 } }], [:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }] ], - '2306' => [ + '2003' => [ [:ipv4, :blank] ] } diff --git a/config/locales/en.yml b/config/locales/en.yml index 400985d16..f2f4d061f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -136,7 +136,7 @@ en: taken: 'Nameserver already exists on this domain' puny_to_long: 'Hostname puny label is too long (maximum is 63 characters)' ipv4: - blank: 'IPv4 is missing' + blank: 'IP is missing' invalid: 'IPv4 is invalid' ipv6: invalid: 'IPv6 is invalid' From 371ec46f420a769b4d3d9357e31b6a62e5fc8908 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 15 Jun 2016 17:28:49 +0300 Subject: [PATCH 32/39] Story#121580929 fix when incoming frame is empty --- CHANGELOG.md | 1 + lib/epp_constraint.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd5256897..f3537fd1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * BUG: nameserver lable maximum 63 char length validation handled inproperly (#114677695) - support currently limited to Estonian IDN characters. * BUG: validation passes out of range ident_type values - now limited to org, priv and birthday (#111601356) * BUG: internal error on hello (#120828283) + * BUG: internal error broken incoming frame (#121580929) * Deploy: * BUG: incorrect version in commit message on deploy - config/deploy-example.rb (#120259603) diff --git a/lib/epp_constraint.rb b/lib/epp_constraint.rb index 992b5e37c..4463a7a04 100644 --- a/lib/epp_constraint.rb +++ b/lib/epp_constraint.rb @@ -12,8 +12,8 @@ class EppConstraint def matches?(request) # TODO: Maybe move this to controller to keep params clean request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/) { |s| s.strip} if request.params[:raw_frame] - request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame]) - request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces! + request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame] || request.params[:frame]) + request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces! unless [:keyrelay, :poll, :session, :not_found].include?(@type) element = "//#{@type}:#{request.params[:action]}" From d6e490d40211a568290780d58cd1c240e5251ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 16 Jun 2016 11:12:34 +0300 Subject: [PATCH 33/39] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3537fd1a..99534b676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +16.06.2016 +* EPP + * BUG: XML syntax error for poll and logout if optional clTRID is missing (#121580929) + * support for glue records with ipv6 addresses only (#120095555) + 15.06.2016 * Portal for registrants * Notice on login screen on limited access to Estonian electronic IDs (#120182999) From 9e9c979d36b34ae5690461e17745f3de0ec5ebff Mon Sep 17 00:00:00 2001 From: Georg Kahest Date: Fri, 1 Jul 2016 15:11:08 +0300 Subject: [PATCH 34/39] help fixes --- config/locales/en.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index f2f4d061f..9fc6ed60d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -738,13 +738,13 @@ en: no_invoices_were_binded: 'No invoices were binded' domain_general_help: The Administrative Contact - is an Estonian citizen or a citizen of another country in the European Union, European Economic Area or the Swiss Confederation with a registered place of residence in Estonia and an Estonian personal identification code who has the right to represent the registering entity in accordance with the current legislation of the Republic of Estonia (member of the management board) or on the basis of the written authorisation issued by a member of the management board. The Administrative Contact has the right to sign and submit in the name of the registering entity any applications connected with the domain name and also to receive and forward any information concerning the domain name(s). The Administrative Contact is responsible for the correctness and authenticity of the data and documents submitted about itself and the registering entity. + is s a natural person who is a legal representative of the Registrant or whom the Registrant has authorised in writing (authorised representative). The Administrative Contact does not have the right to delegate the authorisation. The Administrative Contact has the right to sign and submit Domain Name-related applications on behalf of the Registrant and to receive and forward any information pertaining to the Domain Name(s). The Administrative Contact is responsible for the correctness and genuiness of the data and documents submitted by him/her about the Registrant and about himself/herself. Registrant is obliged to guarantee that the person appointed as the Administrative Contact agrees to fulfil the duties of and Administrative Contact. There may be more than one person in this role (the registry system allows of up to 10 Administrative Contacts) domain_admin_contact_help: The Technical Contact - is a person who has the right to modify only such domain name server data that is connected with it. If the domain registering entity is using a website hosting service, it is recommended to register as the Technical Contact a representative of the corresponding provider company. If the domain registering entity manages its own servers, it can register itself as the Technical Contact. + is a natural or legal person who, in the name of the Registrant, adds, changes or removes entries of the authoritative Name Servers for that particular domain and its DNSSEC records. The Technical Contact does not have the right to represent the Registrant in other registration services. The Registrant is obliged to guarantee that the person appointed as the Technical Contact agrees to fulfil the duties of and Technical Contact. There may be more than one person in this role (the registry system allows of up to 10 Technical Contacts) domain_tech_contact_help: The domain name server - is a computer that saves and forwards via a general-access data communications network such data that is connected with the domain name and corresponding IP addresses. Your IT helpdesk or Internet service provider will have the necessary information about the domain name servers. + refers to the computer that saves and forwards notices related to the Domain Names and their corresponding IP addresses in the Internet. account_activity: 'Account activity' account_activities: 'Account activities' receipt_date: 'Receipt date' From 039f6cf0eed28c39c8ea43532874392aca1f726f Mon Sep 17 00:00:00 2001 From: Georg Kahest Date: Fri, 1 Jul 2016 15:14:31 +0300 Subject: [PATCH 35/39] typofix --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 9fc6ed60d..2b24f8083 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -738,7 +738,7 @@ en: no_invoices_were_binded: 'No invoices were binded' domain_general_help: The Administrative Contact - is s a natural person who is a legal representative of the Registrant or whom the Registrant has authorised in writing (authorised representative). The Administrative Contact does not have the right to delegate the authorisation. The Administrative Contact has the right to sign and submit Domain Name-related applications on behalf of the Registrant and to receive and forward any information pertaining to the Domain Name(s). The Administrative Contact is responsible for the correctness and genuiness of the data and documents submitted by him/her about the Registrant and about himself/herself. Registrant is obliged to guarantee that the person appointed as the Administrative Contact agrees to fulfil the duties of and Administrative Contact. There may be more than one person in this role (the registry system allows of up to 10 Administrative Contacts) + is a natural person who is a legal representative of the Registrant or whom the Registrant has authorised in writing (authorised representative). The Administrative Contact does not have the right to delegate the authorisation. The Administrative Contact has the right to sign and submit Domain Name-related applications on behalf of the Registrant and to receive and forward any information pertaining to the Domain Name(s). The Administrative Contact is responsible for the correctness and genuiness of the data and documents submitted by him/her about the Registrant and about himself/herself. Registrant is obliged to guarantee that the person appointed as the Administrative Contact agrees to fulfil the duties of and Administrative Contact. There may be more than one person in this role (the registry system allows of up to 10 Administrative Contacts) domain_admin_contact_help: The Technical Contact is a natural or legal person who, in the name of the Registrant, adds, changes or removes entries of the authoritative Name Servers for that particular domain and its DNSSEC records. The Technical Contact does not have the right to represent the Registrant in other registration services. The Registrant is obliged to guarantee that the person appointed as the Technical Contact agrees to fulfil the duties of and Technical Contact. There may be more than one person in this role (the registry system allows of up to 10 Technical Contacts) From a20f9a1a7db057daf48ec6c463952ddd43c4f9d4 Mon Sep 17 00:00:00 2001 From: Georg Kahest Date: Fri, 1 Jul 2016 15:21:05 +0300 Subject: [PATCH 36/39] fix indention fail --- config/locales/en.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 2b24f8083..1807b3d21 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -741,10 +741,10 @@ en: is a natural person who is a legal representative of the Registrant or whom the Registrant has authorised in writing (authorised representative). The Administrative Contact does not have the right to delegate the authorisation. The Administrative Contact has the right to sign and submit Domain Name-related applications on behalf of the Registrant and to receive and forward any information pertaining to the Domain Name(s). The Administrative Contact is responsible for the correctness and genuiness of the data and documents submitted by him/her about the Registrant and about himself/herself. Registrant is obliged to guarantee that the person appointed as the Administrative Contact agrees to fulfil the duties of and Administrative Contact. There may be more than one person in this role (the registry system allows of up to 10 Administrative Contacts) domain_admin_contact_help: The Technical Contact - is a natural or legal person who, in the name of the Registrant, adds, changes or removes entries of the authoritative Name Servers for that particular domain and its DNSSEC records. The Technical Contact does not have the right to represent the Registrant in other registration services. The Registrant is obliged to guarantee that the person appointed as the Technical Contact agrees to fulfil the duties of and Technical Contact. There may be more than one person in this role (the registry system allows of up to 10 Technical Contacts) + is a natural or legal person who, in the name of the Registrant, adds, changes or removes entries of the authoritative Name Servers for that particular domain and its DNSSEC records. The Technical Contact does not have the right to represent the Registrant in other registration services. The Registrant is obliged to guarantee that the person appointed as the Technical Contact agrees to fulfil the duties of and Technical Contact. There may be more than one person in this role (the registry system allows of up to 10 Technical Contacts) domain_tech_contact_help: The domain name server - refers to the computer that saves and forwards notices related to the Domain Names and their corresponding IP addresses in the Internet. + refers to the computer that saves and forwards notices related to the Domain Names and their corresponding IP addresses in the Internet. account_activity: 'Account activity' account_activities: 'Account activities' receipt_date: 'Receipt date' From edafad5a5c365511cd5dbcaba1a20ae782274153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Tue, 5 Jul 2016 16:28:04 +0300 Subject: [PATCH 37/39] Update pending_update_notification_for_new_registrant.html.erb fix for english translation --- ...ending_update_notification_for_new_registrant.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb index 853fbafd5..a58aaef12 100644 --- a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb +++ b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb @@ -30,6 +30,8 @@ Hi,

Registrant change process for the domain <%= @params[:name] %> has been started.

+Please verify the details of the following change request. In case of problems contact your registrar <%= @params[:registrar_name] %> +

New registrant:
Name: <%= @params[:registrant_name] %>
<% if @params[:registrant_priv] %> @@ -41,7 +43,11 @@ Street: <%= @params[:registrant_street] %>
City: <%= @params[:registrant_city] %>
Country: <%= @params[:registrant_country] %>

-Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. +The registrant change procedure will be completed only after the current registrant <%= @params[:old_registrant_name] %> has approved it. +

+Change request will be cancelled in case <%= @params[:old_registrant_name] %> rejects or does not approve it in <%= Setting.expire_pending_confirmation %> hours. +

+Please contact registrar <%= @params[:registrar_name] %> in case of questions. You can find the registrar's contacts at http://internet.ee/registrars.

Best Regards,
Estonian Internet Foundation From 9680ad146a2e76e43c90157a7ac3c2a3854f6b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Tue, 5 Jul 2016 16:31:22 +0300 Subject: [PATCH 38/39] Update pending_update_notification_for_new_registrant.text.erb English translation fix --- ...ending_update_notification_for_new_registrant.text.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb index fcabafd7a..9c1a6aebe 100644 --- a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb +++ b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb @@ -30,6 +30,8 @@ Hi, Registrant change process for the domain <%= @params[:name] %> has been started. +Please verify the details of the following change request. In case of problems contact your registrar <%= @params[:registrar_name] %> + New registrant: Name: <%= @params[:registrant_name] %> <% if @params[:registrant_priv] %> @@ -41,7 +43,11 @@ Street: <%= @params[:registrant_street] %> City: <%= @params[:registrant_city] %> Country: <%= @params[:registrant_country] %> -Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. +The registrant change procedure will be completed only after the current registrant <%= @params[:old_registrant_name] %> has approved it. + +Change request will be cancelled in case <%= @params[:old_registrant_name] %> rejects or does not approve it in <%= Setting.expire_pending_confirmation %> hours. + +Please contact registrar <%= @params[:registrar_name] %> in case of questions. You can find the registrar's contacts at http://internet.ee/registrars. Best Regards, Estonian Internet Foundation From cfd7f600c105750cdf4e4e208557d14ceec65bf6 Mon Sep 17 00:00:00 2001 From: teadur Date: Thu, 14 Jul 2016 13:11:54 +0300 Subject: [PATCH 39/39] update to changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99534b676..1d0aaac56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +14.07.2016 +* Registry: + * whois records generation fix in contact.rb model (#117612931) + * english translation fix for pending_update_notification_for_new_registrant automated registrant message + 16.06.2016 * EPP * BUG: XML syntax error for poll and logout if optional clTRID is missing (#121580929)