Merge branch 'master' into registry-790

This commit is contained in:
Artur Beljajev 2018-06-04 04:02:33 +03:00
commit 65b40997ca
51 changed files with 556 additions and 303 deletions

View file

@ -2,3 +2,6 @@ inherit_from: .rubocop_todo.yml
Style/Alias: Style/Alias:
EnforcedStyle: prefer_alias_method EnforcedStyle: prefer_alias_method
Style/FrozenStringLiteralComment:
Enabled: false

View file

@ -1 +1 @@
2.2.7 2.3.7

View file

@ -1,3 +1,31 @@
25.05.2018
* GDPR: updated whois templates with configurable disclaimer [#795](https://github.com/internetee/registry/issues/795)
* GDPR: email forwarding solution to contact private domain registrants without revealing their email addresses [#824](https://github.com/internetee/registry/issues/824)
* EPP: added support for additional digitally signed doc formats like asice, sce, asics, scs, edoc, adoc [#840](https://github.com/internetee/registry/issues/840)
* Registrar: removed handling of newlines from contact form street field [#836](https://github.com/internetee/registry/issues/836)
* Ruby upgrade to version 2.3.7 [#546](https://github.com/internetee/registry/issues/546)
* Devise upgrade to version 4.4.3 [#847](https://github.com/internetee/registry/pull/847)
* Added extra logging to debug Directo integration [#848](https://github.com/internetee/registry/pull/848)
30.04.2018
* Upgrade Ruby on Rails to version 4.2.10 [#826](https://github.com/internetee/registry/issues/826)
* BUG: Admin - fixed internal error in domain_versions and contact_versions views caused by removed db column [#830](https://github.com/internetee/registry/issues/830)
23.04.2018
* WHOIS: domains with deleteCandidate status do not return registration details as domains waiting to be deleted [#789](https://github.com/internetee/registry/issues/789)
* Security: Nokigiri gem update to version 1.8.2 [#823](https://github.com/internetee/registry/pull/823)
* Bug: fixed missing translation error in admin mail templates page [#818](https://github.com/internetee/registry/pull/818)
* Admin: VAT percentage info to registrar profile for setting tax rate for foreign non vat liable registrars [#623](https://github.com/internetee/registry/issues/623)
* Admin: deleteCandidate status is now stressed in domain details view [#792](https://github.com/internetee/registry/issues/792)
* Removed invoice_type from invoice db data as unused [#772](https://github.com/internetee/registry/issues/772)
* Removed valid_from from domain db data as duplicated and unused [#787](https://github.com/internetee/registry/issues/787)
* Set Not null constraint to valid_ti domain db data [#800](https://github.com/internetee/registry/issues/800)
* Removed unused methods [#797](https://github.com/internetee/registry/issues/797)
* Removed unused cron tasks [#782](https://github.com/internetee/registry/issues/782)
* Removed some monkey-patching for flash message logging [#231](https://github.com/internetee/registry/issues/231)
* Added Docker container support for dev and test environments [#821](https://github.com/internetee/registry/issues/821)
* Fix for Travis CI random test failures [#809](https://github.com/internetee/registry/pull/809)
03.04.2018 03.04.2018
* BUG: Fixed bug with sometimes failing bank-link payments [#642](https://github.com/internetee/registry/issues/642) * BUG: Fixed bug with sometimes failing bank-link payments [#642](https://github.com/internetee/registry/issues/642)
* EPP: Domain and associated objects are now validated on domain renew [#678](https://github.com/internetee/registry/issues/678) * EPP: Domain and associated objects are now validated on domain renew [#678](https://github.com/internetee/registry/issues/678)

View file

@ -1,4 +1,4 @@
FROM ruby:2.2 FROM ruby:2.3
MAINTAINER maciej.szlosarczyk@internet.ee MAINTAINER maciej.szlosarczyk@internet.ee
RUN apt-get update > /dev/null && apt-get install -y > /dev/null \ RUN apt-get update > /dev/null && apt-get install -y > /dev/null \

View file

@ -11,7 +11,7 @@ source 'https://rubygems.org'
gem 'SyslogLogger', '2.0', require: 'syslog/logger' gem 'SyslogLogger', '2.0', require: 'syslog/logger'
gem 'iso8601', '0.8.6' # for dates and times gem 'iso8601', '0.8.6' # for dates and times
gem 'rails', '4.2.7.1' # when update, all initializers eis_custom files needs check/update gem 'rails', '4.2.10' # when update, all initializers eis_custom files needs check/update
gem 'rest-client' gem 'rest-client'
# load env # load env
@ -52,7 +52,7 @@ gem 'liquid', '3.0.6' # for email templates
# rights # rights
gem 'cancancan', '1.11.0' # autharization gem 'cancancan', '1.11.0' # autharization
gem 'devise', '3.5.4' # authenitcation gem 'devise', '4.4.3' # authenitcation
# rest api # rest api
gem 'grape', '0.12.0' gem 'grape', '0.12.0'

View file

@ -60,43 +60,42 @@ GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
SyslogLogger (2.0) SyslogLogger (2.0)
actionmailer (4.2.7.1) actionmailer (4.2.10)
actionpack (= 4.2.7.1) actionpack (= 4.2.10)
actionview (= 4.2.7.1) actionview (= 4.2.10)
activejob (= 4.2.7.1) activejob (= 4.2.10)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.7.1) actionpack (4.2.10)
actionview (= 4.2.7.1) actionview (= 4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
rack (~> 1.6) rack (~> 1.6)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.7.1) actionview (4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_model-errors_details (1.3.1) active_model-errors_details (1.3.1)
activemodel (>= 3.2.13, < 5.0.0) activemodel (>= 3.2.13, < 5.0.0)
activesupport activesupport
activejob (4.2.7.1) activejob (4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
globalid (>= 0.3.0) globalid (>= 0.3.0)
activemodel (4.2.7.1) activemodel (4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.2.7.1) activerecord (4.2.10)
activemodel (= 4.2.7.1) activemodel (= 4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
arel (~> 6.0) arel (~> 6.0)
activerecord-import (0.7.0) activerecord-import (0.7.0)
activerecord (>= 3.0) activerecord (>= 3.0)
activesupport (4.2.7.1) activesupport (4.2.10)
i18n (~> 0.7) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
@ -160,7 +159,7 @@ GEM
unicode_utils (~> 1.4) unicode_utils (~> 1.4)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
crass (1.0.3) crass (1.0.4)
daemons (1.2.4) daemons (1.2.4)
daemons-rails (1.2.1) daemons-rails (1.2.1)
daemons daemons
@ -168,12 +167,11 @@ GEM
database_cleaner (1.6.1) database_cleaner (1.6.1)
descendants_tracker (0.0.4) descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
devise (3.5.4) devise (4.4.3)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 4.1.0, < 6.0)
responders responders
thread_safe (~> 0.1)
warden (~> 1.2.3) warden (~> 1.2.3)
diff-lcs (1.3) diff-lcs (1.3)
docile (1.1.5) docile (1.1.5)
@ -189,8 +187,8 @@ GEM
railties (>= 3.0.0) railties (>= 3.0.0)
figaro (1.1.1) figaro (1.1.1)
thor (~> 0.14) thor (~> 0.14)
globalid (0.3.7) globalid (0.4.1)
activesupport (>= 4.1.0) activesupport (>= 4.2.0)
grape (0.12.0) grape (0.12.0)
activesupport activesupport
builder builder
@ -228,7 +226,7 @@ GEM
httpi (2.4.2) httpi (2.4.2)
rack rack
socksify socksify
i18n (0.8.4) i18n (0.8.6)
i18n_data (0.7.0) i18n_data (0.7.0)
ice_nine (0.11.2) ice_nine (0.11.2)
isikukood (0.1.2) isikukood (0.1.2)
@ -251,8 +249,8 @@ GEM
loofah (2.2.2) loofah (2.2.2)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.6) mail (2.7.0)
mime-types (>= 1.16, < 4) mini_mime (>= 0.1.1)
method_source (0.8.2) method_source (0.8.2)
mime-types (3.1) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
@ -260,8 +258,9 @@ GEM
mina (0.3.1) mina (0.3.1)
open4 (~> 1.3.4) open4 (~> 1.3.4)
rake rake
mini_mime (1.0.0)
mini_portile2 (2.3.0) mini_portile2 (2.3.0)
minitest (5.10.3) minitest (5.11.3)
monetize (1.6.0) monetize (1.6.0)
money (~> 6.8) money (~> 6.8)
money (6.8.3) money (6.8.3)
@ -313,35 +312,35 @@ GEM
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
railroady (1.3.0) railroady (1.3.0)
rails (4.2.7.1) rails (4.2.10)
actionmailer (= 4.2.7.1) actionmailer (= 4.2.10)
actionpack (= 4.2.7.1) actionpack (= 4.2.10)
actionview (= 4.2.7.1) actionview (= 4.2.10)
activejob (= 4.2.7.1) activejob (= 4.2.10)
activemodel (= 4.2.7.1) activemodel (= 4.2.10)
activerecord (= 4.2.7.1) activerecord (= 4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.7.1) railties (= 4.2.10)
sprockets-rails sprockets-rails
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.8) rails-dom-testing (1.0.9)
activesupport (>= 4.2.0.beta, < 5.0) activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6) nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1) rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.0.4)
loofah (~> 2.0) loofah (~> 2.2, >= 2.2.2)
rails-settings-cached (0.4.1) rails-settings-cached (0.4.1)
rails (>= 4.0.0) rails (>= 4.0.0)
railties (4.2.7.1) railties (4.2.10)
actionpack (= 4.2.7.1) actionpack (= 4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.2.2) rainbow (2.2.2)
rake rake
rake (12.0.0) rake (12.3.1)
ransack (1.5.1) ransack (1.5.1)
actionpack (>= 3.0) actionpack (>= 3.0)
activerecord (>= 3.0) activerecord (>= 3.0)
@ -350,8 +349,9 @@ GEM
polyamorous (~> 1.1) polyamorous (~> 1.1)
rdoc (4.3.0) rdoc (4.3.0)
request_store (1.1.0) request_store (1.1.0)
responders (2.3.0) responders (2.4.0)
railties (>= 4.2.0, < 5.1) actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
rest-client (2.0.1) rest-client (2.0.1)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 4.0)
@ -430,14 +430,14 @@ GEM
sprockets (3.7.1) sprockets (3.7.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.0) sprockets-rails (3.2.1)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
thor (0.19.4) thor (0.20.0)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (1.4.1) tilt (1.4.1)
tzinfo (1.2.3) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
@ -491,7 +491,7 @@ DEPENDENCIES
daemons-rails (= 1.2.1) daemons-rails (= 1.2.1)
data_migrate! data_migrate!
database_cleaner database_cleaner
devise (= 3.5.4) devise (= 4.4.3)
digidoc_client! digidoc_client!
epp (= 1.5.0)! epp (= 1.5.0)!
epp-xml (= 1.1.0)! epp-xml (= 1.1.0)!
@ -522,7 +522,7 @@ DEPENDENCIES
que-web (= 0.4.0) que-web (= 0.4.0)
que_mailer! que_mailer!
railroady (= 1.3.0) railroady (= 1.3.0)
rails (= 4.2.7.1) rails (= 4.2.10)
rails-settings-cached (= 0.4.1) rails-settings-cached (= 0.4.1)
ransack (= 1.5.1) ransack (= 1.5.1)
rest-client rest-client
@ -542,4 +542,4 @@ DEPENDENCIES
whenever (= 0.9.4) whenever (= 0.9.4)
BUNDLED WITH BUNDLED WITH
1.14.6 1.16.1

View file

@ -3,13 +3,11 @@ module Admin
load_and_authorize_resource load_and_authorize_resource
def index def index
params[:q] ||= {} params[:q] ||= {}
domains = BlockedDomain.all.order(:name) domains = BlockedDomain.all.order(:name)
@q = domains.search(params[:q]) @q = domains.search(params[:q])
@domains = @q.result.page(params[:page]) @domains = @q.result.page(params[:page])
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def new def new

View file

@ -1,5 +1,7 @@
module Admin module Admin
class ContactVersionsController < BaseController class ContactVersionsController < BaseController
include ObjectVersionsHelper
load_and_authorize_resource load_and_authorize_resource
def index def index
@ -24,7 +26,7 @@ module Admin
versions = ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc) versions = ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
@q = versions.search(params[:q]) @q = versions.search(params[:q])
@versions = @q.result.page(params[:page]) @versions = @q.result.page(params[:page])
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end

View file

@ -22,7 +22,7 @@ module Admin
@contacts = @q.result.uniq.page(params[:page]) @contacts = @q.result.uniq.page(params[:page])
end end
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def search def search

View file

@ -1,5 +1,7 @@
module Admin module Admin
class DomainVersionsController < BaseController class DomainVersionsController < BaseController
include ObjectVersionsHelper
load_and_authorize_resource load_and_authorize_resource
def index def index
@ -41,7 +43,7 @@ module Admin
versions = DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc) versions = DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
@q = versions.search(params[:q]) @q = versions.search(params[:q])
@versions = @q.result.page(params[:page]) @versions = @q.result.page(params[:page])
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
render "admin/domain_versions/archive" render "admin/domain_versions/archive"
end end

View file

@ -32,7 +32,7 @@ module Admin
end end
end end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
# rubocop: enable Metrics/PerceivedComplexity # rubocop: enable Metrics/PerceivedComplexity

View file

@ -13,7 +13,7 @@ module Admin
@deposit = Deposit.new(deposit_params.merge(registrar: r)) @deposit = Deposit.new(deposit_params.merge(registrar: r))
@invoice = @deposit.issue_prepayment_invoice @invoice = @deposit.issue_prepayment_invoice
if @invoice && @invoice.persisted? if @invoice&.persisted?
flash[:notice] = t(:record_created) flash[:notice] = t(:record_created)
redirect_to [:admin, @invoice] redirect_to [:admin, @invoice]
else else

View file

@ -4,13 +4,11 @@ module Admin
before_action :set_domain, only: [:edit, :update] before_action :set_domain, only: [:edit, :update]
def index def index
params[:q] ||= {} params[:q] ||= {}
domains = ReservedDomain.all.order(:name) domains = ReservedDomain.all.order(:name)
@q = domains.search(params[:q]) @q = domains.search(params[:q])
@domains = @q.result.page(params[:page]) @domains = @q.result.page(params[:page])
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def new def new

View file

@ -168,7 +168,7 @@ class EppController < ApplicationController
# validate legal document's type here because it may be in most of the requests # validate legal document's type here because it may be in most of the requests
@prefix = nil @prefix = nil
if element_count('extdata > legalDocument') > 0 if element_count('extdata > legalDocument').positive?
requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES, policy: true) requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES, policy: true)
end end
@ -279,7 +279,7 @@ class EppController < ApplicationController
def optional(selector, *validations) def optional(selector, *validations)
full_selector = [@prefix, selector].compact.join(' ') full_selector = [@prefix, selector].compact.join(' ')
el = params[:parsed_frame].css(full_selector).first el = params[:parsed_frame].css(full_selector).first
return unless el && el.text.present? return unless el&.text.present?
value = el.text value = el.text
validations.each do |x| validations.each do |x|

View file

@ -6,7 +6,7 @@ class Registrant::DomainsController < RegistrantController
@q = domains.search(params[:q]) @q = domains.search(params[:q])
@domains = @q.result.page(params[:page]) @domains = @q.result.page(params[:page])
end end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def show def show

View file

@ -1,3 +1,5 @@
# As non-GDPR compliant, this controller is deprecated. Needs to be replaced with one that relies
# on the REST WHOIS API.
class Registrant::WhoisController < RegistrantController class Registrant::WhoisController < RegistrantController
def index def index
authorize! :view, :registrant_whois authorize! :view, :registrant_whois

View file

@ -33,7 +33,7 @@ class Registrar
@contacts = @q.result(distinct: :true).page(params[:page]) @contacts = @q.result(distinct: :true).page(params[:page])
end end
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def download_list def download_list

View file

@ -10,7 +10,7 @@ class Registrar
@deposit = Deposit.new(deposit_params.merge(registrar: current_user.registrar)) @deposit = Deposit.new(deposit_params.merge(registrar: current_user.registrar))
@invoice = @deposit.issue_prepayment_invoice @invoice = @deposit.issue_prepayment_invoice
if @invoice && @invoice.persisted? if @invoice&.persisted?
flash[:notice] = t(:please_pay_the_following_invoice) flash[:notice] = t(:please_pay_the_following_invoice)
redirect_to [:registrar, @invoice] redirect_to [:registrar, @invoice]
else else

View file

@ -40,7 +40,7 @@ class Registrar
end end
end end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
respond_to do |format| respond_to do |format|
format.html format.html

View file

@ -0,0 +1,15 @@
module ObjectVersionsHelper
def attach_existing_fields(version, new_object)
version.object_changes.to_h.each do |key, value|
method_name = "#{key}=".to_sym
if new_object.respond_to?(method_name)
new_object.public_send(method_name, value.last)
end
end
end
def only_present_fields(version, model)
field_names = model.column_names
version.object.to_h.select { |key, _value| field_names.include?(key) }
end
end

View file

@ -51,4 +51,4 @@ class UpdateWhoisRecordJob < Que::Job
def delete_blocked(name) def delete_blocked(name)
delete_reserved(name) delete_reserved(name)
end end
end end

View file

@ -13,9 +13,9 @@ class Ability
case @user.class.to_s case @user.class.to_s
when 'AdminUser' when 'AdminUser'
@user.roles.each { |role| send(role) } if @user.roles @user.roles&.each { |role| send(role) }
when 'ApiUser' when 'ApiUser'
@user.roles.each { |role| send(role) } if @user.roles @user.roles&.each { |role| send(role) }
when 'RegistrantUser' when 'RegistrantUser'
static_registrant static_registrant
end end

View file

@ -45,8 +45,10 @@ class Directo < ActiveRecord::Base
end end
data = builder.to_xml.gsub("\n",'') data = builder.to_xml.gsub("\n",'')
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s Rails.logger.info("[Directo] XML request: #{data}")
dump_result_to_db(mappers, response) response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false)
Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}")
dump_result_to_db(mappers, response.to_s)
end end
STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n" STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n"
@ -165,11 +167,15 @@ class Directo < ActiveRecord::Base
end end
data = builder.to_xml.gsub("\n",'') data = builder.to_xml.gsub("\n",'')
Rails.logger.info("[Directo] XML request: #{data}")
if debug if debug
STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n" STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n"
else else
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false)
Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}")
response = response.to_s
Setting.directo_monthly_number_last = directo_next Setting.directo_monthly_number_last = directo_next
Nokogiri::XML(response).css("Result").each do |res| Nokogiri::XML(response).css("Result").each do |res|
Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next) Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next)
@ -190,4 +196,3 @@ class Directo < ActiveRecord::Base
@pricelists[account_activity.price_id] = account_activity.price @pricelists[account_activity.price_id] = account_activity.price
end end
end end

View file

@ -147,7 +147,7 @@ class Epp::Contact < Contact
end end
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? frame.css("legalDocument").first.content = doc.path if doc&.persisted?
self.legal_document_id = doc.id self.legal_document_id = doc.id
end end
@ -238,7 +238,7 @@ class Epp::Contact < Contact
) )
self.legal_documents = [doc] self.legal_documents = [doc]
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? frame.css("legalDocument").first.content = doc.path if doc&.persisted?
self.legal_document_id = doc.id self.legal_document_id = doc.id
end end

View file

@ -197,7 +197,7 @@ class Epp::Domain < Domain
) )
self.legal_documents = [doc] self.legal_documents = [doc]
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? frame.css("legalDocument").first.content = doc.path if doc&.persisted?
self.legal_document_id = doc.id self.legal_document_id = doc.id
end end
# rubocop: enable Metrics/PerceivedComplexity # rubocop: enable Metrics/PerceivedComplexity
@ -472,7 +472,7 @@ class Epp::Domain < Domain
at.deep_merge!(attrs_from(frame.css('rem'), current_user, 'rem')) at.deep_merge!(attrs_from(frame.css('rem'), current_user, 'rem'))
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? frame.css("legalDocument").first.content = doc.path if doc&.persisted?
self.legal_document_id = doc.id self.legal_document_id = doc.id
end end
@ -547,7 +547,7 @@ class Epp::Domain < Domain
check_discarded check_discarded
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? frame.css("legalDocument").first.content = doc.path if doc&.persisted?
end end
if Setting.request_confirmation_on_domain_deletion_enabled && if Setting.request_confirmation_on_domain_deletion_enabled &&

View file

@ -6,7 +6,8 @@ class LegalDocument < ActiveRecord::Base
if ENV['legal_document_types'].present? if ENV['legal_document_types'].present?
TYPES = ENV['legal_document_types'].split(',').map(&:strip) TYPES = ENV['legal_document_types'].split(',').map(&:strip)
else else
TYPES = %w(pdf bdoc ddoc zip rar gz tar 7z odt doc docx).freeze TYPES = %w(pdf asice asics sce scs adoc edoc bdoc ddoc zip rar gz tar 7z odt
doc docx).freeze
end end
attr_accessor :body attr_accessor :body

View file

@ -36,6 +36,7 @@ class WhoisRecord < ActiveRecord::Base
registrant = domain.registrant registrant = domain.registrant
@disclosed = [] @disclosed = []
h[:disclaimer] = disclaimer_text if disclaimer_text.present?
h[:name] = domain.name h[:name] = domain.name
h[:status] = domain.statuses.map { |x| status_map[x] || x } h[:status] = domain.statuses.map { |x| status_map[x] || x }
h[:registered] = domain.registered_at.try(:to_s, :iso8601) h[:registered] = domain.registered_at.try(:to_s, :iso8601)
@ -120,4 +121,10 @@ class WhoisRecord < ActiveRecord::Base
def destroy_whois_record def destroy_whois_record
Whois::Record.where(name: name).delete_all Whois::Record.where(name: name).delete_all
end end
private
def disclaimer_text
Setting.registry_whois_disclaimer
end
end end

View file

@ -37,7 +37,7 @@ class DomainNameValidator < ActiveModel::EachValidator
def validate_blocked(value) def validate_blocked(value)
return true unless value return true unless value
return false if BlockedDomain.where(name: value).count > 0 return false if BlockedDomain.where(name: value).count.positive?
DNS::Zone.where(origin: value).count.zero? DNS::Zone.where(origin: value).count.zero?
end end
end end

View file

@ -57,8 +57,9 @@
%tbody %tbody
- @versions.each do |version| - @versions.each do |version|
- if version - if version
- contact = Contact.new(version.object.to_h) - attributes = only_present_fields(version, Contact)
- version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last) } - contact = Contact.new(attributes)
- attach_existing_fields(version, contact)
%tr %tr
%td= link_to(contact.name, admin_contact_version_path(version.id)) %td= link_to(contact.name, admin_contact_version_path(version.id))

View file

@ -1,5 +1,6 @@
- contact = Contact.new(@version.object.to_h) - attributes = only_present_fields(@version, Contact)
- @version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last ) } - contact = Contact.new(attributes)
- attach_existing_fields(@version, contact)
= render 'shared/title', name: contact.name = render 'shared/title', name: contact.name
.row .row
@ -41,11 +42,11 @@
%br %br
%dt= t(:created) %dt= t(:created_at)
%dd{class: changing_css_class(@version,"created_at")} %dd{class: changing_css_class(@version,"created_at")}
= l(contact.created_at, format: :short) = l(contact.created_at, format: :short)
%dt= t(:updated) %dt= t(:updated_at)
%dd{class: changing_css_class(@version,"updated_at")} %dd{class: changing_css_class(@version,"updated_at")}
= l(contact.updated_at, format: :short) = l(contact.updated_at, format: :short)
@ -61,7 +62,7 @@
- if contact.street.present? - if contact.street.present?
%dt= t(:street) %dt= t(:street)
%dd{class: changing_css_class(@version,"street")}= contact.street.to_s.gsub("\n", '<br>').html_safe %dd{class: changing_css_class(@version,"street")}= contact.street
- if contact.city.present? - if contact.city.present?
%dt= t(:city) %dt= t(:city)

View file

@ -55,8 +55,9 @@
%tbody %tbody
- @versions.each do |version| - @versions.each do |version|
- if version - if version
- domain = Domain.new(version.object.to_h) - attributes = only_present_fields(version, Domain)
- version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) } - domain = Domain.new(attributes)
- attach_existing_fields(version, domain)
%tr %tr
%td= link_to(domain.name, admin_domain_version_path(version.id)) %td= link_to(domain.name, admin_domain_version_path(version.id))

