From bd85e0b33ccd0c431223cbcf4423825e38ea5d4a Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Mon, 2 Nov 2015 15:20:14 +0200 Subject: [PATCH 01/63] Story #104525314 - Test: fix existing brittle unit test, checking for error string. The test expects too much of the error string, which prevents EPP status values from evolving to include new values. CHANGE: only check relevant part of error message string. --- spec/epp/domain_spec.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 473ea3cf3..4c5ba2118 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -2444,14 +2444,9 @@ describe 'EPP Domain', epp: true do }) response = epp_plain_request(xml) - response[:results][0][:msg].should == + response[:results][0][:msg].should start_with "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': "\ - "[facet 'enumeration'] The value 'invalidStatus' is not an element of the set "\ - "{'clientDeleteProhibited', 'clientHold', 'clientRenewProhibited', "\ - "'clientTransferProhibited', 'clientUpdateProhibited', 'inactive', "\ - "'ok', 'pendingCreate', 'pendingDelete', 'pendingRenew', 'pendingTransfer', "\ - "'pendingUpdate', 'serverDeleteProhibited', 'serverHold', 'serverRenewProhibited', "\ - "'serverTransferProhibited', 'serverUpdateProhibited'}." + "[facet 'enumeration'] The value 'invalidStatus' is not an element of the set " response[:results][0][:result_code].should == '2001' end From 13fb1f11b1bab892e11a8152f8f9e1a15c204a12 Mon Sep 17 00:00:00 2001 From: teadur Date: Tue, 3 Nov 2015 11:44:36 +0200 Subject: [PATCH 02/63] Update debian_build_doc.md --- doc/debian_build_doc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/debian_build_doc.md b/doc/debian_build_doc.md index 8ab99aa1a..e14992994 100644 --- a/doc/debian_build_doc.md +++ b/doc/debian_build_doc.md @@ -28,7 +28,7 @@ Please install following lib, otherwise your bundler install might not be succes ### For generating pdfs - sudo apt-get install wkhtmltopdf + sudo apt-get install libxrender1 libfontconfig1 ### RBENV install From 2c717d247a88b948f6441b2a29aa80a804a96ccc Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Wed, 4 Nov 2015 11:28:55 +0200 Subject: [PATCH 03/63] Story #104525314 - fix typo, wrong braces --- app/models/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index c9d669b7d..b70dbe9ae 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -399,7 +399,7 @@ class Domain < ActiveRecord::Base def clean_pendings! preclean_pendings self.pending_json = {} - statuses.delete[DomainStatus::PENDING_DELETE_CONFIRMATION] + statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION) statuses.delete(DomainStatus::PENDING_UPDATE) statuses.delete(DomainStatus::PENDING_DELETE) status_notes[DomainStatus::PENDING_UPDATE] = '' From af4e609a6d618adcd063bdacb27b4db605d908b8 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 4 Nov 2015 13:45:10 +0200 Subject: [PATCH 04/63] Story#105314040 In admin contacts show all domains. Roles are missing --- app/controllers/admin/contacts_controller.rb | 2 +- app/models/contact.rb | 20 +++++++++++++++++++ .../admin/contacts/partials/_domains.haml | 13 ++++++++---- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/contacts_controller.rb b/app/controllers/admin/contacts_controller.rb index 1388db636..a1df165d2 100644 --- a/app/controllers/admin/contacts_controller.rb +++ b/app/controllers/admin/contacts_controller.rb @@ -45,7 +45,7 @@ class Admin::ContactsController < AdminController private def set_contact - @contact = Contact.includes(domains: :registrar).find(params[:id]) + @contact = Contact.find(params[:id]) end def contact_params diff --git a/app/models/contact.rb b/app/models/contact.rb index adf375041..8416aa971 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -349,6 +349,26 @@ class Contact < ActiveRecord::Base "#{code} #{name}" end + + # what we can do load firstly by registrant + # if total is smaller than needed, the load more + # we also need to sort by valid_to + def all_domains(page: nil, per: nil) + sql = %Q{id IN ( + select domain_id from domain_contacts where contact_id=#{id} + UNION + select id from domains where registrant_id=#{id} + )} + + + # sql = Domain.joins(:domain_contacts).where(domain_contacts: {contact_id: id}).select("#{Domain.table_name}.*".freeze, "'domain_contacts' AS style"). + # union(registrant_domains.select("#{Domain.table_name}.*".freeze, "'registrant_domains' AS style")).to_sql + # merged_sql = "select #{Domain.column_names.join(',')}, array_agg (t.style) over (partition by t.id) style from (#{sql} limit #{per.to_i}) t" + domains = Domain.where(sql).order("valid_to DESC NULLS LAST").includes(:registrar).page(page).per(per) + + domains + end + def set_linked statuses << LINKED if statuses.detect { |s| s == LINKED }.blank? end diff --git a/app/views/admin/contacts/partials/_domains.haml b/app/views/admin/contacts/partials/_domains.haml index 0c319127b..744f40744 100644 --- a/app/views/admin/contacts/partials/_domains.haml +++ b/app/views/admin/contacts/partials/_domains.haml @@ -1,15 +1,20 @@ +- domains = @contact.all_domains(page: params[:domain_page], per: 20) #contacts.panel.panel-default .panel-heading= t(:domains) .table-responsive %table.table.table-hover.table-bordered.table-condensed %thead %tr - %th{class: 'col-xs-4'}= t(:domain_name) - %th{class: 'col-xs-4'}= t(:registrar) - %th{class: 'col-xs-4'}= t(:valid_to) + %th{class: 'col-xs-3'}= t(:domain_name) + %th{class: 'col-xs-3'}= t(:registrar) + %th{class: 'col-xs-3'}= t(:valid_to) + %th{class: 'col-xs-3'}= t(:roles) %tbody - - @contact.registrant_domains.each do |x| + - domains.each do |x| %tr %td= link_to(x.name, [:admin, x]) %td= link_to(x.registrar, [:admin, x.registrar]) %td= l(x.valid_to, format: :short) + %td= t(:registrar) + += paginate domains, param_name: :domain_page \ No newline at end of file From 50983cd95d406649c1c379062d1d98f50450af09 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 4 Nov 2015 15:28:46 +0200 Subject: [PATCH 05/63] add roles to domans list --- app/models/contact.rb | 4 ++++ app/models/domain.rb | 2 ++ app/views/admin/contacts/partials/_domains.haml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 8416aa971..e6a741192 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -365,6 +365,10 @@ class Contact < ActiveRecord::Base # union(registrant_domains.select("#{Domain.table_name}.*".freeze, "'registrant_domains' AS style")).to_sql # merged_sql = "select #{Domain.column_names.join(',')}, array_agg (t.style) over (partition by t.id) style from (#{sql} limit #{per.to_i}) t" domains = Domain.where(sql).order("valid_to DESC NULLS LAST").includes(:registrar).page(page).per(per) + domain_c = Hash.new([]) + registrant_domains.where(id: domains.map(&:id)).each{|d| domain_c[d.id] |= ["Registrant"].freeze } + DomainContact.where(contact_id: id, domain_id: domains.map(&:id)).each{|d| domain_c[d.domain_id] |= [d.type] } + domains.each{|d| d.roles = domain_c[d.id].uniq} domains end diff --git a/app/models/domain.rb b/app/models/domain.rb index c9d669b7d..da6d63e9f 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -4,6 +4,8 @@ class Domain < ActiveRecord::Base include Statuses has_paper_trail class_name: "DomainVersion", meta: { children: :children_log } + attr_accessor :roles + # TODO: whois requests ip whitelist for full info for own domains and partial info for other domains # TODO: most inputs should be trimmed before validatation, probably some global logic? diff --git a/app/views/admin/contacts/partials/_domains.haml b/app/views/admin/contacts/partials/_domains.haml index 744f40744..f99c0926d 100644 --- a/app/views/admin/contacts/partials/_domains.haml +++ b/app/views/admin/contacts/partials/_domains.haml @@ -15,6 +15,6 @@ %td= link_to(x.name, [:admin, x]) %td= link_to(x.registrar, [:admin, x.registrar]) %td= l(x.valid_to, format: :short) - %td= t(:registrar) + %td= x.roles.join(", ") = paginate domains, param_name: :domain_page \ No newline at end of file From 5dc550172d22e0fe095d7f00cdc848f716b0fda0 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 4 Nov 2015 16:23:01 +0200 Subject: [PATCH 06/63] add sorting to contact domains --- app/helpers/application_helper.rb | 12 ++++++++++ app/models/contact.rb | 23 ++++++++++++++----- .../admin/contacts/partials/_domains.haml | 8 +++---- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7a75ff78f..dea4f9228 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -55,4 +55,16 @@ module ApplicationHelper username ||= '' username.split(':').last.to_s.strip end + + def custom_sort_link(title, param_name) + sort = params.fetch(:sort, {})[param_name] + order = {"asc"=>"desc", "desc"=>"asc"}[sort] || "asc" + + # binding.pry + if params.fetch(:sort, {}).include?(param_name) + title += (sort == "asc" ? " ▲" : " ▼") + end + + link_to(title, url_for(sort: {param_name => order}), class: "sort_link #{order}") + end end diff --git a/app/models/contact.rb b/app/models/contact.rb index e6a741192..722f7e170 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -353,18 +353,29 @@ class Contact < ActiveRecord::Base # what we can do load firstly by registrant # if total is smaller than needed, the load more # we also need to sort by valid_to - def all_domains(page: nil, per: nil) - sql = %Q{id IN ( + def all_domains(page: nil, per: nil, params: {}) + sql = %Q{domains.id IN ( select domain_id from domain_contacts where contact_id=#{id} UNION select id from domains where registrant_id=#{id} )} + sorts = params.fetch(:sort, {}).first || [] + sort = Domain.column_names.include?(sorts.first) ? sorts.first : "valid_to" + order = {"asc"=>"desc", "desc"=>"asc"}[sorts.second] || "desc" - # sql = Domain.joins(:domain_contacts).where(domain_contacts: {contact_id: id}).select("#{Domain.table_name}.*".freeze, "'domain_contacts' AS style"). - # union(registrant_domains.select("#{Domain.table_name}.*".freeze, "'registrant_domains' AS style")).to_sql - # merged_sql = "select #{Domain.column_names.join(',')}, array_agg (t.style) over (partition by t.id) style from (#{sql} limit #{per.to_i}) t" - domains = Domain.where(sql).order("valid_to DESC NULLS LAST").includes(:registrar).page(page).per(per) + + domains = Domain.where(sql).includes(:registrar).page(page).per(per) + if sorts.first == "registrar_name".freeze + # using small rails hack to generate outer join + domains = domains.includes(:registrar).where.not(registrars: {id: nil}).order("registrars.name #{order} NULLS LAST") + else + domains = domains.order("#{sort} #{order} NULLS LAST") + end + + + + # adding roles. Need here to make faster sqls domain_c = Hash.new([]) registrant_domains.where(id: domains.map(&:id)).each{|d| domain_c[d.id] |= ["Registrant"].freeze } DomainContact.where(contact_id: id, domain_id: domains.map(&:id)).each{|d| domain_c[d.domain_id] |= [d.type] } diff --git a/app/views/admin/contacts/partials/_domains.haml b/app/views/admin/contacts/partials/_domains.haml index f99c0926d..32dd163da 100644 --- a/app/views/admin/contacts/partials/_domains.haml +++ b/app/views/admin/contacts/partials/_domains.haml @@ -1,13 +1,13 @@ -- domains = @contact.all_domains(page: params[:domain_page], per: 20) +- domains = @contact.all_domains(page: params[:domain_page], per: 20, params: params) #contacts.panel.panel-default .panel-heading= t(:domains) .table-responsive %table.table.table-hover.table-bordered.table-condensed %thead %tr - %th{class: 'col-xs-3'}= t(:domain_name) - %th{class: 'col-xs-3'}= t(:registrar) - %th{class: 'col-xs-3'}= t(:valid_to) + %th{class: 'col-xs-3'}=custom_sort_link t(:domain_name), :name + %th{class: 'col-xs-3'}=custom_sort_link t(:registrar), :registrar_name + %th{class: 'col-xs-3'}=custom_sort_link t(:valid_to), :valid_to %th{class: 'col-xs-3'}= t(:roles) %tbody - domains.each do |x| From 26b0ca7cdd13ac39c149a29e636754230305ead6 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 4 Nov 2015 16:24:13 +0200 Subject: [PATCH 07/63] Story#105314040 add sorting to contact domains (remove debug) --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index dea4f9228..751e1d998 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -60,7 +60,7 @@ module ApplicationHelper sort = params.fetch(:sort, {})[param_name] order = {"asc"=>"desc", "desc"=>"asc"}[sort] || "asc" - # binding.pry + if params.fetch(:sort, {}).include?(param_name) title += (sort == "asc" ? " ▲" : " ▼") end From e945bcf1f1c8720f7bfe5f8ee5052edbccdc5526 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 4 Nov 2015 16:51:43 +0200 Subject: [PATCH 08/63] Multiple users --- app/models/legacy/registrar.rb | 2 +- lib/tasks/import.rake | 38 +++++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/app/models/legacy/registrar.rb b/app/models/legacy/registrar.rb index 048529d62..a0a0c251d 100644 --- a/app/models/legacy/registrar.rb +++ b/app/models/legacy/registrar.rb @@ -3,7 +3,7 @@ module Legacy self.table_name = :registrar has_many :invoices, foreign_key: :registrarid - has_one :acl, foreign_key: :registrarid, class_name: "Legacy::RegistrarAcl" + has_many :acl, foreign_key: :registrarid, class_name: "Legacy::RegistrarAcl" def account_balance invoices.sum(:credit) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index b2ea9f6e5..0bab1a4fc 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -141,19 +141,33 @@ namespace :import do next if existing_ids.include?(x.id) count += 1 - users << ApiUser.new({ - username: x.handle.try(:strip), - password: x.acl.try(:password), - registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), - legacy_id: x.try(:id) - }) + if x.acl.last.try(:cert) != 'pki' + if x.acl.last.try(:cert) != 'idkaart' + users << ApiUser.new({ + username: x.handle.try(:strip), + password: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), + identity_code: x.handle.try(:strip), + registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), + legacy_id: x.try(:id) + }) + else + users << ApiUser.new({ + username: x.handle.try(:strip), + password: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), + registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), + legacy_id: x.try(:id) + }) + end + end - if x.acl.try(:ipaddr) - ips << WhiteIp.new({ - registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), - ipv4: x.acl.try(:ipaddr) - }) - end + x.acl.all.each do |y| + if !y.ipaddr.nil? && y.ipaddr != '' + ips << WhiteIp.new({ + registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), + ipv4: y.ipaddr + }) + end + end end ApiUser.import users, validate: false From ae5e5abfbcd6109be3183f3a652d5adbc2558484 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 4 Nov 2015 17:00:52 +0200 Subject: [PATCH 09/63] Story#105314040 filter domains under contacts --- app/models/contact.rb | 21 ++++++++++++------- .../admin/contacts/partials/_domains.haml | 12 ++++++++++- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 722f7e170..f332dc2c4 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -353,19 +353,26 @@ class Contact < ActiveRecord::Base # what we can do load firstly by registrant # if total is smaller than needed, the load more # we also need to sort by valid_to + # todo: extract to drapper. Then we can remove Domain#roles def all_domains(page: nil, per: nil, params: {}) - sql = %Q{domains.id IN ( - select domain_id from domain_contacts where contact_id=#{id} - UNION - select id from domains where registrant_id=#{id} - )} + # compose filter sql + filter_sql = case params[:domain_filter] + when "Registrant".freeze + %Q{select id from domains where registrant_id=#{id}} + when AdminDomainContact.to_s, TechDomainContact.to_s + %Q{select domain_id from domain_contacts where contact_id=#{id} AND type='#{params[:domain_filter]}'} + else + %Q{select domain_id from domain_contacts where contact_id=#{id} UNION select id from domains where registrant_id=#{id}} + end + # get sorting rules sorts = params.fetch(:sort, {}).first || [] sort = Domain.column_names.include?(sorts.first) ? sorts.first : "valid_to" order = {"asc"=>"desc", "desc"=>"asc"}[sorts.second] || "desc" - domains = Domain.where(sql).includes(:registrar).page(page).per(per) + # fetch domains + domains = Domain.where("domains.id IN (#{filter_sql})").includes(:registrar).page(page).per(per) if sorts.first == "registrar_name".freeze # using small rails hack to generate outer join domains = domains.includes(:registrar).where.not(registrars: {id: nil}).order("registrars.name #{order} NULLS LAST") @@ -377,7 +384,7 @@ class Contact < ActiveRecord::Base # adding roles. Need here to make faster sqls domain_c = Hash.new([]) - registrant_domains.where(id: domains.map(&:id)).each{|d| domain_c[d.id] |= ["Registrant"].freeze } + registrant_domains.where(id: domains.map(&:id)).each{|d| domain_c[d.id] |= ["Registrant".freeze] } DomainContact.where(contact_id: id, domain_id: domains.map(&:id)).each{|d| domain_c[d.domain_id] |= [d.type] } domains.each{|d| d.roles = domain_c[d.id].uniq} diff --git a/app/views/admin/contacts/partials/_domains.haml b/app/views/admin/contacts/partials/_domains.haml index 32dd163da..52c7ec3c7 100644 --- a/app/views/admin/contacts/partials/_domains.haml +++ b/app/views/admin/contacts/partials/_domains.haml @@ -1,6 +1,16 @@ - domains = @contact.all_domains(page: params[:domain_page], per: 20, params: params) #contacts.panel.panel-default - .panel-heading= t(:domains) + .panel-heading + .pull-left + = t(:domains) + .pull-right + = form_tag request.path, method: :get do + = select_tag :domain_filter, options_for_select(%w(Registrant AdminDomainContact TechDomainContact), selected: params[:domain_filter]), + include_blank: true, class: 'form-control2 selectize2' + %button.btn.btn-primary + %span.glyphicon.glyphicon-search + .clearfix + .table-responsive %table.table.table-hover.table-bordered.table-condensed %thead From eda586d8c483e6b936ed549f943127863625cde3 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Thu, 5 Nov 2015 12:20:25 +0200 Subject: [PATCH 10/63] Story #104525314 - restore missing change, admin controller flag skips validation --- app/controllers/admin/domains_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/admin/domains_controller.rb b/app/controllers/admin/domains_controller.rb index 3240db931..562505dc1 100644 --- a/app/controllers/admin/domains_controller.rb +++ b/app/controllers/admin/domains_controller.rb @@ -46,6 +46,7 @@ class Admin::DomainsController < AdminController def update dp = ignore_empty_statuses + @domain.is_admin = true if @domain.update(dp) flash[:notice] = I18n.t('domain_updated') From 68a93a33abd9a96eda5ea5d1326ff1105ed0febe Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Thu, 5 Nov 2015 13:08:53 +0200 Subject: [PATCH 11/63] Story #104525314 - fix xpath, verified must be found on child delete/delete --- app/models/epp/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 4a446d25c..9a9e51b4e 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -513,7 +513,7 @@ class Epp::Domain < Domain return false unless valid? if Setting.request_confirmation_on_domain_deletion_enabled && - frame.css('delete').attr('verified').to_s.downcase != 'yes' + frame.css('delete').children.css('delete').attr('verified').to_s.downcase != 'yes' registrant_verification_asked!(frame.to_s, user_id) self.deliver_emails = true # turn on email delivery for epp From 52daf0ba14b704a92a7698d6e25fa5640881a89f Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 5 Nov 2015 13:14:43 +0200 Subject: [PATCH 12/63] Login changed for idkaart, random password added. --- lib/tasks/import.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 0bab1a4fc..d901ccf61 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -145,15 +145,15 @@ namespace :import do if x.acl.last.try(:cert) != 'idkaart' users << ApiUser.new({ username: x.handle.try(:strip), - password: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), + password: x.acl.last.try(:password) ? x.acl.last.try(:password) : ('a'..'z').to_a.shuffle.first(8).join, identity_code: x.handle.try(:strip), registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), legacy_id: x.try(:id) }) - else + elsif x.acl.last.try(:cert) == 'idkaart' users << ApiUser.new({ - username: x.handle.try(:strip), - password: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), + username: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), + password: ('a'..'z').to_a.shuffle.first(8).join, registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), legacy_id: x.try(:id) }) From d6bcfd73f9cc425dd531817175739424c4eaf2fd Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 5 Nov 2015 13:31:09 +0200 Subject: [PATCH 13/63] Role added --- lib/tasks/import.rake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index d901ccf61..f92b859ec 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -148,6 +148,7 @@ namespace :import do password: x.acl.last.try(:password) ? x.acl.last.try(:password) : ('a'..'z').to_a.shuffle.first(8).join, identity_code: x.handle.try(:strip), registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), + roles: ['super'], legacy_id: x.try(:id) }) elsif x.acl.last.try(:cert) == 'idkaart' @@ -160,7 +161,10 @@ namespace :import do end end + existing_ips = WhiteIp.pluck(:ipv4) + x.acl.all.each do |y| + next if existing_ips.include?(y.ipaddr) if !y.ipaddr.nil? && y.ipaddr != '' ips << WhiteIp.new({ registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), From c0cf697938040bc87ea6afbe9e32557794ea068c Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Thu, 5 Nov 2015 16:57:24 +0200 Subject: [PATCH 14/63] Story #104525314 - feature: admin can accept/reject pendingDelete{Confirmation} pending_json is not required --- app/views/admin/domains/form/_pending_delete.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/domains/form/_pending_delete.haml b/app/views/admin/domains/form/_pending_delete.haml index 6924a2b30..e555242a4 100644 --- a/app/views/admin/domains/form/_pending_delete.haml +++ b/app/views/admin/domains/form/_pending_delete.haml @@ -1,4 +1,4 @@ -- if (status == DomainStatus::PENDING_DELETE && f.object.pending_json.present?) +- if (status == DomainStatus::PENDING_DELETE || status == DomainStatus::PENDING_DELETE_CONFIRMATION) = link_to(t(:apply_pending), admin_domain_pending_delete_path(f.object.id, f.object.id), method: :patch, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') From b50f954aa8848f16bb695673a3d45a33b22f4765 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 5 Nov 2015 18:21:20 +0200 Subject: [PATCH 15/63] Domain pricelist validation --- app/controllers/epp/domains_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 5b31a0dad..1f66765e7 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -1,4 +1,5 @@ class Epp::DomainsController < EppController + include EppErrors before_action :find_domain, only: [:info, :renew, :update, :transfer, :delete] before_action :find_password, only: [:info, :update, :transfer, :delete] @@ -28,6 +29,10 @@ class Epp::DomainsController < EppController @domain.errors.delete(:name_dirty) if @domain.errors[:puny_label].any? handle_errors(@domain) and return if @domain.errors.any? + if !@domain_pricelist || @domain_pricelist.valid_from > Time.zone.now + add_epp_error('2306', nil, nil, 'No price lists for domain') + end + handle_errors and return unless balance_ok?('create') ActiveRecord::Base.transaction do if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain? From 98e27f94d558770c98f02cac8350aee3582471e8 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Thu, 5 Nov 2015 18:32:04 +0200 Subject: [PATCH 16/63] Story #104525314 - fix -- should not show apply/delete pending for new status values --- app/views/admin/shared/form/_statuses.haml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/admin/shared/form/_statuses.haml b/app/views/admin/shared/form/_statuses.haml index 697abad44..27be8d032 100644 --- a/app/views/admin/shared/form/_statuses.haml +++ b/app/views/admin/shared/form/_statuses.haml @@ -9,8 +9,9 @@ .pull-left= t(:status) .pull-right - if model == 'domain' - = render 'admin/domains/form/pending_update', f: f, status: s - = render 'admin/domains/form/pending_delete', f: f, status: s + .hide-when-new + = render 'admin/domains/form/pending_update', f: f, status: s + = render 'admin/domains/form/pending_delete', f: f, status: s = link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style) .panel-body .form-group @@ -37,6 +38,7 @@ if el.find('.js-disabled-value') el.find('.js-disabled-value').remove() el.find('.js-select').show() + el.find('.hide-when-new').hide() el.find('.js-destroy-status').show() $(document).on 'click', '.js-destroy-status', (e) -> From c40a282a63177f9220dc977e3ae38fad813ce67f Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 09:30:05 +0200 Subject: [PATCH 17/63] Story #104525314 - change button text to accept/reject delete --- app/views/admin/domains/form/_pending_delete.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/domains/form/_pending_delete.haml b/app/views/admin/domains/form/_pending_delete.haml index e555242a4..2e199d0b7 100644 --- a/app/views/admin/domains/form/_pending_delete.haml +++ b/app/views/admin/domains/form/_pending_delete.haml @@ -1,8 +1,8 @@ - if (status == DomainStatus::PENDING_DELETE || status == DomainStatus::PENDING_DELETE_CONFIRMATION) - = link_to(t(:apply_pending), admin_domain_pending_delete_path(f.object.id, f.object.id), + = link_to(t(:accept_delete), admin_domain_pending_delete_path(f.object.id, f.object.id), method: :patch, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') - = link_to(t(:delete_pending), admin_domain_pending_delete_path(f.object.id, f.object.id), + = link_to(t(:reject_delete), admin_domain_pending_delete_path(f.object.id, f.object.id), method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') From 95bf081b5354a003e917815261873a3e6a65e776 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 11:09:37 +0200 Subject: [PATCH 18/63] Story #104525314 - feature reject combination of delete with deleteProhibited --- app/models/domain.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/domain.rb b/app/models/domain.rb index b70dbe9ae..77c76bd40 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -116,6 +116,11 @@ class Domain < ActiveRecord::Base validate :status_is_consistant def status_is_consistant has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE)) + unless has_error + if (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE, DomainStatus::FORCE_DELETE]).any? + has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED + end + end errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error end From 3d7f8e28669856b6122a837d2859343f3f4d354f Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 11:15:05 +0200 Subject: [PATCH 19/63] Story #104525314 - fix:admin could not confirm reject pending, refactor registrant confirm --- app/models/domain.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 77c76bd40..2cc2d233e 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -449,6 +449,7 @@ class Domain < ActiveRecord::Base # rubocop: disable Metrics/CyclomaticComplexity def registrant_update_confirmable?(token) return true if Rails.env.development? + return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any? return false unless pending_update? return false if registrant_verification_token.blank? return false if registrant_verification_asked_at.blank? @@ -698,7 +699,7 @@ class Domain < ActiveRecord::Base end def pending_delete? - statuses.include?(DomainStatus::PENDING_DELETE) && !statuses.include?(DomainStatus::FORCE_DELETE) + (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE]).any? end def pending_delete_confirmation? From ea230e70ca48e6af59c1ec104cb0d1cc6f0a1400 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 11:16:00 +0200 Subject: [PATCH 20/63] Story #104525314 - clean up, remove dev hacks, allow dev to verify end user experience --- app/models/domain.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 2cc2d233e..8554d37fa 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -448,7 +448,6 @@ class Domain < ActiveRecord::Base # rubocop: disable Metrics/CyclomaticComplexity def registrant_update_confirmable?(token) - return true if Rails.env.development? return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any? return false unless pending_update? return false if registrant_verification_token.blank? @@ -459,7 +458,6 @@ class Domain < ActiveRecord::Base end def registrant_delete_confirmable?(token) - return true if Rails.env.development? return false unless pending_delete? return false if registrant_verification_token.blank? return false if registrant_verification_asked_at.blank? From 8050059ad2591caf7ba075646d2c54b7b3169928 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 6 Nov 2015 11:18:06 +0200 Subject: [PATCH 21/63] Story #104525314 - clean up, remove redundant logic, simplfy --- app/models/domain.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 8554d37fa..97cb60c48 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -450,19 +450,15 @@ class Domain < ActiveRecord::Base def registrant_update_confirmable?(token) return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any? return false unless pending_update? - return false if registrant_verification_token.blank? - return false if registrant_verification_asked_at.blank? - return false if token.blank? - return false if registrant_verification_token != token + return false unless registrant_verification_asked? + return false unless registrant_verification_token == token true end def registrant_delete_confirmable?(token) return false unless pending_delete? - return false if registrant_verification_token.blank? - return false if registrant_verification_asked_at.blank? - return false if token.blank? - return false if registrant_verification_token != token + return false unless registrant_verification_asked? + return false unless registrant_verification_token == token true end # rubocop: enable Metrics/CyclomaticComplexity From e8aa4bff3261fc08f25add16b10dfc2f50a2bb6a Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 6 Nov 2015 11:57:06 +0200 Subject: [PATCH 22/63] Story#105302144 show domains under contact in registrar portal --- app/views/admin/contacts/partials/_domains.haml | 2 +- app/views/registrar/contacts/show.haml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/admin/contacts/partials/_domains.haml b/app/views/admin/contacts/partials/_domains.haml index 52c7ec3c7..026e73c6c 100644 --- a/app/views/admin/contacts/partials/_domains.haml +++ b/app/views/admin/contacts/partials/_domains.haml @@ -1,4 +1,4 @@ -- domains = @contact.all_domains(page: params[:domain_page], per: 20, params: params) +- domains = (contact || @contact).all_domains(page: params[:domain_page], per: 20, params: params) #contacts.panel.panel-default .panel-heading .pull-left diff --git a/app/views/registrar/contacts/show.haml b/app/views/registrar/contacts/show.haml index 6ed6100fe..96faa4ecc 100644 --- a/app/views/registrar/contacts/show.haml +++ b/app/views/registrar/contacts/show.haml @@ -9,6 +9,8 @@ .col-md-6= render 'registrar/contacts/partials/address' .row .col-md-12= render 'registrar/contacts/partials/statuses', statuses: @contact.statuses + .row + .col-md-12= render 'admin/contacts/partials/domains', contact: Contact.find_by(code: params[:id]) - else .row From 484a3034b1ac5651c5c792cc88743939f9bb33a9 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 6 Nov 2015 11:58:08 +0200 Subject: [PATCH 23/63] Story#105314040 show contact domains under statuses in admin --- app/views/admin/contacts/show.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/contacts/show.haml b/app/views/admin/contacts/show.haml index affc55cd7..dad8e0e7d 100644 --- a/app/views/admin/contacts/show.haml +++ b/app/views/admin/contacts/show.haml @@ -5,10 +5,10 @@ .row .col-md-6= render 'admin/contacts/partials/general' .col-md-6= render 'admin/contacts/partials/address' -.row - .col-md-12= render 'admin/contacts/partials/domains' .row .col-md-12= render 'admin/contacts/partials/statuses', contact: @contact +.row + .col-md-12= render 'admin/contacts/partials/domains' - if @contact.legal_documents.present? .row From 4203e4a6f4b48bd2570bb72d47a35a2b7315222f Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 6 Nov 2015 12:50:18 +0200 Subject: [PATCH 24/63] 104989420-validation logic changes --- app/controllers/epp/domains_controller.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 1f66765e7..4607bb28d 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -1,5 +1,4 @@ class Epp::DomainsController < EppController - include EppErrors before_action :find_domain, only: [:info, :renew, :update, :transfer, :delete] before_action :find_password, only: [:info, :update, :transfer, :delete] @@ -29,8 +28,9 @@ class Epp::DomainsController < EppController @domain.errors.delete(:name_dirty) if @domain.errors[:puny_label].any? handle_errors(@domain) and return if @domain.errors.any? - if !@domain_pricelist || @domain_pricelist.valid_from > Time.zone.now - add_epp_error('2306', nil, nil, 'No price lists for domain') + if !@domain_pricelist.try(:price)#checking if pricelist is not found + @domain.add_epp_error('2306', nil, nil, 'No price list for domain') + handle_errors(@domain) and return if @domain.errors.any? end handle_errors and return unless balance_ok?('create') @@ -105,6 +105,11 @@ class Epp::DomainsController < EppController period = (period_element.to_i == 0) ? 1 : period_element.to_i period_unit = Epp::Domain.parse_period_unit_from_frame(params[:parsed_frame]) || 'y' + if !@domain_pricelist.try(:price)#checking if pricelist is not found + @domain.add_epp_error('2306', nil, nil, 'No price list for domain') + handle_errors(@domain) and return if @domain.errors.any? + end + ActiveRecord::Base.transaction do success = @domain.renew( params[:parsed_frame].css('curExpDate').text, From 1793f8fd4cc00ae06b10e25b2650bf6f663e2cf4 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 6 Nov 2015 13:58:18 +0200 Subject: [PATCH 25/63] 106012880-logic changeges --- app/controllers/epp/domains_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 4607bb28d..e5ef6adee 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -27,13 +27,13 @@ class Epp::DomainsController < EppController @domain.valid? @domain.errors.delete(:name_dirty) if @domain.errors[:puny_label].any? handle_errors(@domain) and return if @domain.errors.any? + handle_errors and return unless balance_ok?('create') # loads pricelist in this method if !@domain_pricelist.try(:price)#checking if pricelist is not found @domain.add_epp_error('2306', nil, nil, 'No price list for domain') handle_errors(@domain) and return if @domain.errors.any? end - handle_errors and return unless balance_ok?('create') ActiveRecord::Base.transaction do if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain? current_user.registrar.debit!({ @@ -105,6 +105,7 @@ class Epp::DomainsController < EppController period = (period_element.to_i == 0) ? 1 : period_element.to_i period_unit = Epp::Domain.parse_period_unit_from_frame(params[:parsed_frame]) || 'y' + balance_ok?('renew', period, period_unit) # loading pricelist if !@domain_pricelist.try(:price)#checking if pricelist is not found @domain.add_epp_error('2306', nil, nil, 'No price list for domain') handle_errors(@domain) and return if @domain.errors.any? From 34a2923b54591bce47abb74054b602084c247a73 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 6 Nov 2015 15:18:16 +0200 Subject: [PATCH 26/63] 104989420-roles changes --- lib/tasks/import.rake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index f92b859ec..69de00d02 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -148,7 +148,7 @@ namespace :import do password: x.acl.last.try(:password) ? x.acl.last.try(:password) : ('a'..'z').to_a.shuffle.first(8).join, identity_code: x.handle.try(:strip), registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), - roles: ['super'], + roles: ['epp'], legacy_id: x.try(:id) }) elsif x.acl.last.try(:cert) == 'idkaart' @@ -156,6 +156,7 @@ namespace :import do username: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), password: ('a'..'z').to_a.shuffle.first(8).join, registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), + roles: ['billing'], legacy_id: x.try(:id) }) end From 429bbe5926dffb06f1ca108a516ef70d416b4369 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 6 Nov 2015 15:38:27 +0200 Subject: [PATCH 27/63] 104989420-interfaces for ip --- lib/tasks/import.rake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 69de00d02..25696c959 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -169,7 +169,8 @@ namespace :import do if !y.ipaddr.nil? && y.ipaddr != '' ips << WhiteIp.new({ registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), - ipv4: y.ipaddr + ipv4: y.ipaddr, + roles: ['api', 'registrar'] }) end end From 44948092f9fa31cb3b7147253f6ca2eb8e73004d Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 9 Nov 2015 11:00:42 +0200 Subject: [PATCH 28/63] 105046446-interfaces --- lib/tasks/import.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 25696c959..04d54a676 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -170,7 +170,7 @@ namespace :import do ips << WhiteIp.new({ registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), ipv4: y.ipaddr, - roles: ['api', 'registrar'] + interfaces: ['api', 'registrar'] }) end end From 617292c5ef5be9c9fc39a643a3f6732f85b2afe0 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 9 Nov 2015 16:17:52 +0200 Subject: [PATCH 29/63] 106012880-query fix --- app/models/pricelist.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/pricelist.rb b/app/models/pricelist.rb index cc7b898ea..42cca0126 100644 --- a/app/models/pricelist.rb +++ b/app/models/pricelist.rb @@ -3,7 +3,7 @@ class Pricelist < ActiveRecord::Base scope :valid, lambda { where( - "valid_from <= ? AND valid_to >= ? OR valid_to IS NULL", + "valid_from <= ? AND (valid_to >= ? OR valid_to IS NULL)", Time.zone.now.end_of_day, Time.zone.now.beginning_of_day ) } From 1722e00e8c4cda881bc703cf41598e25434a185e Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Mon, 9 Nov 2015 17:09:54 +0200 Subject: [PATCH 30/63] Story #104525314 - Test: fix bd85e0b33ccd0c431223cbcf4423825e38ea5d4a paren required --- spec/epp/domain_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 4c5ba2118..8e3997649 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -2444,9 +2444,9 @@ describe 'EPP Domain', epp: true do }) response = epp_plain_request(xml) - response[:results][0][:msg].should start_with + response[:results][0][:msg].should start_with( "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': "\ - "[facet 'enumeration'] The value 'invalidStatus' is not an element of the set " + "[facet 'enumeration'] The value 'invalidStatus' is not an element of the set ") response[:results][0][:result_code].should == '2001' end From 8a14bf05f8d805f5976dc9adab9464601af5c5e8 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Mon, 9 Nov 2015 18:59:04 +0200 Subject: [PATCH 31/63] Story #104525314 - EPP user must respect serverDeleteProhibited --- app/models/epp/domain.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 9a9e51b4e..a0b75500a 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -776,12 +776,12 @@ class Epp::Domain < Domain ### ABILITIES ### - # depricated -- this is redundant TODO: try to remove + def can_be_deleted? begin errors.add(:base, :domain_status_prohibits_operation) return false - end if statuses.include?(DomainStatus::CLIENT_DELETE_PROHIBITED) + end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED].any? true end From 2cf7dd3a5c7951fefa82465bf9f1e044c959d284 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 10 Nov 2015 11:25:09 +0200 Subject: [PATCH 32/63] Story #104525314 - fix typo, missing paren --- app/models/epp/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index a0b75500a..7df26cc38 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -781,7 +781,7 @@ class Epp::Domain < Domain begin errors.add(:base, :domain_status_prohibits_operation) return false - end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED].any? + end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED].any?) true end From 587e7db062b57bcace4ba28b447c040caa6e0738 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 10 Nov 2015 13:21:32 +0200 Subject: [PATCH 33/63] Story#107571572 prepare workflow for payments with bank --- .../registrar/payments_controller.rb | 35 +++++++++++++++++++ .../invoices/partials/_banklinks.haml | 18 +++------- config/application-example.yml | 13 +++++++ config/routes.rb | 4 +++ 4 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 app/controllers/registrar/payments_controller.rb diff --git a/app/controllers/registrar/payments_controller.rb b/app/controllers/registrar/payments_controller.rb new file mode 100644 index 000000000..368dc7cb9 --- /dev/null +++ b/app/controllers/registrar/payments_controller.rb @@ -0,0 +1,35 @@ +class Registrar::PaymentsController < RegistrarController + skip_authorization_check # actually anyone can pay, no problems at all + skip_before_action :authenticate_user!, :check_ip, only: [:back] + before_action :check_bank + + # to handle existing model we should + # get invoice_id and then get reference_number + # build BankTransaction without connection with right reference number + # do not connect transaction and invoice + def pay + invoice = Invoice.find(params[:invoice_id]) + + render text: "You are trying to pay with #{params[:bank]} for #{invoice.reference_no}" + end + + def cancel + + end + + # connect invoice and transaction + # both back and IPN + def back + + end + + private + def banks + ENV['payments_banks'].split(",").map(&:strip) + end + + def check_bank + raise StandardError.new("Not Implemented bank") unless banks.include?(params[:bank]) + end + +end diff --git a/app/views/registrar/invoices/partials/_banklinks.haml b/app/views/registrar/invoices/partials/_banklinks.haml index efd6f8564..133a8d9c0 100644 --- a/app/views/registrar/invoices/partials/_banklinks.haml +++ b/app/views/registrar/invoices/partials/_banklinks.haml @@ -1,16 +1,6 @@ %h4= t(:pay_by_bank_link) %hr -= link_to '#' do - = image_tag('swed.png') - -= link_to '#' do - = image_tag('seb.png') - -= link_to '#' do - = image_tag('nordea.png') - -= link_to '#' do - = image_tag('lhv.png') - -= link_to '#' do - = image_tag('danske.png') +- ENV['payments_banks'].split(",").each do |meth| + - meth = meth.strip + = link_to registrar_payment_with_path(meth, invoice_id: params[:id]) do + = image_tag("#{meth}.png") diff --git a/config/application-example.yml b/config/application-example.yml index efc3101a7..7b252e782 100644 --- a/config/application-example.yml +++ b/config/application-example.yml @@ -109,6 +109,19 @@ new_relic_license_key: '42d1c2ba4ed17a9cf6297c59d80e563a3dd3c4fa' secret_key_base: 'please-change-it-you-can-generate-it-with-rake-secret' devise_secret: 'please-change-it-you-can-generate-it-with-rake-secret' +payments_banks: > + seb, + swed, + lhv +payments_seb_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r' +payments_seb_bank_certificate: 'eyp_pub.pem' +payments_seb_seller_private: 'kaupmees_priv.pem' +payments_swed_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r' +payments_swed_bank_certificate: 'eyp_pub.pem' +payments_swed_seller_private: 'kaupmees_priv.pem' +payments_lhv_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r' +payments_lhv_bank_certificate: 'eyp_pub.pem' +payments_lhv_seller_private: 'kaupmees_priv.pem' # # AUTOTEST overwrites diff --git a/config/routes.rb b/config/routes.rb index d8f45180e..06ff248fe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -91,6 +91,10 @@ Rails.application.routes.draw do get 'load_xml' end end + + get 'pay/:bank' => 'payments#pay', as: 'payment_with' + get 'pay/:bank/cancel' => 'payments#cancel',as: 'cancel_payment_with' + get 'pay/:bank/return' => 'payments#back', as: 'return_payment_with' end # REGISTRANT ROUTES From 9f4651bdaa3a2dceed333285d7f0becd933604a7 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 10 Nov 2015 14:41:38 +0200 Subject: [PATCH 34/63] Story #107192666 - bugfix: check content before determining XML format. Only use DS if DS present.:wq --- app/views/epp/domains/info.xml.builder | 39 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index c4827f29f..e7962002c 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -61,19 +61,34 @@ xml.epp_head do end xml.extension do + def tag_key_data(xml, key) + xml.tag!('secDNS:keyData') do + xml.tag!('secDNS:flags', key.flags) + xml.tag!('secDNS:protocol', key.protocol) + xml.tag!('secDNS:alg', key.alg) + xml.tag!('secDNS:pubKey', key.public_key) + end + end + + def tag_ds_data(xml, key) + xml.tag!('secDNS:dsData') do + xml.tag!('secDNS:keyTag', key.ds_key_tag) + xml.tag!('secDNS:alg', key.ds_alg) + xml.tag!('secDNS:digestType', key.ds_digest_type) + xml.tag!('secDNS:digest', key.ds_digest) + tag_key_data(xml, key) if key.public_key.present? + end + end + xml.tag!('secDNS:infData', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1') do - @domain.dnskeys.sort.each do |key| - xml.tag!('secDNS:dsData') do - xml.tag!('secDNS:keyTag', key.ds_key_tag) - xml.tag!('secDNS:alg', key.ds_alg) - xml.tag!('secDNS:digestType', key.ds_digest_type) - xml.tag!('secDNS:digest', key.ds_digest) - xml.tag!('secDNS:keyData') do - xml.tag!('secDNS:flags', key.flags) - xml.tag!('secDNS:protocol', key.protocol) - xml.tag!('secDNS:alg', key.alg) - xml.tag!('secDNS:pubKey', key.public_key) - end + # might not have ds in first key? maybe check any? k.ds_digest if requirements change (DS not accepted by EIS) + if @domain.dnskeys[0].ds_digest.blank? + @domain.dnskeys.sort.each do |key| + tag_key_data(xml, key) + end + else + @domain.dnskeys.sort.each do |key| + tag_ds_data(xml, key) end end end From ef845e42797e8f3aa0cb9bbca7848cdb79561888 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 10 Nov 2015 14:55:26 +0200 Subject: [PATCH 35/63] Story #104525314 - fix typo,2cf7dd3a5c7951fefa82465bf9f1e044c959d284 misplaced paren --- app/models/epp/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 7df26cc38..f59df6ddc 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -781,7 +781,7 @@ class Epp::Domain < Domain begin errors.add(:base, :domain_status_prohibits_operation) return false - end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED].any?) + end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED]).any? true end From 196feeb67178d31cb63b695a12cb191fa1bd27bc Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 10 Nov 2015 18:50:30 +0200 Subject: [PATCH 36/63] Story #104525314 - partial revert previous allow destroy of contacts --- app/models/domain.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 7b744b03c..5580cb837 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -14,9 +14,9 @@ class Domain < ActiveRecord::Base # TODO: should we user validates_associated :registrant here? has_many :admin_domain_contacts - accepts_nested_attributes_for :admin_domain_contacts, allow_destroy: !:admin_change_prohibited?, reject_if: :admin_change_prohibited? + accepts_nested_attributes_for :admin_domain_contacts, allow_destroy: true, reject_if: :admin_change_prohibited? has_many :tech_domain_contacts - accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: !:tech_change_prohibited?, reject_if: :tech_change_prohibited? + accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: true, reject_if: :tech_change_prohibited? def registrant_change_prohibited? statuses.include? DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED From 7d9272c60c90ba27f272a9495829a121ff26ca43 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 10 Nov 2015 19:29:44 +0200 Subject: [PATCH 37/63] Story #107192666 - ensure domains/info page shows keyData or dsData/keyData --- .../registrar/domains/partials/_dnskeys.haml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/views/registrar/domains/partials/_dnskeys.haml b/app/views/registrar/domains/partials/_dnskeys.haml index fc5961849..46dcd0fce 100644 --- a/app/views/registrar/domains/partials/_dnskeys.haml +++ b/app/views/registrar/domains/partials/_dnskeys.haml @@ -19,7 +19,22 @@ - if x.css('digest').text.present? %dt= t(:ds_digest) %dd= x.css('digest').text + - @data.css('keyData').each do |x| + %dl.dl-horizontal + %dt= t(:flag) + %dd= x.css('flags').text + %dt= t(:protocol) + %dd= x.css('protocol').text + + %dt= t(:algorithm) + %dd= x.css('alg').text + + %dt= t(:public_key) + %dd= x.css('pubKey').text + + - @data.css('keyData').each do |x| + %dl.dl-horizontal %dt= t(:flag) %dd= x.css('flags').text @@ -27,7 +42,7 @@ %dd= x.css('protocol').text %dt= t(:algorithm) - %dd= x.css('keyData > alg').text + %dd= x.css('alg').text %dt= t(:public_key) %dd= x.css('pubKey').text From 3724f7abc286c948ef159d12a45460800c4382a9 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 11 Nov 2015 11:53:26 +0200 Subject: [PATCH 38/63] 1050446446 identity code added --- lib/tasks/import.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 04d54a676..f743262c0 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -155,6 +155,7 @@ namespace :import do users << ApiUser.new({ username: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), password: ('a'..'z').to_a.shuffle.first(8).join, + identity_code: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), roles: ['billing'], legacy_id: x.try(:id) From 40e74a2ed457e9cb66836929b8904c45e9eaac79 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 11 Nov 2015 11:59:38 +0200 Subject: [PATCH 39/63] Merge branch 'staging' of github.com:internetee/registry into staging --- app/models/domain.rb | 22 +++++------ app/models/epp/domain.rb | 4 +- .../admin/domains/form/_pending_delete.haml | 6 +-- app/views/admin/shared/form/_statuses.haml | 6 ++- app/views/epp/domains/info.xml.builder | 39 +++++++++++++------ .../registrar/domains/partials/_dnskeys.haml | 17 +++++++- spec/epp/domain_spec.rb | 4 +- 7 files changed, 65 insertions(+), 33 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 7237a24ed..7b744b03c 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -118,6 +118,11 @@ class Domain < ActiveRecord::Base validate :status_is_consistant def status_is_consistant has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE)) + unless has_error + if (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE, DomainStatus::FORCE_DELETE]).any? + has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED + end + end errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error end @@ -445,22 +450,17 @@ class Domain < ActiveRecord::Base # rubocop: disable Metrics/CyclomaticComplexity def registrant_update_confirmable?(token) - return true if Rails.env.development? + return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any? return false unless pending_update? - return false if registrant_verification_token.blank? - return false if registrant_verification_asked_at.blank? - return false if token.blank? - return false if registrant_verification_token != token + return false unless registrant_verification_asked? + return false unless registrant_verification_token == token true end def registrant_delete_confirmable?(token) - return true if Rails.env.development? return false unless pending_delete? - return false if registrant_verification_token.blank? - return false if registrant_verification_asked_at.blank? - return false if token.blank? - return false if registrant_verification_token != token + return false unless registrant_verification_asked? + return false unless registrant_verification_token == token true end # rubocop: enable Metrics/CyclomaticComplexity @@ -695,7 +695,7 @@ class Domain < ActiveRecord::Base end def pending_delete? - statuses.include?(DomainStatus::PENDING_DELETE) && !statuses.include?(DomainStatus::FORCE_DELETE) + (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE]).any? end def pending_delete_confirmation? diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 9a9e51b4e..f59df6ddc 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -776,12 +776,12 @@ class Epp::Domain < Domain ### ABILITIES ### - # depricated -- this is redundant TODO: try to remove + def can_be_deleted? begin errors.add(:base, :domain_status_prohibits_operation) return false - end if statuses.include?(DomainStatus::CLIENT_DELETE_PROHIBITED) + end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED]).any? true end diff --git a/app/views/admin/domains/form/_pending_delete.haml b/app/views/admin/domains/form/_pending_delete.haml index 6924a2b30..2e199d0b7 100644 --- a/app/views/admin/domains/form/_pending_delete.haml +++ b/app/views/admin/domains/form/_pending_delete.haml @@ -1,8 +1,8 @@ -- if (status == DomainStatus::PENDING_DELETE && f.object.pending_json.present?) - = link_to(t(:apply_pending), admin_domain_pending_delete_path(f.object.id, f.object.id), +- if (status == DomainStatus::PENDING_DELETE || status == DomainStatus::PENDING_DELETE_CONFIRMATION) + = link_to(t(:accept_delete), admin_domain_pending_delete_path(f.object.id, f.object.id), method: :patch, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') - = link_to(t(:delete_pending), admin_domain_pending_delete_path(f.object.id, f.object.id), + = link_to(t(:reject_delete), admin_domain_pending_delete_path(f.object.id, f.object.id), method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') diff --git a/app/views/admin/shared/form/_statuses.haml b/app/views/admin/shared/form/_statuses.haml index 697abad44..27be8d032 100644 --- a/app/views/admin/shared/form/_statuses.haml +++ b/app/views/admin/shared/form/_statuses.haml @@ -9,8 +9,9 @@ .pull-left= t(:status) .pull-right - if model == 'domain' - = render 'admin/domains/form/pending_update', f: f, status: s - = render 'admin/domains/form/pending_delete', f: f, status: s + .hide-when-new + = render 'admin/domains/form/pending_update', f: f, status: s + = render 'admin/domains/form/pending_delete', f: f, status: s = link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style) .panel-body .form-group @@ -37,6 +38,7 @@ if el.find('.js-disabled-value') el.find('.js-disabled-value').remove() el.find('.js-select').show() + el.find('.hide-when-new').hide() el.find('.js-destroy-status').show() $(document).on 'click', '.js-destroy-status', (e) -> diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index c4827f29f..e7962002c 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -61,19 +61,34 @@ xml.epp_head do end xml.extension do + def tag_key_data(xml, key) + xml.tag!('secDNS:keyData') do + xml.tag!('secDNS:flags', key.flags) + xml.tag!('secDNS:protocol', key.protocol) + xml.tag!('secDNS:alg', key.alg) + xml.tag!('secDNS:pubKey', key.public_key) + end + end + + def tag_ds_data(xml, key) + xml.tag!('secDNS:dsData') do + xml.tag!('secDNS:keyTag', key.ds_key_tag) + xml.tag!('secDNS:alg', key.ds_alg) + xml.tag!('secDNS:digestType', key.ds_digest_type) + xml.tag!('secDNS:digest', key.ds_digest) + tag_key_data(xml, key) if key.public_key.present? + end + end + xml.tag!('secDNS:infData', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1') do - @domain.dnskeys.sort.each do |key| - xml.tag!('secDNS:dsData') do - xml.tag!('secDNS:keyTag', key.ds_key_tag) - xml.tag!('secDNS:alg', key.ds_alg) - xml.tag!('secDNS:digestType', key.ds_digest_type) - xml.tag!('secDNS:digest', key.ds_digest) - xml.tag!('secDNS:keyData') do - xml.tag!('secDNS:flags', key.flags) - xml.tag!('secDNS:protocol', key.protocol) - xml.tag!('secDNS:alg', key.alg) - xml.tag!('secDNS:pubKey', key.public_key) - end + # might not have ds in first key? maybe check any? k.ds_digest if requirements change (DS not accepted by EIS) + if @domain.dnskeys[0].ds_digest.blank? + @domain.dnskeys.sort.each do |key| + tag_key_data(xml, key) + end + else + @domain.dnskeys.sort.each do |key| + tag_ds_data(xml, key) end end end diff --git a/app/views/registrar/domains/partials/_dnskeys.haml b/app/views/registrar/domains/partials/_dnskeys.haml index fc5961849..46dcd0fce 100644 --- a/app/views/registrar/domains/partials/_dnskeys.haml +++ b/app/views/registrar/domains/partials/_dnskeys.haml @@ -19,7 +19,22 @@ - if x.css('digest').text.present? %dt= t(:ds_digest) %dd= x.css('digest').text + - @data.css('keyData').each do |x| + %dl.dl-horizontal + %dt= t(:flag) + %dd= x.css('flags').text + %dt= t(:protocol) + %dd= x.css('protocol').text + + %dt= t(:algorithm) + %dd= x.css('alg').text + + %dt= t(:public_key) + %dd= x.css('pubKey').text + + - @data.css('keyData').each do |x| + %dl.dl-horizontal %dt= t(:flag) %dd= x.css('flags').text @@ -27,7 +42,7 @@ %dd= x.css('protocol').text %dt= t(:algorithm) - %dd= x.css('keyData > alg').text + %dd= x.css('alg').text %dt= t(:public_key) %dd= x.css('pubKey').text diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 4c5ba2118..8e3997649 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -2444,9 +2444,9 @@ describe 'EPP Domain', epp: true do }) response = epp_plain_request(xml) - response[:results][0][:msg].should start_with + response[:results][0][:msg].should start_with( "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': "\ - "[facet 'enumeration'] The value 'invalidStatus' is not an element of the set " + "[facet 'enumeration'] The value 'invalidStatus' is not an element of the set ") response[:results][0][:result_code].should == '2001' end From dc7b5f481caf74e1bb14aff332a8c746ad653b7c Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 11 Nov 2015 14:34:31 +0200 Subject: [PATCH 40/63] Story#105314040 define contact partial's variable --- app/views/admin/contacts/partials/_domains.haml | 2 +- app/views/admin/contacts/show.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/contacts/partials/_domains.haml b/app/views/admin/contacts/partials/_domains.haml index 026e73c6c..97eee3d5a 100644 --- a/app/views/admin/contacts/partials/_domains.haml +++ b/app/views/admin/contacts/partials/_domains.haml @@ -1,4 +1,4 @@ -- domains = (contact || @contact).all_domains(page: params[:domain_page], per: 20, params: params) +- domains = contact.all_domains(page: params[:domain_page], per: 20, params: params) #contacts.panel.panel-default .panel-heading .pull-left diff --git a/app/views/admin/contacts/show.haml b/app/views/admin/contacts/show.haml index dad8e0e7d..c5d317ccb 100644 --- a/app/views/admin/contacts/show.haml +++ b/app/views/admin/contacts/show.haml @@ -8,7 +8,7 @@ .row .col-md-12= render 'admin/contacts/partials/statuses', contact: @contact .row - .col-md-12= render 'admin/contacts/partials/domains' + .col-md-12= render 'admin/contacts/partials/domains', contact: @contact - if @contact.legal_documents.present? .row From dd68972624a24d8f8a857272e147181e74addcb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Wed, 11 Nov 2015 15:59:48 +0200 Subject: [PATCH 41/63] Update domain.md removed misplaced reference to verified attribute in domain:create transform query --- doc/epp/domain.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/epp/domain.md b/doc/epp/domain.md index e609b934e..79b3f8ed5 100644 --- a/doc/epp/domain.md +++ b/doc/epp/domain.md @@ -20,8 +20,6 @@ Domain name mapping protocol short version: Attribute: unit="y/m/d" Default is 1 year. 1 Contact reference to the registrant - Attribute: - "verified" # optional, allowed values 'yes', 'no' 0-n Contact reference. Admin contact is required if registrant is a juridical person. Attribute: type="admin / tech" 1 From f6110b8319421cd9c8025475cf7b1e01d02de578 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 11 Nov 2015 16:59:20 +0200 Subject: [PATCH 42/63] Story#107571572 can create SEB bank request --- .../stylesheets/registrar/registrar.sass | 9 ++ .../registrar/payments_controller.rb | 13 ++- app/models/bank_link.rb | 83 +++++++++++++++++++ app/views/registrar/payments/pay.html.haml | 10 +++ config/routes.rb | 7 +- 5 files changed, 112 insertions(+), 10 deletions(-) create mode 100644 app/models/bank_link.rb create mode 100644 app/views/registrar/payments/pay.html.haml diff --git a/app/assets/stylesheets/registrar/registrar.sass b/app/assets/stylesheets/registrar/registrar.sass index 9f046237b..601abf5ec 100644 --- a/app/assets/stylesheets/registrar/registrar.sass +++ b/app/assets/stylesheets/registrar/registrar.sass @@ -32,3 +32,12 @@ h1, h2, h3, h4 .semifooter padding: 42px 0 80px 0 + + + +.payment-form + text-align: center + input[type="submit"] + cursor: pointer + top: 50% + position: absolute \ No newline at end of file diff --git a/app/controllers/registrar/payments_controller.rb b/app/controllers/registrar/payments_controller.rb index 368dc7cb9..330ffaa46 100644 --- a/app/controllers/registrar/payments_controller.rb +++ b/app/controllers/registrar/payments_controller.rb @@ -1,26 +1,25 @@ class Registrar::PaymentsController < RegistrarController + protect_from_forgery except: :back + skip_authorization_check # actually anyone can pay, no problems at all skip_before_action :authenticate_user!, :check_ip, only: [:back] before_action :check_bank # to handle existing model we should - # get invoice_id and then get reference_number + # get invoice_id and then get number # build BankTransaction without connection with right reference number # do not connect transaction and invoice def pay invoice = Invoice.find(params[:invoice_id]) - - render text: "You are trying to pay with #{params[:bank]} for #{invoice.reference_no}" + @bank_link = BankLink::Request.new(params[:bank], invoice, self) + @bank_link.make_transaction end - def cancel - - end # connect invoice and transaction # both back and IPN def back - + @bank_link = BankLink::Response.new(params[:bank], params) end private diff --git a/app/models/bank_link.rb b/app/models/bank_link.rb new file mode 100644 index 000000000..4e478770a --- /dev/null +++ b/app/models/bank_link.rb @@ -0,0 +1,83 @@ +class BankLink + module Base + def prepend_size(value) + value = (value || "").to_s.strip + string = "" + string << sprintf("%03i", value.size) + string << value + end + end + + class Request + include Base + include ActionView::Helpers::NumberHelper + + # need controller here in order to handle random ports and domains + # I don't want to do it but has to + attr_accessor :type, :invoice, :controller + def initialize(type, invoice, controller) + @type, @invoice, @controller = type, invoice, controller + end + + def url + ENV["payments_#{type}_url"] + end + + def fields + @fields ||= (hash = {} + hash["VK_SERVICE"] = "1012" + hash["VK_VERSION"] = "008" + hash["VK_SND_ID"] = ENV["payments_#{type}_seller_account"] + hash["VK_STAMP"] = invoice.number + hash["VK_AMOUNT"] = number_with_precision(invoice.sum_cache, :precision => 2, :separator => ".") + hash["VK_CURR"] = invoice.currency + hash["VK_REF"] = "" + hash["VK_MSG"] = "Order nr. #{invoice.number}" + hash["VK_RETURN"] = controller.registrar_return_payment_with_url(type) + hash["VK_CANCEL"] = controller.registrar_return_payment_with_url(type) + hash["VK_DATETIME"] = Time.now.strftime("%Y-%m-%dT%H:%M:%S%z") + hash["VK_MAC"] = calc_mac(hash) + hash["VK_ENCODING"] = "UTF-8" + hash["VK_LANG"] = "ENG" + hash) + end + + def calc_mac(fields) + pars = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_STAMP VK_AMOUNT VK_CURR VK_REF VK_MSG VK_RETURN VK_CANCEL VK_DATETIME) + data = pars.map{|e| prepend_size(fields[e]) }.join + + sign(data) + end + + def make_transaction + transaction = BankTransaction.where(description: fields["VK_MSG"]).first_or_initialize( + reference_no: invoice.reference_no, + currency: invoice.currency, + ) + + transaction.save! + end + + private + def sign(data) + private_key = OpenSSL::PKey::RSA.new(File.read(ENV["payments_#{type}_seller_private"])) + + signed_data = private_key.sign(OpenSSL::Digest::SHA1.new, data) + signed_data = Base64.encode64(signed_data).gsub(/\n|\r/, '') + signed_data + end + end + + + + + class Response + attr_accessor :type, :params + def initialize(type, params) + @type, @params = type, params + end + def bank_public_key + OpenSSL::X509::Certificate.new(certificate).public_key + end + end +end \ No newline at end of file diff --git a/app/views/registrar/payments/pay.html.haml b/app/views/registrar/payments/pay.html.haml new file mode 100644 index 000000000..62f5fb87a --- /dev/null +++ b/app/views/registrar/payments/pay.html.haml @@ -0,0 +1,10 @@ +.payment-form + = form_tag @bank_link.url, method: :post do + - @bank_link.fields.each do |k, v| + = hidden_field_tag k, v + = submit_tag "Mine maksma" + + +:coffeescript + $(document).ready -> + $('.payment-form form').submit() \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 06ff248fe..f5b81e8b5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -92,9 +92,10 @@ Rails.application.routes.draw do end end - get 'pay/:bank' => 'payments#pay', as: 'payment_with' - get 'pay/:bank/cancel' => 'payments#cancel',as: 'cancel_payment_with' - get 'pay/:bank/return' => 'payments#back', as: 'return_payment_with' + + get 'pay/return/:bank' => 'payments#back', as: 'return_payment_with' + post 'pay/return/:bank' => 'payments#back' + get 'pay/go/:bank' => 'payments#pay', as: 'payment_with' end # REGISTRANT ROUTES From 59522cab5a93f44acfff22cc57be7c163cc0e533 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Wed, 11 Nov 2015 17:07:34 +0200 Subject: [PATCH 43/63] Story #104525314 - feature conflict, set admin flag from admin controller' --- app/controllers/admin/pending_deletes_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/admin/pending_deletes_controller.rb b/app/controllers/admin/pending_deletes_controller.rb index d885b3a99..4866d65c9 100644 --- a/app/controllers/admin/pending_deletes_controller.rb +++ b/app/controllers/admin/pending_deletes_controller.rb @@ -6,6 +6,7 @@ class Admin::PendingDeletesController < AdminController authorize! :update, :pending @epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending + @epp_domain.is_admin= true if @epp_domain.apply_pending_delete! redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied) else @@ -16,6 +17,7 @@ class Admin::PendingDeletesController < AdminController def destroy authorize! :destroy, :pending + @epp_domain.is_admin= true if @domain.clean_pendings! redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed) else From a54a15cea4ef3cd00dba0862428a031de9d1bd09 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 12 Nov 2015 09:42:21 +0200 Subject: [PATCH 44/63] handle bank response --- .../registrar/payments_controller.rb | 12 +++ app/models/bank_link.rb | 80 +++++++++++++++++-- config/application-example.yml | 3 + 3 files changed, 90 insertions(+), 5 deletions(-) diff --git a/app/controllers/registrar/payments_controller.rb b/app/controllers/registrar/payments_controller.rb index 330ffaa46..674b8afed 100644 --- a/app/controllers/registrar/payments_controller.rb +++ b/app/controllers/registrar/payments_controller.rb @@ -20,6 +20,18 @@ class Registrar::PaymentsController < RegistrarController # both back and IPN def back @bank_link = BankLink::Response.new(params[:bank], params) + if @bank_link.valid? + @bank_link.complete_payment + + if @bank_link.invoice.binded? + flash[:notice] = t(:pending_applieds) + else + flash[:error] = t(:something_wrong) + end + else + flash[:error] = t(:something_wrong) + end + redirect_to registrar_invoice_path(@bank_link.invoice) end private diff --git a/app/models/bank_link.rb b/app/models/bank_link.rb index 4e478770a..b28611542 100644 --- a/app/models/bank_link.rb +++ b/app/models/bank_link.rb @@ -43,7 +43,8 @@ class BankLink end def calc_mac(fields) - pars = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_STAMP VK_AMOUNT VK_CURR VK_REF VK_MSG VK_RETURN VK_CANCEL VK_DATETIME) + pars = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_STAMP VK_AMOUNT VK_CURR VK_REF + VK_MSG VK_RETURN VK_CANCEL VK_DATETIME).freeze data = pars.map{|e| prepend_size(fields[e]) }.join sign(data) @@ -52,7 +53,8 @@ class BankLink def make_transaction transaction = BankTransaction.where(description: fields["VK_MSG"]).first_or_initialize( reference_no: invoice.reference_no, - currency: invoice.currency, + currency: invoice.currency, + iban: invoice.seller_iban ) transaction.save! @@ -72,12 +74,80 @@ class BankLink class Response - attr_accessor :type, :params + include Base + include ActionView::Helpers::NumberHelper + + attr_accessor :type, :params, :invoice def initialize(type, params) @type, @params = type, params + + @invoice = Invoice.find_by(number: params["VK_STAMP"]) if params["VK_STAMP"].present? end - def bank_public_key - OpenSSL::X509::Certificate.new(certificate).public_key + + def valid? + !!validate + end + + def complete_payment + if valid? + transaction = BankTransaction.find_by(description: params["VK_MSG"]) + transaction.sum = BigDecimal.new(params["VK_AMOUNT"].to_s) + transaction.bank_reference = params['VK_T_NO'] + transaction.buyer_bank_code = params["VK_SND_ID"] + transaction.buyer_iban = params["VK_SND_ACC"] + transaction.buyer_name = params["VK_SND_NAME"] + transaction.paid_at = Time.parse(params["VK_T_DATETIME"]) + + transaction.autobind_invoice + end + end + + + + def validate + case params["VK_SERVICE"] + when "1111" + validate_success && validate_amount && validate_currency + when "1911" + validate_cancel + else + false + end + end + + def validate_success + pars = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP VK_T_NO VK_AMOUNT VK_CURR + VK_REC_ACC VK_REC_NAME VK_SND_ACC VK_SND_NAME VK_REF VK_MSG VK_T_DATETIME).freeze + + @validate_success ||= ( + data = pars.map{|e| prepend_size(params[e]) }.join + verify_mac(data, params["VK_MAC"]) + ) + end + + def validate_cancel + pars = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP VK_REF VK_MSG).freeze + @validate_cancel ||= ( + data = pars.map{|e| prepend_size(params[e]) }.join + verify_mac(data, params["VK_MAC"]) + ) + end + + def validate_amount + source = number_with_precision(BigDecimal.new(params["VK_AMOUNT"].to_s), precision: 2, separator: ".") + target = number_with_precision(invoice.sum_cache, precision: 2, separator: ".") + + source == target + end + + def validate_currency + invoice.currency == params["VK_CURR"] + end + + + def verify_mac(data, mac) + bank_public_key = OpenSSL::X509::Certificate.new(File.read(ENV["payments_#{type}_bank_certificate"])).public_key + bank_public_key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(mac), data) end end end \ No newline at end of file diff --git a/config/application-example.yml b/config/application-example.yml index 7b252e782..cce71e3a4 100644 --- a/config/application-example.yml +++ b/config/application-example.yml @@ -116,12 +116,15 @@ payments_banks: > payments_seb_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r' payments_seb_bank_certificate: 'eyp_pub.pem' payments_seb_seller_private: 'kaupmees_priv.pem' +payments_seb_seller_account: 'testvpos' payments_swed_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r' payments_swed_bank_certificate: 'eyp_pub.pem' payments_swed_seller_private: 'kaupmees_priv.pem' +payments_swed_seller_account: 'testvpos' payments_lhv_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r' payments_lhv_bank_certificate: 'eyp_pub.pem' payments_lhv_seller_private: 'kaupmees_priv.pem' +payments_lhv_seller_account: 'testvpos' # # AUTOTEST overwrites From 07c2d58554ef3153d896544440062b623c8a3c7e Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Thu, 12 Nov 2015 10:54:31 +0200 Subject: [PATCH 45/63] Story #105839906 - remove duplication information and dependancy on pending_json[domain] from PaperTrail.changes, containing copy of pending_json[frame] --- app/models/domain.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 7b744b03c..d3bdc2ac2 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -422,7 +422,6 @@ class Domain < ActiveRecord::Base pending_json_cache = pending_json token = registrant_verification_token asked_at = registrant_verification_asked_at - changes_cache = changes new_registrant_id = registrant.id new_registrant_email = registrant.email new_registrant_name = registrant.name @@ -436,7 +435,6 @@ class Domain < ActiveRecord::Base self.registrant_verification_token = token self.registrant_verification_asked_at = asked_at set_pending_update - pending_json['domain'] = changes_cache pending_json['new_registrant_id'] = new_registrant_id pending_json['new_registrant_email'] = new_registrant_email pending_json['new_registrant_name'] = new_registrant_name @@ -562,8 +560,8 @@ class Domain < ActiveRecord::Base def pending_registrant return '' if pending_json.blank? - return '' if pending_json['domain']['registrant_id'].blank? - Registrant.find_by(id: pending_json['domain']['registrant_id'].last) + return '' if pending_json['new_registrant_id'].blank? + Registrant.find_by(id: pending_json['new_registrant_id'].last) end def generate_auth_info From 157daa629b623ee33bcb184eeb137df52496cd12 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 12 Nov 2015 18:16:21 +0200 Subject: [PATCH 46/63] 107279016-reserved domains import --- ...60452_add_legacy_id_to_reserved_domains.rb | 5 +++ lib/tasks/import.rake | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 db/migrate/20151112160452_add_legacy_id_to_reserved_domains.rb diff --git a/db/migrate/20151112160452_add_legacy_id_to_reserved_domains.rb b/db/migrate/20151112160452_add_legacy_id_to_reserved_domains.rb new file mode 100644 index 000000000..dd3c3a5b7 --- /dev/null +++ b/db/migrate/20151112160452_add_legacy_id_to_reserved_domains.rb @@ -0,0 +1,5 @@ +class AddLegacyIdToReservedDomains < ActiveRecord::Migration + def change + add_column :reserved_domains, :legacy_id, :integer + end +end diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 313d3216d..3ed468efe 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -274,6 +274,42 @@ namespace :import do puts "-----> Imported #{count} new contacts in #{(Time.zone.now.to_f - start).round(2)} seconds" end + desc 'Import reserved' + task reserved: :environment do + start = Time.zone.now.to_f + puts '-----> Importing reserved domains...' + + reserved_domains = [] + count = 0 + + existing_ids = ReservedDomain.pluck(:legacy_id) + + Legacy::Domain.includes( + :object_registry, + :object + ).find_each(batch_size: 1).with_index do |x, index| + + next if existing_ids.include?(x.id) || Registrar.find_by(legacy_id: x.object.try(:clid)).try(:name) == 'eedirect' + count += 1 + + reserved_domains << ReservedDomain.new({ + created_at: x.object_registry.try(:crdate), + updated_at: x.object.read_attribute(:update).nil? ? x.object_registry.try(:crdate) : x.object.read_attribute(:update), + creator_str: x.object_registry.try(:registrar).try(:name), + updator_str: x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name), + names: '"' + x.object_registry.name.try(:strip) + '"=>"' + SecureRandom.hex + '"', + legacy_id: x.id + }) + + if index % 1 == 0 && index != 0 + ReservedDomain.import reserved_domains, {validate: false, timestamps: false} + reserved_domains = [] + end + end + ReservedDomain.import reserved_domains, {validate: false, timestamps: false} + puts "-----> Imported #{count} new reserved domains in #{(Time.zone.now.to_f - start).round(2)} seconds" + end + desc 'Import domains' task domains: :environment do start = Time.zone.now.to_f From e5b3495f3718eb2a1326fe5886de8fde6e714a24 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 12 Nov 2015 18:21:47 +0200 Subject: [PATCH 47/63] 107279016-bach size changed --- lib/tasks/import.rake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 3ed468efe..c0d5692f2 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -54,6 +54,7 @@ namespace :import do Rake::Task['import:registrars'].invoke Rake::Task['import:users'].invoke Rake::Task['import:contacts'].invoke + Rake::Task['import:reserved'].invoke Rake::Task['import:domains'].invoke Rake::Task['import:zones'].invoke end @@ -287,7 +288,7 @@ namespace :import do Legacy::Domain.includes( :object_registry, :object - ).find_each(batch_size: 1).with_index do |x, index| + ).find_each(batch_size: 1000).with_index do |x, index| next if existing_ids.include?(x.id) || Registrar.find_by(legacy_id: x.object.try(:clid)).try(:name) == 'eedirect' count += 1 @@ -301,7 +302,7 @@ namespace :import do legacy_id: x.id }) - if index % 1 == 0 && index != 0 + if index % 1000 == 0 && index != 0 ReservedDomain.import reserved_domains, {validate: false, timestamps: false} reserved_domains = [] end From 4ad1784f17290c2e6a70741438510e2b5b309237 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 12 Nov 2015 18:33:06 +0200 Subject: [PATCH 48/63] 105361584-xml respone fix --- app/views/epp/contacts/info.xml.builder | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/views/epp/contacts/info.xml.builder b/app/views/epp/contacts/info.xml.builder index ea6306839..e890e0fb6 100644 --- a/app/views/epp/contacts/info.xml.builder +++ b/app/views/epp/contacts/info.xml.builder @@ -15,7 +15,6 @@ xml.epp_head do xml.tag!('contact:postalInfo', type: 'int') do xml.tag!('contact:name', @contact.name) - if can? :view_full_info, @contact, @password xml.tag!('contact:org', @contact.org_name) if @contact.org_name.present? xml.tag!('contact:addr') do xml.tag!('contact:street', @contact.street) @@ -24,14 +23,11 @@ xml.epp_head do xml.tag!('contact:pc', @contact.zip) xml.tag!('contact:cc', @contact.country_code) end - end end - if can? :view_full_info, @contact, @password xml.tag!('contact:voice', @contact.phone) xml.tag!('contact:fax', @contact.fax) if @contact.fax.present? xml.tag!('contact:email', @contact.email) - end xml.tag!('contact:clID', @contact.registrar.try(:name)) if @contact.creator.try(:registrar).blank? && Rails.env.test? From 34363ca8784ed4467f7ba8d48dfc61b11130f3ce Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 13 Nov 2015 13:11:52 +0200 Subject: [PATCH 49/63] 107279016-condition typo --- lib/tasks/import.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index c0d5692f2..2bdcd71d7 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -290,7 +290,7 @@ namespace :import do :object ).find_each(batch_size: 1000).with_index do |x, index| - next if existing_ids.include?(x.id) || Registrar.find_by(legacy_id: x.object.try(:clid)).try(:name) == 'eedirect' + next if existing_ids.include?(x.id) || Registrar.find_by(legacy_id: x.object.try(:clid)).try(:name) != 'eedirect' count += 1 reserved_domains << ReservedDomain.new({ From 46e502080fe8e78999986765204c8be6a39171d5 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 13 Nov 2015 15:09:04 +0200 Subject: [PATCH 50/63] Story#107279016 - admin shows all reserved domains line by line --- .../admin/reserved_domains_controller.rb | 28 +++++++++++++++---- app/models/reserved_domain.rb | 10 ++++++- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/reserved_domains_controller.rb b/app/controllers/admin/reserved_domains_controller.rb index 430fb9d8a..57e4b8ed3 100644 --- a/app/controllers/admin/reserved_domains_controller.rb +++ b/app/controllers/admin/reserved_domains_controller.rb @@ -2,9 +2,9 @@ class Admin::ReservedDomainsController < AdminController load_and_authorize_resource def index - rd = ReservedDomain.first_or_initialize - rd.names = nil if rd.names.blank? - @reserved_domains = rd.names.to_yaml.gsub(/---.?\n/, '').gsub(/\.\.\..?\n/, '') + names = ReservedDomain.pluck(:names).each_with_object({}){|e_h,h| h.merge!(e_h)} + names.names = nil if names.blank? + @reserved_domains = names.to_yaml.gsub(/---.?\n/, '').gsub(/\.\.\..?\n/, '') end def create @@ -20,9 +20,27 @@ class Admin::ReservedDomainsController < AdminController render :index and return end - rd = ReservedDomain.first_or_create + result = true + ReservedDomain.transaction do + # removing old ones + existing = ReservedDomain.any_of_domains(names.keys).pluck(:id) + ReservedDomain.where.not(id: existing).delete_all - if rd.update(names: names) + #updating and adding + names.each do |name, psw| + rec = ReservedDomain.by_domain(name).first + rec ||= ReservedDomain.new + rec.names = {name => psw} + + unless rec.save + result = false + raise ActiveRecord::Rollback + end + end + end + + + if result flash[:notice] = I18n.t('record_updated') redirect_to :back else diff --git a/app/models/reserved_domain.rb b/app/models/reserved_domain.rb index 6684d6541..936c744bf 100644 --- a/app/models/reserved_domain.rb +++ b/app/models/reserved_domain.rb @@ -9,7 +9,15 @@ class ReservedDomain < ActiveRecord::Base class << self def pw_for(domain_name) - select("names -> '#{domain_name}' AS pw").first.try(:pw) + by_domain(domain_name).select("names -> '#{domain_name}' AS pw").first.try(:pw) + end + + def by_domain name + where("names ? '#{name}'") + end + + def any_of_domains names + where("names ?| ARRAY['#{names.join("','")}']") end end end From 2803a848158fc6620af5e6ad315c41ea520d7526 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 13 Nov 2015 15:49:13 +0200 Subject: [PATCH 51/63] 105361584-no access added --- app/views/epp/contacts/info.xml.builder | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/views/epp/contacts/info.xml.builder b/app/views/epp/contacts/info.xml.builder index e890e0fb6..d29e60298 100644 --- a/app/views/epp/contacts/info.xml.builder +++ b/app/views/epp/contacts/info.xml.builder @@ -15,6 +15,7 @@ xml.epp_head do xml.tag!('contact:postalInfo', type: 'int') do xml.tag!('contact:name', @contact.name) + if can? :view_full_info, @contact, @password xml.tag!('contact:org', @contact.org_name) if @contact.org_name.present? xml.tag!('contact:addr') do xml.tag!('contact:street', @contact.street) @@ -23,11 +24,27 @@ xml.epp_head do xml.tag!('contact:pc', @contact.zip) xml.tag!('contact:cc', @contact.country_code) end + else + xml.tag!('contact:org', 'No access') + xml.tag!('contact:addr') do + xml.tag!('contact:street', 'No access') + xml.tag!('contact:city', 'No access') + xml.tag!('contact:sp', 'No access') + xml.tag!('contact:pc', 'No access') + xml.tag!('contact:cc', 'No access') + end + end end + if can? :view_full_info, @contact, @password xml.tag!('contact:voice', @contact.phone) xml.tag!('contact:fax', @contact.fax) if @contact.fax.present? xml.tag!('contact:email', @contact.email) + else + xml.tag!('contact:voice', 'No access') + xml.tag!('contact:fax', 'No access') + xml.tag!('contact:email', 'No access') + end xml.tag!('contact:clID', @contact.registrar.try(:name)) if @contact.creator.try(:registrar).blank? && Rails.env.test? From 46230310603085cf7f2903a193fa4fb0591e9d15 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 13 Nov 2015 15:57:45 +0200 Subject: [PATCH 52/63] 105361584-no acces for country --- app/models/depp/contact.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/depp/contact.rb b/app/models/depp/contact.rb index 0fa9f777a..b4597867c 100644 --- a/app/models/depp/contact.rb +++ b/app/models/depp/contact.rb @@ -280,7 +280,7 @@ module Depp end def country_name - Country.new(country_code) + Country.new(country_code) || 'No access' end def org? From 78e4016d3dd2793514855722dac78680e6628a6d Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 13 Nov 2015 16:20:45 +0200 Subject: [PATCH 53/63] 105361584-no access for ident and pass --- app/views/epp/contacts/info.xml.builder | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/views/epp/contacts/info.xml.builder b/app/views/epp/contacts/info.xml.builder index d29e60298..24b37a13f 100644 --- a/app/views/epp/contacts/info.xml.builder +++ b/app/views/epp/contacts/info.xml.builder @@ -62,6 +62,10 @@ xml.epp_head do xml.tag!('contact:authInfo') do xml.tag!('contact:pw', @contact.auth_info) end + else + xml.tag!('contact:authInfo') do + xml.tag!('contact:pw', 'No access') + end end # xml << render('/epp/contacts/disclosure_policy') end @@ -73,6 +77,12 @@ xml.epp_head do type: @contact.ident_type, cc: @contact.ident_country_code) end end + else + xml.tag!('extension') do + xml.tag!('eis:extdata', 'xmlns:eis' => 'https://epp.tld.ee/schema/eis-1.0.xsd') do + xml.tag!('eis:ident', 'No access') + end + end end render('epp/shared/trID', builder: xml) From 5ae8732b419e7a89be33abdefb4bb54070209181 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 13 Nov 2015 16:40:54 +0200 Subject: [PATCH 54/63] 105361584-ident changes --- app/helpers/application_helper.rb | 9 +++++++-- app/views/epp/contacts/info.xml.builder | 6 ------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 751e1d998..9646bd5c9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -23,8 +23,13 @@ module ApplicationHelper case ident_type when 'birthday' "#{ident} [#{ident_type}]" - else - "#{ident} [#{ident_country_code} #{ident_type}]" + else + if ident + "#{ident} [#{ident_country_code} #{ident_type}]" + else + "[No access]" + end + end end diff --git a/app/views/epp/contacts/info.xml.builder b/app/views/epp/contacts/info.xml.builder index 24b37a13f..18019208a 100644 --- a/app/views/epp/contacts/info.xml.builder +++ b/app/views/epp/contacts/info.xml.builder @@ -77,12 +77,6 @@ xml.epp_head do type: @contact.ident_type, cc: @contact.ident_country_code) end end - else - xml.tag!('extension') do - xml.tag!('eis:extdata', 'xmlns:eis' => 'https://epp.tld.ee/schema/eis-1.0.xsd') do - xml.tag!('eis:ident', 'No access') - end - end end render('epp/shared/trID', builder: xml) From 8954db689c0beaa5ec78aad202a7e6c812be7d70 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 13 Nov 2015 17:14:31 +0200 Subject: [PATCH 55/63] logic fix --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9646bd5c9..098c10d9b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -24,7 +24,7 @@ module ApplicationHelper when 'birthday' "#{ident} [#{ident_type}]" else - if ident + if ident.present? "#{ident} [#{ident_country_code} #{ident_type}]" else "[No access]" From 8b7b8182ca5daf112bfbff71b46f06210335a994 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 13 Nov 2015 19:48:46 +0200 Subject: [PATCH 56/63] User import changes --- lib/tasks/import.rake | 78 ++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index f743262c0..d8a915d2a 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -127,61 +127,69 @@ namespace :import do desc 'Import users' task users: :environment do start = Time.zone.now.to_f - puts '-----> Importing users...' + puts "-----> Importing users and IP's..." + id_users = [] users = [] ips = [] + temp = [] existing_ids = ApiUser.pluck(:legacy_id) - - count = 0 + existing_ips = WhiteIp.pluck(:ipv4) Legacy::Registrar.all.each do |x| - next if existing_ids.include?(x.id) - count += 1 + x.acl.all.each do |y| - if x.acl.last.try(:cert) != 'pki' - if x.acl.last.try(:cert) != 'idkaart' - users << ApiUser.new({ - username: x.handle.try(:strip), - password: x.acl.last.try(:password) ? x.acl.last.try(:password) : ('a'..'z').to_a.shuffle.first(8).join, - identity_code: x.handle.try(:strip), - registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), - roles: ['epp'], - legacy_id: x.try(:id) - }) - elsif x.acl.last.try(:cert) == 'idkaart' - users << ApiUser.new({ - username: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), - password: ('a'..'z').to_a.shuffle.first(8).join, - identity_code: x.acl.last.try(:password) ? x.acl.last.try(:password) : x.acl.first.try(:password), - registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), - roles: ['billing'], - legacy_id: x.try(:id) - }) - end - end + next if existing_ids.include?(y.id) - existing_ips = WhiteIp.pluck(:ipv4) + if y.try(:cert) != 'pki' - x.acl.all.each do |y| - next if existing_ips.include?(y.ipaddr) - if !y.ipaddr.nil? && y.ipaddr != '' - ips << WhiteIp.new({ + if y.try(:cert) == 'idkaart' + id_users << ApiUser.new({ + username: y.try(:password) ? y.try(:password) : y.try(:password), + password: ('a'..'z').to_a.shuffle.first(8).join, + identity_code: y.try(:password) ? y.try(:password) : y.try(:password), registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), - ipv4: y.ipaddr, - interfaces: ['api', 'registrar'] - }) + roles: ['billing'], + legacy_id: y.try(:id) + }) + else + temp << ApiUser.new({ + username: x.handle.try(:strip), + password: y.try(:password) ? y.try(:password) : ('a'..'z').to_a.shuffle.first(8).join, + registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), + roles: ['epp'], + legacy_id: y.try(:id) + }) end end + temp = temp.reverse!.uniq{|u| u.username } + end + users = temp + + x.acl.all.each do |y| + next if existing_ips.include?(y.ipaddr) + if !y.ipaddr.nil? && y.ipaddr != '' + ips << WhiteIp.new({ + registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id), + ipv4: y.ipaddr, + interfaces: ['api', 'registrar'] + }) + end + end end + ApiUser.import id_users, validate: false ApiUser.import users, validate: false + if ips WhiteIp.import ips, validate: false end - puts "-----> Imported #{count} new users in #{(Time.zone.now.to_f - start).round(2)} seconds" + + puts "-----> Imported #{id_users.count} billing users and #{users.count} epp users" + puts "-----> Imported #{ips.count} white IP's in #{(Time.zone.now.to_f - start).round(2)} seconds" + end desc 'Import contacts' From fc5dbd35236db3d6e8d04061a332f9829524e032 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 16 Nov 2015 10:59:26 +0200 Subject: [PATCH 57/63] Story#107571572 - banklinks workflow fixes --- app/controllers/registrar/payments_controller.rb | 8 ++++---- app/models/bank_link.rb | 4 ++++ config/locales/en.yml | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/registrar/payments_controller.rb b/app/controllers/registrar/payments_controller.rb index 674b8afed..931dffcf2 100644 --- a/app/controllers/registrar/payments_controller.rb +++ b/app/controllers/registrar/payments_controller.rb @@ -20,16 +20,16 @@ class Registrar::PaymentsController < RegistrarController # both back and IPN def back @bank_link = BankLink::Response.new(params[:bank], params) - if @bank_link.valid? + if @bank_link.valid? && @bank_link.ok? @bank_link.complete_payment if @bank_link.invoice.binded? - flash[:notice] = t(:pending_applieds) + flash[:notice] = t(:pending_applied) else - flash[:error] = t(:something_wrong) + flash[:alert] = t(:something_wrong) end else - flash[:error] = t(:something_wrong) + flash[:alert] = t(:something_wrong) end redirect_to registrar_invoice_path(@bank_link.invoice) end diff --git a/app/models/bank_link.rb b/app/models/bank_link.rb index b28611542..31be3e222 100644 --- a/app/models/bank_link.rb +++ b/app/models/bank_link.rb @@ -88,6 +88,10 @@ class BankLink !!validate end + def ok? + params["VK_SERVICE"] == "1111" + end + def complete_payment if valid? transaction = BankTransaction.find_by(description: params["VK_MSG"]) diff --git a/config/locales/en.yml b/config/locales/en.yml index 7a562afa6..937096ad6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -656,7 +656,7 @@ en: m_id: 'M-ID' pending_removed: Pending was successfully removed. pending_applied: Pending was successfully applied. - something_wrong: Not success, something went wrong + something_wrong: Sorry, something went wrong failure: Not success not_found: Not found no_connection_to_registry: Connection issue to the registry EPP or REPP server! Please try again later. From b05ce36ea392a3757d055009fab743a76fa2fc6d Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 16 Nov 2015 17:13:55 +0200 Subject: [PATCH 58/63] Story#105747240 - remove legal documents from domain history --- app/controllers/epp/domains_controller.rb | 7 ------- app/models/epp/domain.rb | 10 +++++++++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index a5889b8bb..85502f0b3 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -51,10 +51,6 @@ class Epp::DomainsController < EppController authorize! :update, @domain, @password begin if @domain.update(params[:parsed_frame], current_user) - - @domain.attach_legal_document(Epp::Domain.parse_legal_document_from_frame(params[:parsed_frame])) - @domain.save(validate: false) - if @domain.epp_pending_update.present? render_epp_response '/epp/domains/success_pending' else @@ -75,9 +71,6 @@ class Epp::DomainsController < EppController handle_errors(@domain) and return unless @domain.can_be_deleted? - @domain.attach_legal_document(Epp::Domain.parse_legal_document_from_frame(params[:parsed_frame])) - @domain.save(validate: false) - if @domain.epp_destroy(params[:parsed_frame], current_user.id) if @domain.epp_pending_delete.present? render_epp_response '/epp/domains/success_pending' diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 9a9e51b4e..6752f1e01 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -439,6 +439,10 @@ class Epp::Domain < Domain at.deep_merge!(attrs_from(frame.css('chg'), current_user, 'chg')) 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? + end + at_add = attrs_from(frame.css('add'), current_user) at[:nameservers_attributes] += at_add[:nameservers_attributes] @@ -503,7 +507,7 @@ class Epp::Domain < Domain def attach_legal_document(legal_document_data) return unless legal_document_data - legal_documents.build( + legal_documents.create( document_type: legal_document_data[:type], body: legal_document_data[:body] ) @@ -512,6 +516,10 @@ class Epp::Domain < Domain def epp_destroy(frame, user_id) return false unless valid? + if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) + frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + end + if Setting.request_confirmation_on_domain_deletion_enabled && frame.css('delete').children.css('delete').attr('verified').to_s.downcase != 'yes' From c0960e9184183f5cbd058deaf6389f2065a51628 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Tue, 17 Nov 2015 12:09:16 +0200 Subject: [PATCH 59/63] Story #105839906 -- drop Version and log_legal_documents from legal_documents --- app/models/concerns/version_creator.rb | 33 +++++++++++++++++++ app/models/legal_document.rb | 3 +- ...20151117081204_drop_log_legal_documents.rb | 12 +++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 app/models/concerns/version_creator.rb create mode 100644 db/migrate/20151117081204_drop_log_legal_documents.rb diff --git a/app/models/concerns/version_creator.rb b/app/models/concerns/version_creator.rb new file mode 100644 index 000000000..45a1c424a --- /dev/null +++ b/app/models/concerns/version_creator.rb @@ -0,0 +1,33 @@ +module VersionCreator + extend ActiveSupport::Concern + + included do + before_create :add_creator + + def add_creator + self.creator_str = ::PaperTrail.whodunnit + true + end + + def add_updator + self.updator_str = ::PaperTrail.whodunnit + true + end + + # returns a user object for a reference + def creator + return nil if creator_str.blank? + + if creator_str =~ /^\d+-AdminUser:/ + creator = AdminUser.find_by(id: creator_str) + elsif creator_str =~ /^\d+-ApiUser:/ + creator = ApiUser.find_by(id: creator_str) + elsif creator_str =~ /^\d+-api-/ # depricated + creator = ApiUser.find_by(id: creator_str) + end + + creator.present? ? creator : creator_str + end + end + +end \ No newline at end of file diff --git a/app/models/legal_document.rb b/app/models/legal_document.rb index f1a63e976..49c0b2730 100644 --- a/app/models/legal_document.rb +++ b/app/models/legal_document.rb @@ -1,5 +1,6 @@ class LegalDocument < ActiveRecord::Base - include Versions # version/legal_document_version.rb + extend VersionCreator + belongs_to :documentable, polymorphic: true if ENV['legal_document_types'].present? diff --git a/db/migrate/20151117081204_drop_log_legal_documents.rb b/db/migrate/20151117081204_drop_log_legal_documents.rb new file mode 100644 index 000000000..45802ea0e --- /dev/null +++ b/db/migrate/20151117081204_drop_log_legal_documents.rb @@ -0,0 +1,12 @@ +class DropLogLegalDocuments < ActiveRecord::Migration + def up + drop_table :log_legal_documents + remove_column :legal_documents, :updated_at + remove_column :legal_documents, :updator_str + end + + def down + # removed concern Version, which removed LegalDocumentVersion + fail ActiveRecord::IrreversibleMigration + end +end From 72a6394f5793924a36f43be30873fed15610c7b6 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 17 Nov 2015 12:46:01 +0200 Subject: [PATCH 60/63] 108078584-import_conditions_change --- lib/tasks/import.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 2bdcd71d7..49a4dd6b1 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -393,7 +393,7 @@ namespace :import do :domain_contact_maps, nsset: { hosts: :host_ipaddr_maps } ).find_each(batch_size: 10000).with_index do |x, index| - next if existing_domain_ids.include?(x.id) + next if existing_domain_ids.include?(x.id) || Registrar.find_by(legacy_id: x.object.try(:clid)).try(:name) == 'eedirect' count += 1 begin From 18517fd10c2a7d93ee8695196025071950ddbf18 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 17 Nov 2015 13:14:16 +0200 Subject: [PATCH 61/63] 107997032-whois_domain_delete --- app/models/domain.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/domain.rb b/app/models/domain.rb index 7237a24ed..8d5949192 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -301,12 +301,14 @@ class Domain < ActiveRecord::Base c = 0 Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x| + Whois::Record.where('domain_id = ?', x.id).try(':destroy') x.destroy STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: by deleteCandidate ##{x.id} (#{x.name})\n" unless Rails.env.test? c += 1 end Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| + Whois::Record.where('domain_id = ?', x.id).try(':destroy') x.destroy STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test? c += 1 From 3f17f728eb9c475887bd6eec7f95e6cb020216ee Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 17 Nov 2015 14:44:10 +0200 Subject: [PATCH 62/63] Stroy#105839906 more cleanup to remove legal_documents_versions + some code reading-refactorings --- app/models/concerns/version_creator.rb | 33 ------------------- app/models/legal_document.rb | 19 +++++++---- app/models/version/legal_document_version.rb | 5 --- ...20151117081204_drop_log_legal_documents.rb | 3 +- 4 files changed, 14 insertions(+), 46 deletions(-) delete mode 100644 app/models/concerns/version_creator.rb delete mode 100644 app/models/version/legal_document_version.rb diff --git a/app/models/concerns/version_creator.rb b/app/models/concerns/version_creator.rb deleted file mode 100644 index 45a1c424a..000000000 --- a/app/models/concerns/version_creator.rb +++ /dev/null @@ -1,33 +0,0 @@ -module VersionCreator - extend ActiveSupport::Concern - - included do - before_create :add_creator - - def add_creator - self.creator_str = ::PaperTrail.whodunnit - true - end - - def add_updator - self.updator_str = ::PaperTrail.whodunnit - true - end - - # returns a user object for a reference - def creator - return nil if creator_str.blank? - - if creator_str =~ /^\d+-AdminUser:/ - creator = AdminUser.find_by(id: creator_str) - elsif creator_str =~ /^\d+-ApiUser:/ - creator = ApiUser.find_by(id: creator_str) - elsif creator_str =~ /^\d+-api-/ # depricated - creator = ApiUser.find_by(id: creator_str) - end - - creator.present? ? creator : creator_str - end - end - -end \ No newline at end of file diff --git a/app/models/legal_document.rb b/app/models/legal_document.rb index 49c0b2730..f9d4cb4eb 100644 --- a/app/models/legal_document.rb +++ b/app/models/legal_document.rb @@ -1,17 +1,19 @@ class LegalDocument < ActiveRecord::Base - extend VersionCreator - - belongs_to :documentable, polymorphic: true - 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) + TYPES = %w(pdf bdoc ddoc zip rar gz tar 7z odt doc docx).freeze end attr_accessor :body - before_save :save_to_filesystem + belongs_to :documentable, polymorphic: true + + before_create :add_creator + before_save :save_to_filesystem + + + def save_to_filesystem loop do rand = SecureRandom.random_number.to_s.last(4) @@ -26,4 +28,9 @@ class LegalDocument < ActiveRecord::Base File.open(path, 'wb') { |f| f.write(Base64.decode64(body)) } unless Rails.env.test? self.path = path end + + def add_creator + self.creator_str = ::PaperTrail.whodunnit + true + end end diff --git a/app/models/version/legal_document_version.rb b/app/models/version/legal_document_version.rb deleted file mode 100644 index d812b9720..000000000 --- a/app/models/version/legal_document_version.rb +++ /dev/null @@ -1,5 +0,0 @@ -class LegalDocumentVersion < PaperTrail::Version - include VersionSession - self.table_name = :log_legal_documents - self.sequence_name = :log_legal_documents_id_seq -end diff --git a/db/migrate/20151117081204_drop_log_legal_documents.rb b/db/migrate/20151117081204_drop_log_legal_documents.rb index 45802ea0e..2746a5d11 100644 --- a/db/migrate/20151117081204_drop_log_legal_documents.rb +++ b/db/migrate/20151117081204_drop_log_legal_documents.rb @@ -6,7 +6,6 @@ class DropLogLegalDocuments < ActiveRecord::Migration end def down - # removed concern Version, which removed LegalDocumentVersion - fail ActiveRecord::IrreversibleMigration + # we don't want it back end end From 01a9ade5c046c368dbdb69d903cebf18fbfaedfc Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 17 Nov 2015 14:46:21 +0200 Subject: [PATCH 63/63] Stroy#105839906 domain log saves under children_log only ids, not whole objects --- app/models/domain.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index d3bdc2ac2..19b987eb4 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -753,11 +753,11 @@ class Domain < ActiveRecord::Base def children_log log = HashWithIndifferentAccess.new - log[:admin_contacts] = admin_contacts.map(&:attributes) - log[:tech_contacts] = tech_contacts.map(&:attributes) - log[:nameservers] = nameservers.map(&:attributes) - log[:registrant] = [registrant.try(:attributes)] - log[:domain_statuses] = domain_statuses.map(&:attributes) + log[:admin_contacts] = admin_contact_ids + log[:tech_contacts] = tech_contact_ids + log[:nameservers] = nameserver_ids + log[:registrant] = [registrant_id] + log[:domain_statuses] = domain_status_ids log end