View file

@ -1,5 +1,6 @@
- domain = Domain.new(@version.object.to_h) - present_fields = only_present_fields(@version, Domain)
- @version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) } - domain = Domain.new(present_fields)
- attach_existing_fields(@version, domain)
- if @version - if @version
- children = HashWithIndifferentAccess.new(@version.children) - children = HashWithIndifferentAccess.new(@version.children)

View file

@ -99,6 +99,7 @@
= render 'setting_row', var: :registry_state = render 'setting_row', var: :registry_state
= render 'setting_row', var: :registry_zip = render 'setting_row', var: :registry_zip
= render 'setting_row', var: :registry_country_code = render 'setting_row', var: :registry_country_code
= render 'setting_row', var: :registry_whois_disclaimer
.row .row
.col-md-12.text-right .col-md-12.text-right

View file

@ -22,7 +22,7 @@ xml.epp_head do
xml.tag!('domain:contact', ac.code, 'type' => 'admin') xml.tag!('domain:contact', ac.code, 'type' => 'admin')
end end
if @nameservers && @nameservers.any? if @nameservers&.any?
xml.tag!('domain:ns') do xml.tag!('domain:ns') do
@nameservers.each do |x| @nameservers.each do |x|
xml.tag!('domain:hostAttr') do xml.tag!('domain:hostAttr') do

View file

@ -1,3 +1,6 @@
<%- if json['disclaimer'].present? -%>
<%= json['disclaimer'].scan(/\S.{0,72}\S(?=\s|$)|\S+/).join("\n") %>
<%- end -%>
Estonia .ee Top Level Domain WHOIS server Estonia .ee Top Level Domain WHOIS server
Domain: Domain:
@ -23,18 +26,18 @@ changed: <%= json['registrant_changed'].to_s.tr('T',' ').sub('+', ' +') %>
<%- if json['admin_contacts'].present? -%> <%- if json['admin_contacts'].present? -%>
Administrative contact: Administrative contact:
<%- for contact in json['admin_contacts'] -%> <%- for contact in json['admin_contacts'] -%>
name: <%= contact['name'] %> name: Not Disclosed
email: Not Disclosed - Visit www.internet.ee for webbased WHOIS email: Not Disclosed - Visit www.internet.ee for webbased WHOIS
changed: <%= contact['changed'].to_s.tr('T',' ').sub('+', ' +') %> changed: Not Disclosed
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>
<% if json['tech_contacts'].present? %> <% if json['tech_contacts'].present? %>
Technical contact: Technical contact:
<%- for contact in json['tech_contacts'] -%> <%- for contact in json['tech_contacts'] -%>
name: <%= contact['name'] %> name: Not Disclosed
email: Not Disclosed - Visit www.internet.ee for webbased WHOIS email: Not Disclosed - Visit www.internet.ee for webbased WHOIS
changed: <%= contact['changed'].to_s.tr('T',' ').sub('+', ' +') %> changed: Not Disclosed
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>

View file

@ -1,54 +0,0 @@
!!! 5
%html{lang: I18n.locale.to_s}
%head
%meta{charset: "utf-8"}/
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
- if content_for? :head_title
= yield :head_title
- else
%title= t(:registrant_head_title)
= csrf_meta_tags
= stylesheet_link_tag 'registrant-manifest', media: 'all'
= favicon_link_tag 'favicon.ico'
%body
/ Fixed navbar
%nav.navbar.navbar-default.navbar-fixed-top
.container
.navbar-header
%button.navbar-toggle.collapsed{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to registrant_root_path, class: 'navbar-brand' do
= t(:registrant_head_title)
- if unstable_env.present?
.text-center
%small{style: 'color: #0074B3;'}= unstable_env
- if current_user
.navbar-collapse.collapse
%ul.nav.navbar-nav.public-nav
- if can? :view, Depp::Domain
- active_class = %w(registrant/domains registrant/check registrant/renew registrant/tranfer registrant/keyrelays).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:domains), registrant_domains_path
- active_class = %w(registrant/whois).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:whois), registrant_whois_path
%ul.nav.navbar-nav.navbar-right
- if user_signed_in?
%li= link_to t(:log_out, user: current_user), '/registrant/logout'
.container
= render 'shared/flash'
= yield
%footer.footer
.container
.row
.col-md-6
= image_tag 'eis-logo-et.png'
.col-md-6.text-right
Version
= CURRENT_COMMIT_HASH
= javascript_include_tag 'registrant-manifest', async: true

View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="<%= I18n.locale.to_s %>">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<% if content_for? :head_title %>
<%= yield :head_title %>
<% else %>
<title>
<%= t(:registrant_head_title) %>
</title>
<% end %>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'registrant-manifest', media: 'all' %>
<%= favicon_link_tag 'favicon.ico' %>
</head>
<body>
<!-- Fixed navbar
-->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button aria-controls="navbar" aria-expanded="false" class="navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse" type="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<%= link_to registrant_root_path, class: 'navbar-brand' do %>
<%= t(:registrant_head_title) %>
<% if unstable_env.present? %>
<div class="text-center">
<small style="color: #0074B3;">
<%= unstable_env %>
</small>
</div>
<% end %>
<% end %>
</div>
<% if current_user %>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav public-nav">
<% if can? :view, Depp::Domain %>
<% active_class = %w(registrant/domains registrant/check registrant/renew registrant/tranfer registrant/keyrelays).include?(params[:controller]) ? 'active' :nil %>
<li class="<%= active_class %>">
<%= link_to t(:domains), registrant_domains_path %>
</li>
<% end %>
<% active_class = %w(registrant/whois).include?(params[:controller]) ? 'active' :nil %>
<li class="<%= active_class %>">
<%= link_to 'Internet.ee', 'https://internet.ee' %>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<% if user_signed_in? %>
<li>
<%= link_to t(:log_out, user: current_user), '/registrant/logout' %>
</li>
<% end %>
</ul>
</div>
<% end %>
</div>
</nav>
<div class="container">
<%= render 'shared/flash' %>
<%= yield %>
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-md-6">
<%= image_tag 'eis-logo-et.png' %>
</div>
<div class="col-md-6 text-right">
Version
<%= CURRENT_COMMIT_HASH %>
</div>
</div>
</div>
</footer>
<%= javascript_include_tag 'registrant-manifest', async: true %>
</body>
</html>

View file

@ -8,7 +8,7 @@
%dd= @contact.org_name %dd= @contact.org_name
%dt= t(:street) %dt= t(:street)
%dd= @contact.street.to_s.gsub("\n", '<br>').html_safe %dd= @contact.street
%dt= t(:city) %dt= t(:city)
%dd= @contact.city %dd= @contact.city

View file

@ -67,8 +67,8 @@ contact_org_enabled: 'false'
# iptables_server_ip: '127.0.0.1' # iptables_server_ip: '127.0.0.1'
# Custom legal document types. Changing this requires updating EPP extension schema for allowed legalDocEnumType values. # Custom legal document types. Changing this requires updating EPP extension schema for allowed legalDocEnumType values.
# System default for legal document types is: pdf,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx # System default for legal document types is: pdf,asice,sce,asics,scs,adoc,edoc,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx
# legal_document_types: "pdf,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx" # legal_document_types: "pdf,asice,sce,asics,scs,adoc,edoc,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx"
# #

View file

@ -72,4 +72,5 @@ if con.present? && con.table_exists?('settings')
Setting.save_default(:registry_bank_code, '689') Setting.save_default(:registry_bank_code, '689')
Setting.save_default(:registry_swift, 'LHVBEE22') Setting.save_default(:registry_swift, 'LHVBEE22')
Setting.save_default(:registry_invoice_contact, 'Martti Õigus') Setting.save_default(:registry_invoice_contact, 'Martti Õigus')
Setting.save_default(:registry_whois_disclaimer, 'Search results may not be used for commercial, advertising, recompilation, repackaging, redistribution, reuse, obscuring or other similar activities.')
end end

View file

@ -144,7 +144,6 @@ Rails.application.routes.draw do
end end
resources :contacts resources :contacts
resources :whois
end end

View file

@ -8,7 +8,7 @@ More info at http://en.wikipedia.org/wiki/Extensible_Provisioning_Protocol
Contact Mapping protocol short version: Contact Mapping protocol short version:
All values are limited to Unicode Latin characters if stricter limits are not specified. This includes unicode blocks All values are limited to Unicode Latin characters if stricter limits are not specified. This includes unicode blocks
Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B, Latin Extended C, Latin Extended D, Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B, Latin Extended C, Latin Extended D,
Latin Extended Additional, Diacritics. Latin Extended Additional, Diacritics.
More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
@ -16,9 +16,9 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description Field name Min-max Field description
----------------------- ------- ----------------- ----------------------- ------- -----------------
<create> 1 <create> 1
<contact:create> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" <contact:create> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 0-1 Contact id, optional, <contact:id> 0-1 Contact id, optional,
string: ASCII letters, numbers, ':', '-' characters, no spaces, string: ASCII letters, numbers, ':', '-' characters, no spaces,
max 100 characters, max 100 characters,
generated automatically if missing. generated automatically if missing.
@ -34,7 +34,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
<contact:voice> 1 Phone number in format \+ddd.d+ <contact:voice> 1 Phone number in format \+ddd.d+
<contact:fax> 0 Fax is not supported and must be blank or missing <contact:fax> 0 Fax is not supported and must be blank or missing
<contact:email> 1 E-mail <contact:email> 1 E-mail
<extension> 1 <extension> 1
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" <eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:ident> 1 Identifier <eis:ident> 1 Identifier
Attribute: "type" Attribute: "type"
@ -43,8 +43,8 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
"birthday" # Birthday date in format in YYYY-MM-DD "birthday" # Birthday date in format in YYYY-MM-DD
Attribute: "cc" Attribute: "cc"
"EE" # Country code in ISO_3166-1 aplha 2 "EE" # Country code in ISO_3166-1 aplha 2
<eis:legalDocument> 0-1 Base64 encoded document <eis:legalDocument> 0-1 Base64 encoded document
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-create-command-successfully-creates-a-contact) [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-create-command-successfully-creates-a-contact)
@ -53,7 +53,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description Field name Min-max Field description
----------------------- ------- ----------------- ----------------------- ------- -----------------
<update> 1 <update> 1
<contact:update> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" <contact:update> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 1 Contact id, required <contact:id> 1 Contact id, required
<contact:chg> 1 Change container <contact:chg> 1 Change container
@ -71,7 +71,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
<contact:email> 0-1 E-mail <contact:email> 0-1 E-mail
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact. <contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
<contact:pw> 1 Contact password. Attribute: roid="String" <contact:pw> 1 Contact password. Attribute: roid="String"
<extension> 0-1 <extension> 0-1
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" <eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:ident> 0-1 Identifier <eis:ident> 0-1 Identifier
Attribute: "type" Attribute: "type"
@ -80,8 +80,8 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
"birthday" # Birthday date in format in YYYY-MM-DD "birthday" # Birthday date in format in YYYY-MM-DD
Attribute: "cc" Attribute: "cc"
"EE" # Country code in ISO_3166-1 aplha 2 "EE" # Country code in ISO_3166-1 aplha 2
<eis:legalDocument> 0-1 Base64 encoded document. <eis:legalDocument> 0-1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
@ -91,15 +91,15 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description Field name Min-max Field description
----------------------- ------- ----------------- ----------------------- ------- -----------------
<delete> 1 <delete> 1
<contact:delete> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" <contact:delete> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 1 Contact id <contact:id> 1 Contact id
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact. <contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
<contact:pw> 1 Contact password. Attribute: roid="String" <contact:pw> 1 Contact password. Attribute: roid="String"
<extension> 0-1 <extension> 0-1
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" <eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:legalDocument> 0-1 Base64 encoded document. <eis:legalDocument> 0-1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-delete-command-deletes-contact) [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-delete-command-deletes-contact)
@ -109,9 +109,9 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description Field name Min-max Field description
----------------------- ------- ----------------- ----------------------- ------- -----------------
<check> 1 <check> 1
<contact:check> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" <contact:check> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 1-n Contact id <contact:id> 1-n Contact id
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-check-command-returns-info-about-contact-availability) [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-check-command-returns-info-about-contact-availability)
@ -121,9 +121,9 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description Field name Min-max Field description
----------------------- ------- ----------------- ----------------------- ------- -----------------
<info> 1 <info> 1
<contact:info> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd" <contact:info> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 1-n Contact id <contact:id> 1-n Contact id
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact. <contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
<contact:pw> 1 Contact password. Attribute: roid="String" <contact:pw> 1 Contact password. Attribute: roid="String"
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id

View file

@ -12,15 +12,15 @@ Domain name mapping protocol short version:
Field name Min-max Field description Field name Min-max Field description
------------------------- ------- ----------------- ------------------------- ------- -----------------
<create> 1 <create> 1
<domain:create> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" <domain:create> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters. <domain:name> 1 Domain name. Can contain unicode characters.
<domain:period> 0-1 Registration period for domain. <domain:period> 0-1 Registration period for domain.
Must add up to 3m, 6m, 9m, 1y, 2y, 3y, 4y, 5y, 6y, 7y, 8y, 9y, 10y. Must add up to 3m, 6m, 9m, 1y, 2y, 3y, 4y, 5y, 6y, 7y, 8y, 9y, 10y.
Attribute: unit="y/m/d" Attribute: unit="y/m/d"
Default is 1 year. Default is 1 year.
<domain:ns> 0-1 <domain:ns> 0-1
<domain:hostAttr> 2-11 <domain:hostAttr> 2-11
<domain:hostName> 1 Hostname of the nameserver <domain:hostName> 1 Hostname of the nameserver
<domain:hostAddr> 0-2 Required if nameserver hostname is under the same domain. <domain:hostAddr> 0-2 Required if nameserver hostname is under the same domain.
Attribute ip="v4 / v6" Attribute ip="v4 / v6"
@ -30,16 +30,16 @@ Domain name mapping protocol short version:
<domain:authInfo> 0-1 <domain:authInfo> 0-1
<domain:pw> 1 Transfer code. Attribute: roid="String" <domain:pw> 1 Transfer code. Attribute: roid="String"
</domain:authInfo> </domain:authInfo>
<extension> 1 <extension> 1
<secDNS:create> 0-1 Attribute: xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" <secDNS:create> 0-1 Attribute: xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1"
<secDNS:keyData> 1-n <secDNS:keyData> 1-n
<secDNS:flags> 1 Allowed values: 0, 256, 257 <secDNS:flags> 1 Allowed values: 0, 256, 257
<secDNS:protocol> 1 Allowed values: 3 <secDNS:protocol> 1 Allowed values: 3
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14 <secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14
<secDNS:pubKey> 1 Public key <secDNS:pubKey> 1 Public key
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" <eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:legalDocument> 1 Base64 encoded document. <eis:legalDocument> 1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z"
<eis:reserved> 0-1 <eis:reserved> 0-1
<eis:pw> 0-1 Required if registering a reserved domain <eis:pw> 0-1 Required if registering a reserved domain
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
@ -50,27 +50,27 @@ Domain name mapping protocol short version:
Field name Min-max Field description Field name Min-max Field description
------------------------ -------- ----------------- ------------------------ -------- -----------------
<update> 1 <update> 1
<domain:update> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" <domain:update> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters. <domain:name> 1 Domain name. Can contain unicode characters.
<domain:add> 0-1 Objects to add <domain:add> 0-1 Objects to add
<domain:contact> 0-n Contact reference. Attribute: type="admin / tech" <domain:contact> 0-n Contact reference. Attribute: type="admin / tech"
<domain:status> 0-n Status description. <domain:status> 0-n Status description.
Attribute: s="clientDeleteProhibited / clientHold / Attribute: s="clientDeleteProhibited / clientHold /
clientRenewProhibited / clientTransferProhibited / clientRenewProhibited / clientTransferProhibited /
clientUpdateProhibited" clientUpdateProhibited"
<domain:ns> 0-1 <domain:ns> 0-1
<domain:hostAttr> 1 <domain:hostAttr> 1
<domain:hostName> 1 Hostname of the nameserver <domain:hostName> 1 Hostname of the nameserver
<domain:hostAddr> 0-2 Required if nameserver hostname is under the same domain. <domain:hostAddr> 0-2 Required if nameserver hostname is under the same domain.
Attribute ip="v4 / v6" Attribute ip="v4 / v6"
<domain:rem> 0-1 Objects to remove <domain:rem> 0-1 Objects to remove
<domain:contact> 0-n Contact reference. Attribute: type="admin / tech" <domain:contact> 0-n Contact reference. Attribute: type="admin / tech"
<domain:status> 0-n Attribute: s="clientDeleteProhibited / clientHold / <domain:status> 0-n Attribute: s="clientDeleteProhibited / clientHold /
clientRenewProhibited / clientTransferProhibited / clientRenewProhibited / clientTransferProhibited /
clientUpdateProhibited" clientUpdateProhibited"
<domain:ns> 0-1 <domain:ns> 0-1
<domain:hostAttr> 1 <domain:hostAttr> 1
<domain:hostName> 1 Hostname of the nameserver <domain:hostName> 1 Hostname of the nameserver
<domain:chg> 0-1 Attributes to change <domain:chg> 0-1 Attributes to change
<domain:registrant> 0-1 Contact reference to the registrant <domain:registrant> 0-1 Contact reference to the registrant
@ -80,18 +80,18 @@ Domain name mapping protocol short version:
</domain:authInfo> </domain:authInfo>
<extension> 0-1 Required if registrant is changing <extension> 0-1 Required if registrant is changing
<secDNS:update> 0-1 Attribute: xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" <secDNS:update> 0-1 Attribute: xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1"
<secDNS:rem> 0-1 <secDNS:rem> 0-1
<secDNS:keyData> 1-n <secDNS:keyData> 1-n
<secDNS:pubKey> 1 Public key <secDNS:pubKey> 1 Public key
<secDNS:add> 0-1 <secDNS:add> 0-1
<secDNS:keyData> 1-n <secDNS:keyData> 1-n
<secDNS:flags> 1 Allowed values: 0, 256, 257 <secDNS:flags> 1 Allowed values: 0, 256, 257
<secDNS:protocol> 1 Allowed values: 3 <secDNS:protocol> 1 Allowed values: 3
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14 <secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14
<secDNS:pubKey> 1 Public key <secDNS:pubKey> 1 Public key
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" <eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:legalDocument> 0-1 Base64 encoded document. Required if registrant is changing. <eis:legalDocument> 0-1 Base64 encoded document. Required if registrant is changing.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-updates-domain-and-adds-objects) [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-updates-domain-and-adds-objects)
@ -100,14 +100,14 @@ Domain name mapping protocol short version:
Field name Min-max Field description Field name Min-max Field description
----------------------- ------- ----------------- ----------------------- ------- -----------------
<delete> 1 <delete> 1
<domain:delete> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" <domain:delete> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
Optional attribute: verified="yes/no" Optional attribute: verified="yes/no"
<domain:name> 1 Domain name. Can contain unicode characters. <domain:name> 1 Domain name. Can contain unicode characters.
<extension> 1 <extension> 1
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" <eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:legalDocument> 1 Base64 encoded document. <eis:legalDocument> 1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-deletes-domain) [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-deletes-domain)
@ -116,9 +116,9 @@ Domain name mapping protocol short version:
Field name Min-max Field description Field name Min-max Field description
----------------------- ------- ----------------- ----------------------- ------- -----------------
<info> 1 <info> 1
<domain:info> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" <domain:info> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters. <domain:name> 1 Domain name. Can contain unicode characters.
Attribute: hosts="all / del / sub / none" Attribute: hosts="all / del / sub / none"
<domain:authInfo> 0-1 Required if registrar is not the owner of the domain. <domain:authInfo> 0-1 Required if registrar is not the owner of the domain.
<domain:pw> 1 Domain transfer code. Attribute: roid="String" <domain:pw> 1 Domain transfer code. Attribute: roid="String"
@ -130,18 +130,18 @@ Domain name mapping protocol short version:
Field name Min-max Field description Field name Min-max Field description
----------------------- ------- ----------------- ----------------------- ------- -----------------
<renew> 1 <renew> 1
<domain:renew> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" <domain:renew> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters. <domain:name> 1 Domain name. Can contain unicode characters.
<domain:curExpDate> 1 Current expiry date (ISO8601 format) <domain:curExpDate> 1 Current expiry date (ISO8601 format)
<domain:period> 0-1 Registration period for domain. <domain:period> 0-1 Registration period for domain.
Must add up to 3m, 6m, 9m, 1y, 2y, 3y, 4y, 5y, 6y, 7y, 8y, 9y, 10y. Must add up to 3m, 6m, 9m, 1y, 2y, 3y, 4y, 5y, 6y, 7y, 8y, 9y, 10y.
Attribute: unit="y/m/d" Attribute: unit="y/m/d"
Default value is 1 year. Default value is 1 year.
<extension> 0-1 <extension> 0-1
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" <eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:legalDocument> 0-1 Base64 encoded document. <eis:legalDocument> 0-1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-renews-a-domain) [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-renews-a-domain)
@ -152,13 +152,13 @@ Domain name mapping protocol short version:
----------------------- ------- ----------------- ----------------------- ------- -----------------
<transfer> 1 Attribute: op="request/query/approve/reject/cancel" <transfer> 1 Attribute: op="request/query/approve/reject/cancel"
<domain:transfer> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" <domain:transfer> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters. <domain:name> 1 Domain name. Can contain unicode characters.
<domain:authInfo> 1 <domain:authInfo> 1
<domain:pw> 1 Domain transfer code. Attribute: roid="String" <domain:pw> 1 Domain transfer code. Attribute: roid="String"
<extension> 0-1 <extension> 0-1
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" <eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:legalDocument> 0-1 Base64 encoded document. <eis:legalDocument> 0-1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z" Attribute: type="pdf/asice/sce/adoc/asics/scs/edoc/adoc/bdoc/ddoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-transfers-a-domain) [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-transfers-a-domain)
@ -167,9 +167,9 @@ Domain name mapping protocol short version:
Field name Min-max Field description Field name Min-max Field description
----------------------- ------- ----------------- ----------------------- ------- -----------------
<check> 1 <check> 1
<domain:check> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" <domain:check> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters. <domain:name> 1 Domain name. Can contain unicode characters.
<clTRID> 0-1 Client transaction id <clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-checks-a-domain) [EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-checks-a-domain)

View file

@ -63,7 +63,13 @@
<simpleType name="legalDocEnumType"> <simpleType name="legalDocEnumType">
<restriction base="token"> <restriction base="token">
<enumeration value="pdf"/> <enumeration value="pdf"/>
<enumeration value="asice"/>
<enumeration value="asics"/>
<enumeration value="sce"/>
<enumeration value="scs"/>
<enumeration value="adoc"/>
<enumeration value="bdoc"/> <enumeration value="bdoc"/>
<enumeration value="edoc"/>
<enumeration value="ddoc"/> <enumeration value="ddoc"/>
<enumeration value="zip"/> <enumeration value="zip"/>
<enumeration value="rar"/> <enumeration value="rar"/>

View file

@ -1,12 +0,0 @@
require 'rails_helper'
RSpec.feature 'Contact list', settings: false do
background do
sign_in_to_admin_area
end
it 'is visible' do
visit admin_contacts_path
expect(page).to have_css('.contacts')
end
end

View file

@ -1,67 +0,0 @@
require 'rails_helper'
RSpec.describe WhoisRecord do
describe '::generate_json', db: false do
let(:registrant) { build_stubbed(:registrant) }
let(:domain) { build_stubbed(:domain, registrant: registrant) }
let(:whois_record) { described_class.new }
subject(:generated_json) { whois_record.generate_json }
before do
allow(whois_record).to receive(:domain).and_return(domain)
end
it 'generates registrant kind' do
expect(registrant).to receive(:kind).and_return('test kind')
expect(generated_json[:registrant_kind]).to eq('test kind')
end
describe 'reg no' do
subject(:reg_no) { generated_json[:registrant_reg_no] }
before do
allow(registrant).to receive(:reg_no).and_return('test reg no')
end
context 'when registrant is legal entity' do
let(:registrant) { build_stubbed(:registrant_legal_entity) }
it 'is present' do
expect(reg_no).to eq('test reg no')
end
end
context 'when registrant is private entity' do
let(:registrant) { build_stubbed(:registrant_private_entity) }
it 'is absent' do
expect(reg_no).to be_nil
end
end
end
describe 'country code' do
subject(:country_code) { generated_json[:registrant_ident_country_code] }
before do
allow(registrant).to receive(:ident_country_code).and_return('test country code')
end
context 'when registrant is legal entity' do
let(:registrant) { build_stubbed(:registrant_legal_entity) }
it 'is present' do
expect(country_code).to eq('test country code')
end
end
context 'when registrant is private entity' do
let(:registrant) { build_stubbed(:registrant_private_entity) }
it 'is absent' do
expect(country_code).to be_nil
end
end
end
end
end

View file

@ -0,0 +1,60 @@
require 'test_helper'
class ContactVersionsTest < ActionDispatch::IntegrationTest
def setup
super
create_contact_with_history
login_as users(:admin)
end
def teardown
super
delete_objects_once_done
end
def create_contact_with_history
sql = <<-SQL.squish
INSERT INTO registrars (id, name, reg_no, email, country_code, code,
accounting_customer_code, language)
VALUES (75, 'test_registrar', 'test123', 'test@test.com', 'EE', 'TEST123',
'test123', 'en');
INSERT INTO contacts (id, code, auth_info, registrar_id)
VALUES (75, 'test_code', '8b4d462aa04194ca78840a', 75);
INSERT INTO log_contacts (item_type, item_id, event, whodunnit, object,
object_changes, created_at, session, children, ident_updated_at, uuid)
VALUES ('Contact', 75, 'update', '1-AdminUser',
'{"id": 75, "code": "test_code", "auth_info": "8b4d462aa04194ca78840a", "registrar_id": 75, "old_field": "value"}',
'{"other_made_up_field": "value"}',
'2018-04-23 15:50:48.113491', '2018-04-23 12:44:56',
'{"legal_documents":[null]}', null, null
)
SQL
ActiveRecord::Base.connection.execute(sql)
end
def delete_objects_once_done
ActiveRecord::Base.connection.execute('DELETE from log_contacts where item_id = 75')
Domain.destroy_all
Contact.destroy_all
Registrar.destroy_all
end
def test_removed_fields_are_not_causing_errors_in_index_view
visit admin_contact_versions_path
assert_text 'test_registrar'
assert_text 'update 23.04.18, 18:50'
end
def test_removed_fields_are_not_causing_errors_in_details_view
version_id = Contact.find(75).versions.last
visit admin_contact_version_path(version_id)
assert_text 'test_registrar'
assert_text '23.04.18, 18:50 update 1-AdminUser'
end
end

View file

@ -0,0 +1,25 @@
require 'test_helper'
class AdminContactsTest < ActionDispatch::IntegrationTest
def setup
super
@contact = contacts(:william)
login_as users(:admin)
end
def test_display_list
visit admin_contacts_path
assert_text('william-001')
assert_text('william-002')
assert_text('acme-ltd-001')
end
def test_display_details
visit admin_contact_path(@contact)
assert_text('Street Main Street City New York Postcode 12345 ' \
'State New York Country United States of America')
end
end

View file

@ -0,0 +1,65 @@
require 'test_helper'
class DomainVersionsTest < ActionDispatch::IntegrationTest
def setup
super
create_domain_with_history
login_as users(:admin)
end
def teardown
super
delete_objects_once_done
end
def create_domain_with_history
sql = <<-SQL.squish
INSERT INTO registrars (id, name, reg_no, email, country_code, code,
accounting_customer_code, language)
VALUES (54, 'test_registrar', 'test123', 'test@test.com', 'EE', 'TEST123',
'test123', 'en');
INSERT INTO contacts (id, code, auth_info, registrar_id)
VALUES (54, 'test_code', '8b4d462aa04194ca78840a', 54);
INSERT INTO domains (id, registrar_id, valid_to, registrant_id,
transfer_code)
VALUES (54, 54, '2018-06-23T12:14:02.732+03:00', 54, 'transfer_code');
INSERT INTO log_domains (item_type, item_id, event, whodunnit, object,
object_changes, created_at, nameserver_ids, tech_contact_ids,
admin_contact_ids, session, children)
VALUES ('Domain', 54, 'update', '1-AdminUser',
'{"id": 54, "registrar_id": 54, "valid_to": "2018-07-23T12:14:05.583+03:00", "registrant_id": 54, "transfer_code": "transfer_code", "valid_from": "2017-07-23T12:14:05.583+03:00"}',
'{"foo": "bar", "other_made_up_field": "value"}',
'2018-04-23 15:50:48.113491', '{}', '{}', '{}', '2018-04-23 12:44:56',
'{"null_fracdmin_contacts":[108],"tech_contacts":[109],"nameservers":[],"dnskeys":[],"legal_documents":[null],"registrant":[1]}'
)
SQL
ActiveRecord::Base.connection.execute(sql)
end
def delete_objects_once_done
ActiveRecord::Base.connection.execute('DELETE FROM log_domains where item_id = 54')
Domain.destroy_all
Contact.destroy_all
Registrar.destroy_all
end
def test_removed_fields_are_not_causing_errors_in_index_view
visit admin_domain_versions_path
assert_text 'test_registrar'
assert_text 'test_registrar update 23.04.18, 18:50'
end
def test_removed_fields_are_not_causing_errors_in_details_view
version_id = Domain.find(54).versions.last
visit admin_domain_version_path(version_id)
assert_text 'test_registrar'
assert_text '23.04.18, 18:50 update 1-AdminUser'
end
end

View file

@ -0,0 +1,17 @@
require 'test_helper'
class RegistrantLayoutTest < ActionDispatch::IntegrationTest
def setup
super
login_as(users(:registrant))
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
end
def test_has_link_to_rest_whois
visit registrant_domains_url
assert(has_link?('Internet.ee', href: 'https://internet.ee'))
refute(has_link?('WHOIS', href: 'registrant/whois'))
end
end

View file

@ -0,0 +1,60 @@
require 'test_helper'
class WhoisRecordTest < ActiveSupport::TestCase
def setup
super
@domain = domains(:shop)
@record = WhoisRecord.new(domain: @domain)
@record.populate
end
def test_generated_json_has_expected_values
expected_disclaimer_text = <<-TEXT.squish
Search results may not be used for commercial, advertising, recompilation,
repackaging, redistribution, reuse, obscuring or other similar activities.
TEXT
expected_partial_hash = {
disclaimer: expected_disclaimer_text,
name: 'shop.test',
registrant: 'John',
registrant_kind: 'priv',
email: 'john@inbox.test',
expire: '2010-07-05',
nameservers: ['ns1.bestnames.test', 'ns2.bestnames.test'],
registrar_address: 'Main Street, New York, New York, 12345',
dnssec_keys: [],
}
expected_partial_hash.each do |key, value|
assert_equal(value, @record.generated_json[key])
end
end
def test_generated_body_has_justified_disclaimer
expected_disclaimer = begin
'Search results may not be used for commercial, advertising, recompilation,\n' \
'repackaging, redistribution, reuse, obscuring or other similar activities.'
end
expected_technical_contact = begin
'Technical contact:\n' \
'name: Not Disclosed\n' \
'email: Not Disclosed - Visit www.internet.ee for webbased WHOIS\n' \
'changed: Not Disclosed'
end
regexp_contact = Regexp.new(expected_technical_contact, Regexp::MULTILINE)
regexp_disclaimer = Regexp.new(expected_disclaimer, Regexp::MULTILINE)
assert_match(regexp_disclaimer, @record.body)
assert_match(regexp_contact, @record.body)
end
def test_whois_record_has_no_disclaimer_if_Setting_is_blank
Setting.stubs(:registry_whois_disclaimer, '') do
refute(@record.json['disclaimer'])
refute_match(/Search results may not be used for commercial/, @record.body)
end
end
end