Merge branch 'master' into alpha

This commit is contained in:
Priit Tark 2015-06-17 07:55:18 +03:00
commit 627851a213
100 changed files with 6902 additions and 1888 deletions

View file

@ -1,3 +1,11 @@
16.06.2015
* Application time_zone should be defined at application.yml, updated application-exaple.yml
15.06.2015
* Apache config update: now only TLSv1.2 allowed with whitelisted chipers, please review all SSL config parameters
08.06.2015
* Add sk service name to application.yml

10
Gemfile
View file

@ -51,7 +51,7 @@ gem 'jbuilder', '~> 2.2.6' # json api
# registry specfic
gem 'simpleidn', '~> 0.0.5' # For punycode
gem 'isikukood' # for EE-id validation
gem 'money-rails', '~> 1.3.0' # Money helpers
gem 'money-rails', '~> 1.4.1'
# deploy
gem 'whenever', '~> 0.9.4', require: false
@ -72,10 +72,14 @@ gem 'deep_cloneable', '~> 2.1.1'
gem 'digidoc_client', '~> 0.2.1'
# epp
gem 'epp', '~> 1.4.2', github: 'gitlabeu/epp'
gem 'epp-xml', '~> 1.0.2' # EPP XMLs
gem 'epp', '~> 1.4.2', github: 'internetee/epp'
gem 'epp-xml', '~> 1.0.3' # EIS EPP XMLs
gem 'uuidtools', '~> 2.1.4' # For unique IDs (used by the epp gem)
# que
gem 'que', '~> 0.10.0'
gem 'que-web', '~> 0.4.0'
# for importing legacy db
gem 'activerecord-import', '~> 0.7.0' # for inserting dummy data

View file

@ -16,14 +16,6 @@ GIT
data_migrate (1.3.0)
rails (>= 4.1.0)
GIT
remote: git://github.com/gitlabeu/epp.git
revision: 505c3f2739eb1da918e54111aecfb138a822739d
specs:
epp (1.4.2)
hpricot
libxml-ruby
GIT
remote: git://github.com/haml/html2haml.git
revision: 6984f50bdbbd6291535027726a5697f28778ee8d
@ -35,6 +27,14 @@ GIT
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
GIT
remote: git://github.com/internetee/epp.git
revision: 505c3f2739eb1da918e54111aecfb138a822739d
specs:
epp (1.4.2)
hpricot
libxml-ruby
GEM
remote: https://rubygems.org/
specs:
@ -171,7 +171,7 @@ GEM
nokogiri (>= 1.4.0)
savon (>= 2.4.0)
docile (1.1.5)
epp-xml (1.0.2)
epp-xml (1.0.3)
activesupport (~> 4.1)
builder (~> 3.2)
equalizer (0.0.11)
@ -284,7 +284,7 @@ GEM
money (~> 6.5.0)
money (6.5.1)
i18n (>= 0.6.4, <= 0.7.0)
money-rails (1.3.0)
money-rails (1.4.1)
activesupport (>= 3.0)
monetize (~> 1.1.0)
money (~> 6.5.0)
@ -317,11 +317,18 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
que (0.10.0)
que-web (0.4.0)
erubis
que (~> 0.8)
sinatra
rack (1.6.1)
rack-accept (0.4.5)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
railroady (1.3.0)
@ -444,6 +451,10 @@ GEM
simplecov-html (~> 0.9.0)
simplecov-html (0.9.0)
simpleidn (0.0.5)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slim (2.1.0)
temple (~> 0.6.9)
tilt (>= 1.3.3, < 2.1)
@ -529,7 +540,7 @@ DEPENDENCIES
devise (~> 3.4.1)
digidoc_client (~> 0.2.1)
epp (~> 1.4.2)!
epp-xml (~> 1.0.2)
epp-xml (~> 1.0.3)
fabrication (~> 2.12.2)
faker (~> 1.3.0)
figaro (~> 1.1.0)
@ -551,7 +562,7 @@ DEPENDENCIES
kaminari (~> 0.16.3)
launchy (~> 2.4.3)
mina (~> 0.3.1)
money-rails (~> 1.3.0)
money-rails (~> 1.4.1)
newrelic_rpm (~> 3.9.9.275)
nokogiri (~> 1.6.6.2)
nprogress-rails (~> 0.1.6.7)
@ -562,6 +573,8 @@ DEPENDENCIES
phantomjs-binaries (~> 1.9.2.4)
poltergeist (~> 1.5.1)
pry (~> 0.10.1)
que (~> 0.10.0)
que-web (~> 0.4.0)
railroady (~> 1.3.0)
rails (= 4.2.1)
rails-settings-cached (~> 0.4.1)

View file

@ -97,9 +97,10 @@ For Apache, registry admin goes to port 443 in production, /etc/apache2/sites-en
SSLCertificateChainFile /etc/ssl/certs/your-chain-fail.pem
SSLCACertificateFile /etc/ssl/certs/ca.pem
SSLProtocol TLSv1
SSLProtocol -all +TLSv1.2
SSLHonorCipherOrder On
SSLCipherSuite RC4-SHA:HIGH:!ADH
SSLCompression off
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
RewriteEnginriteEngine on
RedirectMatch ^/$ /admin
@ -157,9 +158,10 @@ Registrar configuration (/etc/apache2/sites-enabled/registrar.conf) is as follow
SSLCertificateChainFile /etc/ssl/certs/your-chain-fail.pem
SSLCACertificateFile /etc/ssl/certs/ca.pem
SSLProtocol TLSv1
SSLProtocol -all +TLSv1.2
SSLHonorCipherOrder On
SSLCipherSuite RC4-SHA:HIGH:!ADH
SSLCompression off
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
RewriteEngine on
RedirectMatch ^/$ /registrar
@ -240,9 +242,10 @@ Registrant configuration (/etc/apache2/sites-enabled/registrant.conf) is as foll
SSLCertificateChainFile /etc/ssl/certs/your-chain-fail.pem
SSLCACertificateFile /etc/ssl/certs/ca.pem
SSLProtocol TLSv1
SSLProtocol -all +TLSv1.2
SSLHonorCipherOrder On
SSLCipherSuite RC4-SHA:HIGH:!ADH
SSLCompression off
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
RewriteEngine on
RedirectMatch ^/$ /registrant

View file

@ -58,4 +58,7 @@ body > .container
.text-grey
color: grey
.partially-hidden
border: 1px solid #dddddd
padding-left: 4px
padding-right: 4px

View file

@ -16,13 +16,13 @@ class Admin::DomainsController < AdminController
end
def update
add_prefix_to_statuses
dp = ignore_empty_statuses
if @domain.update(domain_params)
if @domain.update(dp)
flash[:notice] = I18n.t('domain_updated')
redirect_to [:admin, @domain]
else
@domain.domain_statuses.build if @domain.domain_statuses.empty?
build_associations
flash.now[:alert] = I18n.t('failed_to_update_domain')
render 'edit'
end
@ -53,21 +53,23 @@ class Admin::DomainsController < AdminController
end
def domain_params
params.require(:domain).permit(
domain_statuses_attributes: [:id, :value, :description, :_destroy]
)
if params[:domain]
params.require(:domain).permit({ statuses: [] })
else
{ statuses: [] }
end
end
def build_associations
@domain.domain_statuses.build if @domain.domain_statuses.empty?
@server_statuses = @domain.domain_statuses.select(&:server_status?)
@server_statuses << @domain.domain_statuses.build if @server_statuses.empty?
@server_statuses = @domain.statuses.select { |x| DomainStatus::SERVER_STATUSES.include?(x) }
@server_statuses = [nil] if @server_statuses.empty?
@other_statuses = @domain.statuses.select { |x| !DomainStatus::SERVER_STATUSES.include?(x) }
end
def add_prefix_to_statuses
domain_params[:domain_statuses_attributes].each do |_k, hash|
hash[:value] = hash[:value].prepend('server') if hash[:value].present?
end
def ignore_empty_statuses
dp = domain_params
dp[:statuses].reject!(&:blank?)
dp
end
end

View file

@ -56,7 +56,7 @@ class Epp::DomainsController < EppController
@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])
if @domain.epp_destroy(params[:parsed_frame], current_user.id)
if @domain.epp_pending_delete.present?
render_epp_response '/epp/domains/success_pending'
else

View file

@ -5,6 +5,7 @@ class EppController < ApplicationController
skip_before_action :verify_authenticity_token
before_action :generate_svtrid
before_action :latin_only
before_action :validate_request
before_action :update_epp_session
helper_method :current_user
@ -106,6 +107,14 @@ class EppController < ApplicationController
write_to_epp_log
end
# VALIDATION
def latin_only
return true if params['frame'].blank?
return true if params['frame'].match(/\A[\p{Latin}\p{Z}\p{P}\p{S}\p{Cc}\p{Cf}\w_\'\+\-\.\(\)\/]*\Z/i)
render_epp_response '/epp/latin_error'
false
end
# VALIDATION
def validate_request
validation_method = "validate_#{params[:action]}"

View file

@ -20,7 +20,6 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
domain_name: @domain.name,
verification_token: params[:token])
if params[:rejected]
if @registrant_verification.domain_registrant_change_reject!
flash[:notice] = t(:registrant_domain_verification_rejected)

View file

@ -27,9 +27,10 @@ class Registrant::SessionsController < Devise::SessionsController
@user = User.new
end
def mid
def mid # rubocop: disable Metrics/MethodLength
phone = params[:user][:phone]
client = Digidoc::Client.new
endpoint = "#{ENV['sk_digi_doc_service_endpoint']}"
client = Digidoc::Client.new(endpoint)
if Rails.env.test? && phone == "123"
@user = ApiUser.find_by(identity_code: "14212128025")

View file

@ -0,0 +1,16 @@
class DomainConfirmJob < Que::Job
def run(domain_id, action)
# it's recommended to keep transaction against job table as short as possible.
ActiveRecord::Base.transaction do
domain = Epp::Domain.find(domain_id)
case action
when RegistrantVerification::CONFIRMED
domain.apply_pending_update!
domain.clean_pendings!
when RegistrantVerification::REJECTED
domain.clean_pendings!
end
destroy # it's best to destroy the job in the same transaction
end
end
end

View file

@ -75,7 +75,7 @@ class BankTransaction < ActiveRecord::Base
create_account_activity(
account: registrar.cash_account,
invoice: invoice,
sum: sum,
sum: invoice.sum_without_vat,
currency: currency,
description: description
)

View file

@ -54,6 +54,11 @@ class Domain < ActiveRecord::Base
delegate :name, to: :registrar, prefix: true
delegate :street, to: :registrar, prefix: true
after_initialize :init_default_values
def init_default_values
self.pending_json = {} if pending_json.blank?
end
before_create :generate_auth_info
before_create :set_validity_dates
before_update :manage_statuses
@ -63,13 +68,16 @@ class Domain < ActiveRecord::Base
true
end
before_save :manage_automatic_statuses
before_save :touch_always_version
def touch_always_version
self.updated_at = Time.zone.now
end
after_save :manage_automatic_statuses
after_save :update_whois_record
after_initialize -> { self.statuses = [] if statuses.nil? }
validates :name_dirty, domain_name: true, uniqueness: true
validates :puny_label, length: { maximum: 63 }
validates :period, numericality: { only_integer: true }
@ -119,6 +127,12 @@ class Domain < ActiveRecord::Base
validate :validate_nameserver_ips
validate :statuses_uniqueness
def statuses_uniqueness
return if statuses.uniq == statuses
errors.add(:statuses, :taken)
end
attr_accessor :registrant_typeahead, :update_me, :deliver_emails,
:epp_pending_update, :epp_pending_delete
@ -154,9 +168,10 @@ class Domain < ActiveRecord::Base
d = Domain.where('valid_to <= ?', Time.zone.now)
d.each do |x|
next unless x.expirable?
x.domain_statuses.create(value: DomainStatus::EXPIRED)
x.statuses << DomainStatus::EXPIRED
# TODO: This should be managed by automatic_statuses
x.domain_statuses.where(value: DomainStatus::OK).destroy_all
x.statuses.delete(DomainStatus::OK)
x.save(validate: false)
end
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" unless Rails.env.test?
@ -168,9 +183,10 @@ class Domain < ActiveRecord::Base
d = Domain.where('outzone_at <= ?', Time.zone.now)
d.each do |x|
next unless x.server_holdable?
x.domain_statuses.create(value: DomainStatus::SERVER_HOLD)
x.statuses << DomainStatus::SERVER_HOLD
# TODO: This should be managed by automatic_statuses
x.domain_statuses.where(value: DomainStatus::OK).destroy_all
x.statuses.delete(DomainStatus::OK)
x.save
end
STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" unless Rails.env.test?
@ -181,9 +197,10 @@ class Domain < ActiveRecord::Base
d = Domain.where('delete_at <= ?', Time.zone.now)
d.each do |x|
x.domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if x.delete_candidateable?
x.statuses << DomainStatus::DELETE_CANDIDATE if x.delete_candidateable?
# TODO: This should be managed by automatic_statuses
x.domain_statuses.where(value: DomainStatus::OK).destroy_all
x.statuses.delete(DomainStatus::OK)
x.save
end
return if Rails.env.test?
@ -194,8 +211,8 @@ class Domain < ActiveRecord::Base
STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test?
c = 0
DomainStatus.where(value: DomainStatus::DELETE_CANDIDATE).each do |x|
x.domain.destroy
Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x|
x.destroy
c += 1
end
@ -232,28 +249,22 @@ class Domain < ActiveRecord::Base
domain_transfers.find_by(status: DomainTransfer::PENDING)
end
def can_be_deleted?
(domain_statuses.pluck(:value) & %W(
#{DomainStatus::SERVER_DELETE_PROHIBITED}
)).empty?
end
def expirable?
return false if valid_to > Time.zone.now
domain_statuses.where(value: DomainStatus::EXPIRED).empty?
!statuses.include?(DomainStatus::EXPIRED)
end
def server_holdable?
return false if outzone_at > Time.zone.now
return false if domain_statuses.where(value: DomainStatus::SERVER_HOLD).any?
return false if domain_statuses.where(value: DomainStatus::SERVER_MANUAL_INZONE).any?
return false if statuses.include?(DomainStatus::SERVER_HOLD)
return false if statuses.include?(DomainStatus::SERVER_MANUAL_INZONE)
true
end
def delete_candidateable?
return false if delete_at > Time.zone.now
return false if domain_statuses.where(value: DomainStatus::DELETE_CANDIDATE).any?
return false if domain_statuses.where(value: DomainStatus::SERVER_DELETE_PROHIBITED).any?
return false if statuses.include?(DomainStatus::DELETE_CANDIDATE)
return false if statuses.include?(DomainStatus::SERVER_DELETE_PROHIBITED)
true
end
@ -264,15 +275,26 @@ class Domain < ActiveRecord::Base
end
end
return false if domain_statuses.where(value: DomainStatus::DELETE_CANDIDATE).any?
return false if statuses.include?(DomainStatus::DELETE_CANDIDATE)
true
end
def preclean_pendings
self.registrant_verification_token = nil
self.registrant_verification_asked_at = nil
end
def clean_pendings!
preclean_pendings
self.pending_json = {}
statuses.delete(DomainStatus::PENDING_UPDATE)
statuses.delete(DomainStatus::PENDING_DELETE)
save
end
def pending_update?
(domain_statuses.pluck(:value) & %W(
#{DomainStatus::PENDING_UPDATE}
)).present?
statuses.include?(DomainStatus::PENDING_UPDATE)
end
def pending_update!
@ -280,9 +302,10 @@ class Domain < ActiveRecord::Base
self.epp_pending_update = true # for epp
return true unless registrant_verification_asked?
pending_json_cache = all_changes
pending_json_cache = pending_json
token = registrant_verification_token
asked_at = registrant_verification_asked_at
changes_cache = changes
DomainMailer.registrant_pending_updated(self).deliver_now
@ -291,10 +314,13 @@ class Domain < ActiveRecord::Base
self.pending_json = pending_json_cache
self.registrant_verification_token = token
self.registrant_verification_asked_at = asked_at
domain_statuses.create(value: DomainStatus::PENDING_UPDATE)
self.statuses = [DomainStatus::PENDING_UPDATE]
pending_json[:domain] = changes_cache
end
# rubocop: disable Metrics/CyclomaticComplexity
def registrant_update_confirmable?(token)
return true if Rails.env.development?
return false unless pending_update?
return false if registrant_verification_token.blank?
return false if registrant_verification_asked_at.blank?
@ -304,6 +330,7 @@ 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?
@ -311,24 +338,25 @@ class Domain < ActiveRecord::Base
return false if registrant_verification_token != token
true
end
# rubocop: enable Metrics/CyclomaticComplexity
def force_deletable?
domain_statuses.where(value: DomainStatus::FORCE_DELETE).empty?
!statuses.include?(DomainStatus::FORCE_DELETE)
end
def registrant_verification_asked?
registrant_verification_asked_at.present? && registrant_verification_token.present?
end
def registrant_verification_asked!
def registrant_verification_asked!(frame_str, current_user_id)
pending_json['frame'] = frame_str
pending_json['current_user_id'] = current_user_id
self.registrant_verification_asked_at = Time.zone.now
self.registrant_verification_token = SecureRandom.hex(42)
end
def pending_delete?
(domain_statuses.pluck(:value) & %W(
#{DomainStatus::PENDING_DELETE}
)).present?
statuses.include?(DomainStatus::PENDING_DELETE)
end
def pending_delete!
@ -336,7 +364,9 @@ class Domain < ActiveRecord::Base
self.epp_pending_delete = true # for epp
return true unless registrant_verification_asked?
domain_statuses.create(value: DomainStatus::PENDING_DELETE)
self.statuses = [DomainStatus::PENDING_DELETE]
save(validate: false) # should check if this did succeed
DomainMailer.pending_deleted(self).deliver_now
end
@ -393,12 +423,10 @@ class Domain < ActiveRecord::Base
name
end
def pending_registrant_name
def pending_registrant
return '' if pending_json.blank?
return '' if pending_json['domain'].blank?
return '' if pending_json['domain']['registrant_id'].blank?
registrant = Registrant.find_by(id: pending_json['domain']['registrant_id'].last)
registrant.try(:name)
Registrant.find_by(id: pending_json['domain']['registrant_id'].last)
end
# rubocop:disable Lint/Loop
@ -418,41 +446,38 @@ class Domain < ActiveRecord::Base
end
def set_force_delete
domain_statuses.where(value: DomainStatus::FORCE_DELETE).first_or_create
domain_statuses.where(value: DomainStatus::SERVER_RENEW_PROHIBITED).first_or_create
domain_statuses.where(value: DomainStatus::SERVER_TRANSFER_PROHIBITED).first_or_create
domain_statuses.where(value: DomainStatus::SERVER_UPDATE_PROHIBITED).first_or_create
domain_statuses.where(value: DomainStatus::SERVER_MANUAL_INZONE).first_or_create
domain_statuses.where(value: DomainStatus::PENDING_DELETE).first_or_create
domain_statuses.where(value: DomainStatus::CLIENT_DELETE_PROHIBITED).destroy_all
domain_statuses.where(value: DomainStatus::SERVER_DELETE_PROHIBITED).destroy_all
domain_statuses.reload
statuses << DomainStatus::FORCE_DELETE
statuses << DomainStatus::SERVER_RENEW_PROHIBITED
statuses << DomainStatus::SERVER_TRANSFER_PROHIBITED
statuses << DomainStatus::SERVER_UPDATE_PROHIBITED
statuses << DomainStatus::SERVER_MANUAL_INZONE
statuses << DomainStatus::PENDING_DELETE
statuses.delete(DomainStatus::CLIENT_DELETE_PROHIBITED)
statuses.delete(DomainStatus::SERVER_DELETE_PROHIBITED)
self.force_delete_at = Time.zone.now + Setting.redemption_grace_period.days unless force_delete_at
save(validate: false)
end
def unset_force_delete
domain_statuses.where(value: DomainStatus::FORCE_DELETE).destroy_all
domain_statuses.where(value: DomainStatus::SERVER_RENEW_PROHIBITED).destroy_all
domain_statuses.where(value: DomainStatus::SERVER_TRANSFER_PROHIBITED).destroy_all
domain_statuses.where(value: DomainStatus::SERVER_UPDATE_PROHIBITED).destroy_all
domain_statuses.where(value: DomainStatus::SERVER_MANUAL_INZONE).destroy_all
domain_statuses.where(value: DomainStatus::PENDING_DELETE).destroy_all
domain_statuses.reload
statuses.delete(DomainStatus::FORCE_DELETE)
statuses.delete(DomainStatus::SERVER_RENEW_PROHIBITED)
statuses.delete(DomainStatus::SERVER_TRANSFER_PROHIBITED)
statuses.delete(DomainStatus::SERVER_UPDATE_PROHIBITED)
statuses.delete(DomainStatus::SERVER_MANUAL_INZONE)
statuses.delete(DomainStatus::PENDING_DELETE)
self.force_delete_at = nil
save(validate: false)
end
def manage_automatic_statuses
# domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable?
if domain_statuses.empty? && valid?
domain_statuses.create(value: DomainStatus::OK)
elsif domain_statuses.length > 1 || !valid?
domain_statuses.find_by(value: DomainStatus::OK).try(:destroy)
if statuses.empty? && valid?
statuses << DomainStatus::OK
elsif statuses.length > 1 || !valid?
statuses.delete(DomainStatus::OK)
end
# otherwise domain_statuses are in old state for domain object
domain_statuses.reload
end
def children_log
@ -465,17 +490,6 @@ class Domain < ActiveRecord::Base
log
end
def all_changes
all_changes = HashWithIndifferentAccess.new
all_changes[:domain] = changes
all_changes[:admin_contacts] = admin_contacts.map(&:changes)
all_changes[:tech_contacts] = tech_contacts.map(&:changes)
all_changes[:nameservers] = nameservers.map(&:changes)
all_changes[:registrant] = registrant.try(:changes)
all_changes[:domain_statuses] = domain_statuses.map(&:changes)
all_changes
end
def update_whois_record
whois_record.blank? ? create_whois_record : whois_record.save
end

View file

@ -124,7 +124,7 @@ class DomainStatus < ActiveRecord::Base
end
def statuses_for_admin
SERVER_STATUSES.map { |x| x.sub('server', '') }
SERVER_STATUSES.map { |x| [x.sub('server', ''), x] }
end
end
end

View file

@ -110,10 +110,12 @@ class Epp::Domain < Domain
at[:period_unit] = Epp::Domain.parse_period_unit_from_frame(frame) || 'y'
# at[:statuses] = domain_statuses_attrs(frame, action)
# binding.pry
at[:nameservers_attributes] = nameservers_attrs(frame, action)
at[:admin_domain_contacts_attributes] = admin_domain_contacts_attrs(frame, action)
at[:tech_domain_contacts_attributes] = tech_domain_contacts_attrs(frame, action)
at[:domain_statuses_attributes] = domain_statuses_attrs(frame, action)
# at[:domain_statuses_attributes] = domain_statuses_attrs(frame, action)
if new_record?
dnskey_frame = frame.css('extension create')
@ -235,24 +237,6 @@ class Epp::Domain < Domain
attrs
end
def domain_status_list_from(frame)
status_list = []
frame.css('status').each do |x|
unless DomainStatus::CLIENT_STATUSES.include?(x['s'])
add_epp_error('2303', 'status', x['s'], [:domain_statuses, :not_found])
next
end
status_list << {
value: x['s'],
description: x.text
}
end
status_list
end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def dnskeys_attrs(frame, action)
@ -336,14 +320,10 @@ class Epp::Domain < Domain
if action == 'rem'
to_destroy = []
status_list.each do |x|
status = domain_statuses.find_by(value: x[:value])
if status.blank?
add_epp_error('2303', 'status', x[:value], [:domain_statuses, :not_found])
if statuses.include?(x)
to_destroy << x
else
to_destroy << {
id: status.id,
_destroy: 1
}
add_epp_error('2303', 'status', x, [:domain_statuses, :not_found])
end
end
@ -362,10 +342,7 @@ class Epp::Domain < Domain
next
end
status_list << {
value: x['s'],
description: x.text
}
status_list << x['s']
end
status_list
@ -381,7 +358,7 @@ class Epp::Domain < Domain
}]
end
def update(frame, current_user)
def update(frame, current_user, verify = true)
return super if frame.blank?
at = {}.with_indifferent_access
at.deep_merge!(attrs_from(frame.css('chg'), current_user))
@ -392,16 +369,27 @@ class Epp::Domain < Domain
at[:admin_domain_contacts_attributes] += at_add[:admin_domain_contacts_attributes]
at[:tech_domain_contacts_attributes] += at_add[:tech_domain_contacts_attributes]
at[:dnskeys_attributes] += at_add[:dnskeys_attributes]
at[:domain_statuses_attributes] += at_add[:domain_statuses_attributes]
at[:statuses] =
statuses - domain_statuses_attrs(frame.css('rem'), 'rem') + domain_statuses_attrs(frame.css('add'), 'add')
if frame.css('registrant').present? && frame.css('registrant').attr('verified').to_s.downcase != 'yes'
registrant_verification_asked!
# at[:statuses] += at_add[:domain_statuses_attributes]
if verify && frame.css('registrant').present? && frame.css('registrant').attr('verified').to_s.downcase != 'yes'
registrant_verification_asked!(frame.to_s, current_user.id)
end
self.deliver_emails = true # turn on email delivery for epp
errors.empty? && super(at)
end
def apply_pending_update!
preclean_pendings
user = ApiUser.find(pending_json['current_user_id'])
frame = Nokogiri::XML(pending_json['frame'])
statuses.delete(DomainStatus::PENDING_UPDATE)
clean_pendings! if update(frame, user, false)
end
def attach_legal_document(legal_document_data)
return unless legal_document_data
@ -411,11 +399,11 @@ class Epp::Domain < Domain
)
end
def epp_destroy(frame)
def epp_destroy(frame, user_id)
return false unless valid?
if frame.css('delete').attr('verified').to_s.downcase != 'yes'
registrant_verification_asked!
registrant_verification_asked!(frame.to_s, user_id)
pending_delete!
manage_automatic_statuses
true # aka 1001 pending_delete
@ -439,8 +427,8 @@ class Epp::Domain < Domain
self.period = period
self.period_unit = unit
domain_statuses.where(value: DomainStatus::SERVER_HOLD).destroy_all
domain_statuses.where(value: DomainStatus::EXPIRED).destroy_all
statuses.delete(DomainStatus::SERVER_HOLD)
statuses.delete(DomainStatus::EXPIRED)
save
end
@ -682,9 +670,7 @@ class Epp::Domain < Domain
begin
errors.add(:base, :domain_status_prohibits_operation)
return false
end if (domain_statuses.pluck(:value) & %W(
#{DomainStatus::CLIENT_DELETE_PROHIBITED}
)).any?
end if statuses.include?(DomainStatus::CLIENT_DELETE_PROHIBITED)
true
end

View file

@ -17,12 +17,12 @@ class RegistrantVerification < ActiveRecord::Base
def domain_registrant_change_confirm!
self.action_type = DOMAIN_REGISTRANT_CHANGE
self.action = CONFIRMED
save
DomainConfirmJob.enqueue domain.id, CONFIRMED if save
end
def domain_registrant_change_reject!
self.action_type = DOMAIN_REGISTRANT_CHANGE
self.action = REJECTED
save
DomainConfirmJob.enqueue domain.id, REJECTED if save
end
end

View file

@ -34,10 +34,14 @@ class WhoisRecord < ActiveRecord::Base
h = HashWithIndifferentAccess.new
return h if domain.blank?
status_map = {
'ok' => 'ok (paid and in zone)'
}
@disclosed = []
h[:name] = domain.name
h[:registrant] = domain.registrant.name
h[:status] = domain.domain_statuses.map(&:human_value).join(', ')
h[:status] = domain.statuses.map { |x| status_map[x] || x }.join(', ')
h[:registered] = domain.registered_at.try(:to_s, :iso8601)
h[:updated_at] = domain.updated_at.try(:to_s, :iso8601)
h[:valid_to] = domain.valid_to.try(:to_s, :iso8601)

View file

@ -7,7 +7,8 @@
%dd= @contact.code
%dt= t(:password)
%dd= @contact.auth_info
%dd
= text_field_tag :auth_info, @contact.auth_info, readonly: true, class: 'partially-hidden'
%br

View file

@ -1,26 +1,29 @@
#domain-statuses
= f.fields_for :domain_statuses, @server_statuses do |status_fields|
- @server_statuses.each do |x|
.panel.panel-default
.panel-heading.clearfix
.pull-left= t(:status)
.pull-right
= link_to(t(:add_another), '#', class: 'btn btn-primary btn-xs add-domain-status')
= link_to(t(:delete), '#', class: 'btn btn-danger btn-xs destroy')
= link_to(t(:delete), '#', class: 'btn btn-danger btn-xs destroy-status')
.panel-body
.errors
= render 'shared/errors', object: status_fields.object
- if status_fields.object.errors.any?
%hr
.form-group
= status_fields.label :value, class: 'col-md-2 control-label'
= f.label 'status', class: 'col-md-2 control-label'
.col-md-10
= status_fields.select :value, options_for_select(DomainStatus.statuses_for_admin, status_fields.object.value.try(:sub, 'server', '')), {include_blank: true}, {class: 'form-control'}
= select_tag 'domain[statuses][]', options_for_select(DomainStatus.statuses_for_admin, x), include_blank: true, class: 'form-control'
.form-group
= status_fields.label :description, class: 'col-md-2 control-label'
= label_tag t(:description), nil, class: 'col-md-2 control-label'
.col-md-10
= status_fields.text_field :description, class: 'form-control', autocomplete: 'off'
= text_field_tag :description, nil, class: 'form-control', autocomplete: 'off'
- @other_statuses.each do |x|
= hidden_field_tag 'domain[statuses][]', x, readonly: true
:coffee
$("#domain-statuses").nestedAttributes
bindAddTo: $(".add-domain-status")
afterAdd: (item) ->
item.find(".errors").html ""
$('.destroy-status').on 'click', (e) ->
e.preventDefault()
if $('.panel').length > 1
$(this).parents('.panel').remove()
else
$(this).parents('.panel').find('select').val('')

View file

@ -13,7 +13,8 @@
%dd= link_to(@domain.registrar, root_path)
%dt= t(:password)
%dd= @domain.auth_info
%dd
= text_field_tag :password, @domain.auth_info, readonly: true, class: 'partially-hidden'
%dt= t(:valid_from)
%dd= l(@domain.valid_from)

View file

@ -1,5 +1,4 @@
- panel_class = @domain.errors.messages[:domain_statuses] ? 'panel-danger' : 'panel-default'
#domain_statuses.panel{class: panel_class}
#domain_statuses.panel.panel-default
.panel-heading.clearfix
= t(:statuses)
.table-responsive
@ -9,12 +8,7 @@
%th{class: 'col-xs-6'}= t(:status)
%th{class: 'col-xs-6'}= t(:description)
%tbody
- @domain.domain_statuses.each do |x|
- @domain.statuses.each do |x|
%tr
%td= x.value
%td= x.description
- if @domain.errors.messages[:domain_statuses]
%tfoot
- @domain.errors.messages[:domain_statuses].each do |x|
%tr
%td{colspan: 4}= x
%td= x
%td

View file

@ -0,0 +1,9 @@
- value = Setting.send(var)
%tr
%td= t(var)
- if [TrueClass, FalseClass].include?(value.class)
%td
= hidden_field_tag("[settings][#{var}]", '')
= check_box_tag("[settings][#{var}]", true, value)
- else
%td= text_field_tag("[settings][#{var}]", value)

View file

@ -1,27 +1,72 @@
= render 'shared/title', name: t(:settings)
= form_tag [:admin, :settings] do
.row
.col-md-8
.panel.panel-default
.panel-heading.clearfix
= t(:domain_validation_rules)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}
= t(:setting)
%th{class: 'col-xs-2'}
= t(:value)
%th{class: 'col-xs-6'}= t(:setting)
%th{class: 'col-xs-6'}= t(:value)
%tbody
- @settings.each do |x|
= render 'setting_row', var: :admin_contacts_min_count
= render 'setting_row', var: :admin_contacts_max_count
= render 'setting_row', var: :tech_contacts_min_count
= render 'setting_row', var: :tech_contacts_max_count
= render 'setting_row', var: :ds_data_allowed
= render 'setting_row', var: :key_data_allowed
= render 'setting_row', var: :dnskeys_min_count
= render 'setting_row', var: :dnskeys_max_count
= render 'setting_row', var: :ns_min_count
= render 'setting_row', var: :ns_max_count
.panel.panel-default
.panel-heading.clearfix
= t(:domain_expiring)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%td= t("#{x.var}")
- if [TrueClass, FalseClass].include?(x.value.class)
%td
= hidden_field_tag("[settings][#{x.var}]", '')
= check_box_tag("[settings][#{x.var}]", true, x.value)
- else
%td= text_field_tag("[settings][#{x.var}]", x.value)
%hr
%th{class: 'col-xs-6'}= t(:setting)
%th{class: 'col-xs-6'}= t(:value)
%tbody
= render 'setting_row', var: :days_to_renew_domain_before_expire
= render 'setting_row', var: :expire_warning_period
= render 'setting_row', var: :redemption_grace_period
.panel.panel-default
.panel-heading.clearfix
= t(:billing)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-6'}= t(:setting)
%th{class: 'col-xs-6'}= t(:value)
%tbody
= render 'setting_row', var: :eis_iban
= render 'setting_row', var: :eis_bank
= render 'setting_row', var: :eis_swift
= render 'setting_row', var: :eis_invoice_contact
= render 'setting_row', var: :invoice_number_min
= render 'setting_row', var: :invoice_number_max
= render 'setting_row', var: :days_to_keep_overdue_invoices_active
.panel.panel-default
.panel-heading.clearfix
= t(:other)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-6'}= t(:setting)
%th{class: 'col-xs-6'}= t(:value)
%tbody
= render 'setting_row', var: :transfer_wait_time
= render 'setting_row', var: :ds_algorithm
= render 'setting_row', var: :client_side_status_editing_enabled
.row
.col-md-8.text-right
.col-md-12.text-right
%button.btn.btn-primary=t(:save)

View file

@ -9,8 +9,6 @@ Isikukood: <%= @domain.registrant_ident %><br>
<% else %>
Äriregistrikood: <%= @domain.registrant_ident %><br>
<% end %>
Epost: <%= @domain.registrant_email %><br>
Tel: <%= @domain.registrant_phone %><br>
Tänav: <%= @domain.registrant_street %><br>
Linn: <%= @domain.registrant_city %><br>
Riik: <%= @domain.registrant_country %>
@ -34,8 +32,6 @@ Personal code: <%= @domain.registrant_ident %><br>
<% else %>
Business Registry code: <%= @domain.registrant_ident %><br>
<% end %>
E-mail: <%= @domain.registrant_email %><br>
Tel: <%= @domain.registrant_phone %><br>
Street: <%= @domain.registrant_street %><br>
City: <%= @domain.registrant_city %><br>
Country: <%= @domain.registrant_country %>

View file

@ -9,8 +9,6 @@ Isikukood: <%= @domain.registrant_ident %>
<% else %>
Äriregistrikood: <%= @domain.registrant_ident %>
<% end %>
Epost: <%= @domain.registrant_email %>
Tel: <%= @domain.registrant_phone %>
Tänav: <%= @domain.registrant_street %>
Linn: <%= @domain.registrant_city %>
Riik: <%= @domain.registrant_country %>
@ -34,8 +32,6 @@ Personal code: <%= @domain.registrant_ident %>
<% else %>
Business Registry code: <%= @domain.registrant_ident %>
<% end %>
E-mail: <%= @domain.registrant_email %>
Tel: <%= @domain.registrant_phone %>
Street: <%= @domain.registrant_street %>
City: <%= @domain.registrant_city %>
Country: <%= @domain.registrant_country %>

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('contact:chkData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
xml.tag!('contact:chkData', 'xmlns:contact' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd') do
@results.each do |result|
xml.tag!('contact:cd') do
xml.tag! "contact:id", result[:code], avail: result[:avail]

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('contact:creData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
xml.tag!('contact:creData', 'xmlns:contact' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd') do
xml.tag!('contact:id', @contact.code)
xml.tag!('contact:crDate', @contact.created_at.try(:iso8601))
end

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('contact:infData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
xml.tag!('contact:infData', 'xmlns:contact' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd') do
xml.tag!('contact:id', @contact.code)
xml.tag!('contact:roid', @contact.roid)

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('contact:creData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
xml.tag!('contact:creData', 'xmlns:contact' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd') do
xml.tag!('contact:id', @contact.code)
xml.tag!('contact:crDate', @contact.created_at.try(:iso8601))
end

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('domain:chkData', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do
xml.tag!('domain:chkData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do
@domains.each do |x|
xml.tag!('domain:cd') do
xml.tag!('domain:name', x[:name], 'avail' => x[:avail])

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('domain:creData', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do
xml.tag!('domain:creData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do
xml.tag!('domain:name', @domain.name)
xml.tag!('domain:crDate', @domain.created_at.try(:iso8601))
xml.tag!('domain:exDate', @domain.valid_to.try(:iso8601))

View file

@ -5,12 +5,11 @@ xml.epp_head do
end
xml.resData do
xml.tag!('domain:infData', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do
xml.tag!('domain:infData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do
xml.tag!('domain:name', @domain.name)
xml.tag!('domain:roid', @domain.roid)
@domain.domain_statuses.each do |ds|
xml.tag!('domain:status', ds.description, 's' => ds.value) unless ds.description.blank?
xml.tag!('domain:status', 's' => ds.value) if ds.description.blank?
@domain.statuses.each do |s|
xml.tag!('domain:status', 's' => s)
end
xml.tag!('domain:registrant', @domain.registrant_code)

View file

@ -1,4 +1,4 @@
builder.tag!('domain:trnData', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do
builder.tag!('domain:trnData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do
builder.tag!('domain:name', dt.domain_name)
builder.tag!('domain:trStatus', dt.status)
builder.tag!('domain:reID', dt.transfer_to.code)

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('domain:renData', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do
xml.tag!('domain:renData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do
xml.tag!('domain:name', @domain[:name])
xml.tag!('domain:exDate', @domain.valid_to.try(:iso8601))
end

View file

@ -0,0 +1,8 @@
xml.epp_head do
xml.response do
xml.result('code' => '2306') do
xml.msg('Parameter value policy error. Allowed only Latin characters.', 'lang' => 'en')
end
render('epp/shared/trID', builder: xml)
end
end

View file

@ -2,7 +2,7 @@ xml.instruct!(:xml, standalone: 'no')
xml.epp(
'xmlns' => 'urn:ietf:params:xml:ns:epp-1.0',
'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1',
'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0',
'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd',
'xmlns:keyrelay' => 'urn:ietf:params:xml:ns:keyrelay-1.0'
) do
xml.response do

View file

@ -5,8 +5,8 @@ xml.epp_head do
xml.svcMenu do
xml.version '1.0'
xml.lang 'en'
xml.objURI 'urn:ietf:params:xml:ns:domain-1.0'
xml.objURI 'urn:ietf:params:xml:ns:contact-1.0'
xml.objURI 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd'
xml.objURI 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd'
xml.objURI 'urn:ietf:params:xml:ns:host-1.0'
xml.objURI 'urn:ietf:params:xml:ns:keyrelay-1.0'
xml.svcExtension do

View file

@ -65,7 +65,7 @@
-# %li= link_to t(:domains_history), admin_domain_versions_path
%li= link_to t(:epp_logs), admin_epp_logs_path
%li= link_to t(:repp_logs), admin_repp_logs_path
-# %li= link_to t(:background_jobs), admin_delayed_jobs_path
%li= link_to t(:que), '/admin/que'
- if signed_in?
%ul.nav.navbar-nav.navbar-right

View file

@ -30,8 +30,8 @@
%p= t(:new_pending_registrant) + ':'
.column-values
%p= @domain.name
%p= @domain.registrant_name
%p= @domain.pending_registrant_name
%p= "#{@domain.registrant_name} (#{@domain.registrant.ident})"
%p= "#{@domain.pending_registrant.try(:name)} (#{@domain.pending_registrant.try(:ident)})"
.row
.col-md-12.text-center

View file

@ -7,7 +7,9 @@
%dd= @contact.id
%dt= t(:password)
%dd= @contact.password
%dd
= text_field_tag :password, @contact.password, readonly: true, class: 'partially-hidden'
%br

View file

@ -3,7 +3,7 @@
<command>
<check>
<contact:check
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id>
</contact:check>
</check>

View file

@ -3,7 +3,7 @@
<command>
<check>
<contact:check
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id>
<contact:id>sh13</contact:id>
<contact:id>vsdfvq</contact:id>

View file

@ -2,7 +2,7 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<create>
<contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:create xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:postalInfo>
<contact:name>Sillius Soddus</contact:name>
<contact:addr>

View file

@ -3,7 +3,7 @@
<command>
<delete>
<contact:delete
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id>
<contact:authInfo>
<contact:pw>wrong-one</contact:pw>

View file

@ -2,7 +2,7 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<contact:info xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:info xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id>
<contact:authInfo>
<contact:pw>Aas34fq</contact:pw>

View file

@ -2,7 +2,7 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<update>
<contact:update xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:update xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id>
<contact:chg>
<contact:postalInfo>

View file

@ -3,7 +3,7 @@
<command>
<check>
<domain:check
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name>
</domain:check>
</check>

View file

@ -3,7 +3,7 @@
<command>
<create>
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name>
<domain:period unit="y">1</domain:period>
<domain:ns>

View file

@ -3,7 +3,7 @@
<command>
<delete>
<domain:delete
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name>
</domain:delete>
</delete>

View file

@ -3,7 +3,7 @@
<command>
<info>
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
<domain:name hosts="all">example.ee</domain:name>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>

View file

@ -3,7 +3,7 @@
<command>
<renew>
<domain:renew
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name>
<domain:curExpDate>2014-08-07</domain:curExpDate>
<domain:period unit="y">1</domain:period>

View file

@ -3,7 +3,7 @@
<command>
<transfer op="query">
<domain:transfer
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name>
<domain:authInfo>
<domain:pw roid="JD1234-REP">2BARfoo</domain:pw>

View file

@ -3,7 +3,7 @@
<command>
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name>
<domain:chg>
<domain:registrant>mak21</domain:registrant>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns:ext="urn:ietf:params:xml:ns:keyrelay-1.0">
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd" xmlns:ext="urn:ietf:params:xml:ns:keyrelay-1.0">
<command>
<ext:keyrelay>
<ext:name>example6.ee</ext:name>

View file

@ -4,6 +4,7 @@ app_name: '.EE Registry'
zonefile_export_dir: 'export/zonefiles'
bank_statement_import_dir: 'import/bank_statements'
legal_documents_dir: 'import/legal_documents'
time_zone: 'Tallinn' # more zones by rake time:zones:all
# New Relic app name, keep only current mode, remove other names.
# Example: 'Admin, EPP, REPP' will have name 'Admin, EPP, REPP - production' at New Relic.

View file

@ -21,7 +21,8 @@ module Registry
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'UTC' # NB! It should be defined, otherwise ActiveRecord usese other class.
config.time_zone = ENV['time_zone'] # NB! It should be defined,
# otherwise ActiveRecord usese other class internally.
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
@ -49,6 +50,8 @@ module Registry
# Instead, the errors will propagate normally just like in other Active Record callbacks.
config.active_record.raise_in_transactional_callbacks = true
config.active_record.schema_format = :sql
config.generators do |g|
g.stylesheets false
g.javascripts false

View file

@ -37,6 +37,8 @@ Rails.application.configure do
# For rails-settings-cached conflict
config.cache_store = :file_store, 'tmp/cache_test'
config.time_zone = 'UTC'
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

View file

@ -10,6 +10,7 @@ required = %w(
webclient_ip
legal_documents_dir
bank_statement_import_dir
time_zone
)
Figaro.require_keys(required)

View file

@ -0,0 +1 @@
Que.mode = :off

View file

@ -1,6 +1,4 @@
TEST_EMAILS = %w(
martin@gitlab.eu
priit@gitlab.eu
timo.vohmar@internet.ee
rene.vahtel@internet.ee
martin.mettig@internet.ee
@ -9,6 +7,9 @@ TEST_EMAILS = %w(
norman.aeg@internet.ee
martti.oigus@internet.ee
jana.jarve@internet.ee
martin@gitlab.eu
priit@gitlab.eu
info@gitlab.eu
test@example.com
test@example.org
)

View file

@ -100,6 +100,8 @@ en:
invalid: 'Statuses are invalid'
not_found: 'Status was not found'
taken: 'Status already exists on this domain'
statuses:
taken: 'Status already exists on this domain'
registrar:
blank: 'Registrar is missing'
dnskeys:
@ -788,8 +790,8 @@ en:
reject_domain_registrant_update: 'Reject domain ownership change'
domain_registrant_change_title: 'Please confirm or reject domain ownership change'
domain_registrant_change_body: 'There is a request to change domain ownership. Before doing it we need your confirmation.'
new_pending_registrant: 'New owner'
current_registrant: 'Current owner'
new_pending_registrant: 'New registrant'
current_registrant: 'Current registrant'
registrant_domain_verification_failed: 'Domain verification not available'
domain_registrant_change_confirmed_title: 'Domain owner change has been confirmed'
domain_registrant_change_confirmed_body: 'You have successfully confirmed domain owner change.'
@ -820,3 +822,5 @@ en:
object_is_not_eligible_for_renewal: 'Object is not eligible for renewal'
set_force_delete: 'Set force delete'
unset_force_delete: 'Unset force delete'
domain_expiring: 'Domain expiring'
domain_validation_rules: 'Domain validation rules'

View file

@ -224,6 +224,10 @@ Rails.application.routes.draw do
get 'logout' => '/devise/sessions#destroy'
end
authenticate :user do
mount Que::Web, at: 'que'
end
root 'dashboards#show'
end

View file

@ -1 +1,8 @@
worker_processes 2
# after_fork do |server, worker|
# binding.pry
# ActiveRecord::Base.establish_connection
# Que.mode = :async
# end

View file

@ -0,0 +1,15 @@
class RefactorDomainStatuses < ActiveRecord::Migration
def self.up
Domain.all.each do |x|
x.statuses = []
x.domain_statuses.each do |ds|
x.statuses << ds.value
end
x.save
end
end
def self.down
raise ActiveRecord::IrreversibleMigration
end
end

View file

@ -0,0 +1,11 @@
class AddQue < ActiveRecord::Migration
def self.up
# The current version as of this migration's creation.
Que.migrate! :version => 3
end
def self.down
# Completely removes Que's job queue.
Que.migrate! :version => 0
end
end

View file

@ -0,0 +1,5 @@
class AddStatusesToDomain < ActiveRecord::Migration
def change
add_column :domains, :statuses, :string, array: true
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150609103333) do
ActiveRecord::Schema.define(version: 20150612123111) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -19,7 +19,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
create_table "account_activities", force: :cascade do |t|
t.integer "account_id"
t.integer "invoice_id"
t.decimal "sum", precision: 10, scale: 2
t.decimal "sum", precision: 8, scale: 2
t.string "currency"
t.integer "bank_transaction_id"
t.datetime "created_at"
@ -36,7 +36,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
create_table "accounts", force: :cascade do |t|
t.integer "registrar_id"
t.string "account_type"
t.decimal "balance", precision: 10, scale: 2, default: 0.0, null: false
t.decimal "balance", precision: 8, scale: 2, default: 0.0, null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "currency"
@ -98,7 +98,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "buyer_name"
t.string "document_no"
t.string "description"
t.decimal "sum", precision: 10, scale: 2
t.decimal "sum", precision: 8, scale: 2
t.string "reference_no"
t.datetime "paid_at"
t.datetime "created_at"
@ -114,7 +114,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "vk_rec_id"
t.string "vk_stamp"
t.string "vk_t_no"
t.decimal "vk_amount", precision: 10, scale: 2
t.decimal "vk_amount", precision: 8, scale: 2
t.string "vk_curr"
t.string "vk_rec_acc"
t.string "vk_rec_name"
@ -203,6 +203,12 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "updator_str"
end
create_table "data_migrations", id: false, force: :cascade do |t|
t.string "version", null: false
end
add_index "data_migrations", ["version"], name: "unique_data_migrations", unique: true, using: :btree
create_table "delegation_signers", force: :cascade do |t|
t.integer "domain_id"
t.string "key_tag"
@ -306,6 +312,8 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.datetime "registrant_verification_asked_at"
t.string "registrant_verification_token"
t.json "pending_json"
t.datetime "force_delete_at"
t.string "statuses", array: true
end
add_index "domains", ["delete_at"], name: "index_domains_on_delete_at", using: :btree
@ -331,7 +339,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "description", null: false
t.string "unit"
t.integer "amount"
t.decimal "price", precision: 10, scale: 2
t.decimal "price", precision: 8, scale: 2
t.datetime "created_at"
t.datetime "updated_at"
t.string "creator_str"
@ -349,7 +357,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "currency", null: false
t.string "description"
t.string "reference_no"
t.decimal "vat_prc", precision: 10, scale: 2, null: false
t.decimal "vat_prc", precision: 8, scale: 2, null: false
t.datetime "paid_at"
t.integer "seller_id"
t.string "seller_name", null: false
@ -382,7 +390,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "updator_str"
t.integer "number"
t.datetime "cancelled_at"
t.decimal "sum_cache", precision: 10, scale: 2
t.decimal "sum_cache", precision: 8, scale: 2
end
add_index "invoices", ["buyer_id"], name: "index_invoices_on_buyer_id", using: :btree
@ -900,6 +908,17 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "operation_category"
end
create_table "que_jobs", id: false, force: :cascade do |t|
t.integer "priority", limit: 2, default: 100, null: false
t.datetime "run_at", default: "now()", null: false
t.integer "job_id", limit: 8, default: "nextval('que_jobs_job_id_seq'::regclass)", null: false
t.text "job_class", null: false
t.json "args", default: [], null: false
t.integer "error_count", default: 0, null: false
t.text "last_error"
t.text "queue", default: "", null: false
end
create_table "registrant_verifications", force: :cascade do |t|
t.string "domain_name"
t.string "verification_token"
@ -983,7 +1002,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.text "crt"
t.string "type"
t.string "registrant_ident"
t.string "encrypted_password", default: ""
t.string "encrypted_password", default: "", null: false
t.datetime "remember_created_at"
t.integer "failed_attempts", default: 0, null: false
t.datetime "locked_at"

4733
db/structure.sql Normal file

File diff suppressed because it is too large Load diff

View file

@ -18,8 +18,8 @@ Our implementation supports following protocols:
Related XML Schema Definitions (may differ from policies applied to registry):
[contact-1.0.xsd](schemas/contact-1.0.xsd)
[domain-1.0.xsd](schemas/domain-1.0.xsd)
[contact-eis-1.0.xsd](schemas/contact-eis-1.0.xsd)
[domain-eis-1.0.xsd](schemas/domain-eis-1.0.xsd)
[eis-1.0.xsd](schemas/eis-1.0.xsd)
[epp-1.0.xsd](schemas/epp-1.0.xsd)
[eppcom-1.0.xsd](schemas/eppcom-1.0.xsd)

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,7 @@ Contact Mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<create> 1
<contact:create> 1 Attribute: xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
<contact:create> 1 Attribute: xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"
<contact:id> 0-1 Contact id, optional, generated automatically if missing
<contact:postalInfo> 1 Postal information container
<contact:name> 1 Full name of the contact
@ -45,7 +45,7 @@ Contact Mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<update> 1
<contact:update> 1 Attribute: xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
<contact:update> 1 Attribute: xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"
<contact:id> 1 Contact id, required
<contact:chg> 1 Change container
<contact:postalInfo> 1 Postal information container
@ -82,7 +82,7 @@ Contact Mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<delete> 1
<contact:delete> 1 Attribute: xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
<contact:delete> 1 Attribute: xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"
<contact:id> 1 Contact id
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
<contact:pw> 1 Contact password. Attribute: roid="String"
@ -100,7 +100,7 @@ Contact Mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<check> 1
<contact:check> 1 Attribute: xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
<contact:check> 1 Attribute: xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"
<contact:id> 1-n Contact id
<clTRID> 0-1 Client transaction id
@ -112,7 +112,7 @@ Contact Mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<info> 1
<contact:info> 1 Attribute: xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
<contact:info> 1 Attribute: xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"
<contact:id> 1-n Contact id
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
<contact:pw> 1 Contact password. Attribute: roid="String"

View file

@ -13,7 +13,7 @@ Domain name mapping protocol short version:
Field name Min-max Field description
------------------------- ------- -----------------
<create> 1
<domain:create> 1 Attribute: xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
<domain:create> 1 Attribute: xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters.
<domain:period> 0-1 Registration period for domain.
Must add up to 1 / 2 / 3 years.
@ -47,7 +47,7 @@ Domain name mapping protocol short version:
Field name Min-max Field description
------------------------ -------- -----------------
<update> 1
<domain:update> 1 Attribute: xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
<domain:update> 1 Attribute: xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters.
<domain:chg> 0-1 Attributes to change
<domain:registrant> 0-1 Contact reference to the registrant
@ -94,7 +94,7 @@ Domain name mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<delete> 1
<domain:delete> 1 Attribute: xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
<domain:delete> 1 Attribute: xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"
Optional attribute: verified="yes/no"
<domain:name> 1 Domain name. Can contain unicode characters.
<extension> 1
@ -110,7 +110,7 @@ Domain name mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<info> 1
<domain:info> 1 Attribute: xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
<domain:info> 1 Attribute: xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters.
Attribute: hosts="all / del / sub / none"
<domain:authInfo> 0-1 Required if registrar is not the owner of the domain.
@ -124,7 +124,7 @@ Domain name mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<renew> 1
<domain:renew> 1 Attribute: xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
<domain:renew> 1 Attribute: xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters.
<domain:curExpDate> 1 Current expiry date (ISO8601 format)
<domain:period> 1 Registration period for domain.
@ -142,7 +142,7 @@ Domain name mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<transfer> 1
<domain:transfer> 1 Attribute: xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
<domain:transfer> 1 Attribute: xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters.
<domain:authInfo> 1
<domain:pw> 1 Domain password. Attribute: roid="String"
@ -159,7 +159,7 @@ Domain name mapping protocol short version:
Field name Min-max Field description
----------------------- ------- -----------------
<check> 1
<domain:check> 1 Attribute: xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
<domain:check> 1 Attribute: xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters.
<clTRID> 0-1 Client transaction id

View file

@ -17,6 +17,7 @@ Here are functions like login, logout, hello, poll
<login> 1
<clID> 1 Username
<pw> 1 Password
<newPW> 0-1 Optional new password for EPP user
<options> 0-1
<version> 0-1 1.0
<lang> 0-1 en

View file

@ -1,7 +1,14 @@
# REPP integration specification
REPP uses currently Basic Authentication (http://tools.ietf.org/html/rfc2617#section-2) with ssl certificate and key.
Credentials and certificate are issued by EIS (in an exchange for desired API username, CSR (where CN must match username) and IP).
REPP uses HTTP/1.1 protocol (http://www.ietf.org/rfc/rfc2616.txt) and
Basic Authentication (http://tools.ietf.org/html/rfc2617#section-2) using
Secure Transport (https://tools.ietf.org/html/rfc5246) with certificate and key (https://tools.ietf.org/html/rfc5280).
Credentials and certificate are issued by EIS (in an exchange for desired API username, CSR and IP).
To quickly test the API, use curl:
curl -q -k --cert user.crt.pem --key user.key.pem https://TBA/repp/v1/accounts/balance -u username:password
Test API endpoint: TBA
Production API endpoint: TBA

View file

@ -10,8 +10,8 @@
<!--
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="doc/schemas/eppcom-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0" schemaLocation="doc/schemas/epp-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
<annotation>
<documentation>
@ -25,7 +25,7 @@
-->
<element name="check" type="contact:mIDType"/>
<element name="create" type="contact:createType"/>
<element name="delete" type="contact:authIDType"/>
<element name="delete" type="contact:sIDType"/>
<element name="info" type="contact:authIDType"/>
<element name="transfer" type="contact:authIDType"/>
<element name="update" type="contact:updateType"/>
@ -38,6 +38,7 @@
<length value="2"/>
</restriction>
</simpleType>
<complexType name="e164Type">
<simpleContent>
<extension base="contact:e164StringType">
@ -48,7 +49,7 @@
<simpleType name="e164StringType">
<restriction base="token">
<!--<pattern value="(\+[0-9]{1,3}\.[0-9]{1,14})?"/> -->
<pattern value="(\+[0-9]{1,3}\.[0-9]{1,14})?"/>
<maxLength value="17"/>
</restriction>
</simpleType>
@ -77,7 +78,7 @@
-->
<complexType name="createType">
<sequence>
<element name="id" type="eppcom:clIDType" minOccurs="0"/>
<element name="id" type="eppcom:clIDType"/>
<element name="postalInfo" type="contact:postalInfoType"
maxOccurs="2"/>
<element name="voice" type="contact:e164Type"
@ -85,8 +86,9 @@
<element name="fax" type="contact:e164Type"
minOccurs="0"/>
<element name="email" type="eppcom:minTokenType"/>
<element name="authInfo" type="contact:authInfoType" minOccurs="0"/>
<element name="authInfo" type="contact:authInfoType"/>
<element name="disclose" type="contact:discloseType"
minOccurs="0"/>
</sequence>
</complexType>
@ -97,7 +99,8 @@
minOccurs="0"/>
<element name="addr" type="contact:addrType"/>
</sequence>
<attribute name="type" type="contact:postalInfoEnumType"/>
<attribute name="type" type="contact:postalInfoEnumType"
use="required"/>
</complexType>
<simpleType name="postalInfoEnumType">
@ -127,6 +130,21 @@
</choice>
</complexType>
<complexType name="discloseType">
<sequence>
<element name="name" type="contact:intLocType"
minOccurs="0" maxOccurs="2"/>
<element name="org" type="contact:intLocType"
minOccurs="0" maxOccurs="2"/>
<element name="addr" type="contact:intLocType"
minOccurs="0" maxOccurs="2"/>
<element name="voice" minOccurs="0"/>
<element name="fax" minOccurs="0"/>
<element name="email" minOccurs="0"/>
</sequence>
<attribute name="flag" type="boolean" use="required"/>
</complexType>
<complexType name="intLocType">
<attribute name="type" type="contact:postalInfoEnumType"
use="required"/>
@ -202,6 +220,8 @@
minOccurs="0"/>
<element name="authInfo" type="contact:authInfoType"
minOccurs="0"/>
<element name="disclose" type="contact:discloseType"
minOccurs="0"/>
</sequence>
</complexType>
@ -214,7 +234,8 @@
<element name="addr" type="contact:addrType"
minOccurs="0"/>
</sequence>
<attribute name="type" type="contact:postalInfoEnumType"/>
<attribute name="type" type="contact:postalInfoEnumType"
use="required"/>
</complexType>
<!--
@ -290,6 +311,8 @@
minOccurs="0"/>
<element name="authInfo" type="contact:authInfoType"
minOccurs="0"/>
<element name="disclose" type="contact:discloseType"
minOccurs="0"/>
</sequence>
</complexType>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="urn:ietf:params:xml:ns:contact-1.0"
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
<schema targetNamespace="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"

View file

@ -11,10 +11,9 @@
<!--
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="doc/schemas/eppcom-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0" schemaLocation="doc/schemas/epp-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:host-1.0" schemaLocation="doc/schemas/host-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1" schemaLocation="doc/schemas/secDNS-1.1.xsd"/>
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
<import namespace="urn:ietf:params:xml:ns:host-1.0"/>
<annotation>
<documentation>
@ -47,7 +46,7 @@
minOccurs="0"/>
<element name="contact" type="domain:contactType"
minOccurs="0" maxOccurs="unbounded"/>
<element name="authInfo" type="domain:authInfoType" minOccurs="0"/>
<element name="authInfo" type="domain:authInfoType"/>
</sequence>
</complexType>
@ -63,7 +62,7 @@
<simpleType name="pLimitType">
<restriction base="unsignedShort">
<minInclusive value="1"/>
<maxInclusive value="1095"/>
<maxInclusive value="99"/>
</restriction>
</simpleType>
@ -71,7 +70,6 @@
<restriction base="token">
<enumeration value="y"/>
<enumeration value="m"/>
<enumeration value="d"/>
</restriction>
</simpleType>
@ -91,7 +89,6 @@
<sequence>
<element name="hostName" type="eppcom:labelType"/>
<element name="hostAddr" type="host:addrType"
minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -240,29 +237,13 @@
Allow the registrant value to be nullified by changing the
minLength restriction to "0".
-->
<complexType name="clIDChgType">
<simpleContent>
<extension base="domain:clIDChgSimpleType">
<attribute name="verified" type="domain:verifiedType"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="clIDChgSimpleType">
<simpleType name="clIDChgType">
<restriction base="token">
<minLength value="0"/>
<maxLength value="16"/>
</restriction>
</simpleType>
<simpleType name="verifiedType">
<restriction base="token">
<enumeration value="yes"/>
<enumeration value="no"/>
</restriction>
</simpleType>
<!--
Allow the authInfo value to be nullified by including an
empty element within the choice.
@ -444,6 +425,7 @@
minOccurs="0"/>
</sequence>
</complexType>
<!--
End of schema.
-->

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="urn:ietf:params:xml:ns:domain-1.0"
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
<schema targetNamespace="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"
xmlns:host="urn:ietf:params:xml:ns:host-1.0"
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"

View file

@ -2,6 +2,7 @@ class DeviseCustomFailure < Devise::FailureApp
def redirect_url
return registrant_login_url if request.original_fullpath.to_s.match(/^\/registrant/)
return registrar_login_url if request.original_fullpath.to_s.match(/^\/registrar/)
return '/admin' if request.original_fullpath.to_s.match(%r{^\/admin\/que})
return admin_login_url if request.original_fullpath.to_s.match(/^\/admin/)
root_url
end

View file

@ -1,7 +1,7 @@
class EppConstraint
OBJECT_TYPES = {
domain: { domain: 'urn:ietf:params:xml:ns:domain-1.0' },
contact: { contact: 'urn:ietf:params:xml:ns:contact-1.0' }
domain: { domain: 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd' },
contact: { contact: 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd' }
}
def initialize(type)

View file

@ -224,6 +224,7 @@ namespace :import do
legacy_id
legacy_registrar_id
legacy_registrant_id
statuses
)
domain_contact_columns = %w(
@ -234,6 +235,7 @@ namespace :import do
legacy_contact_id
)
# rubocop: disable Lint/UselessAssignment
domain_status_columns = %w(
description
value
@ -241,6 +243,7 @@ namespace :import do
updator_str
legacy_domain_id
)
# rubocop: enable Lint/UselessAssignment
nameserver_columns = %w(
hostname
@ -263,7 +266,7 @@ namespace :import do
legacy_domain_id
)
domains, nameservers, dnskeys, domain_statuses, domain_contacts = [], [], [], [], []
domains, nameservers, dnskeys, domain_contacts = [], [], [], []
existing_domain_ids = Domain.pluck(:legacy_id)
user = "rake-#{`whoami`.strip} #{ARGV.join ' '}"
count = 0
@ -281,6 +284,18 @@ namespace :import do
count += 1
begin
# domain statuses
domain_statuses = []
ok = true
x.object_states.each do |state|
next if state.name.blank?
domain_statuses << state.name
ok = false
end
# OK status is default
domain_statuses << DomainStatus::OK if ok
domains << [
x.object_registry.name.try(:strip),
x.object_registry.try(:crdate),
@ -296,7 +311,8 @@ namespace :import do
user,
x.id,
x.object_registry.try(:crid),
x.registrant
x.registrant,
domain_statuses
]
# admin contacts
@ -321,31 +337,6 @@ namespace :import do
]
end
# domain statuses
ok = true
x.object_states.each do |state|
next if state.name.blank?
domain_statuses << [
state.desc,
state.name,
user,
user,
x.id
]
ok = false
end
# OK status is default
if ok
domain_statuses << [
nil,
DomainStatus::OK,
user,
user,
x.id
]
end
# nameservers
x.nsset.hosts.each do |host|
ip_maps = host.host_ipaddr_maps
@ -384,9 +375,8 @@ namespace :import do
Domain.import domain_columns, domains, validate: false
Nameserver.import nameserver_columns, nameservers, validate: false
Dnskey.import dnskey_columns, dnskeys, validate: false
DomainStatus.import domain_status_columns, domain_statuses, validate: false
DomainContact.import domain_contact_columns, domain_contacts, validate: false
domains, nameservers, dnskeys, domain_statuses, domain_contacts = [], [], [], [], []
domains, nameservers, dnskeys, domain_contacts = [], [], [], []
end
rescue => e
puts "ERROR on index #{index}"
@ -397,7 +387,6 @@ namespace :import do
Domain.import domain_columns, domains, validate: false
Nameserver.import nameserver_columns, nameservers, validate: false
Dnskey.import dnskey_columns, dnskeys, validate: false
DomainStatus.import domain_status_columns, domain_statuses, validate: false
DomainContact.import domain_contact_columns, domain_contacts, validate: false
puts '-----> Updating relations...'
@ -461,16 +450,6 @@ namespace :import do
"AND domain_id IS NULL"
)
# statuses
ActiveRecord::Base.connection.execute(
"UPDATE domain_statuses "\
"SET domain_id = domains.id "\
"FROM domains "\
"WHERE domains.legacy_id = legacy_domain_id "\
"AND legacy_domain_id IS NOT NULL "\
"AND domain_id IS NULL"
)
puts '-----> Generating dnskey digests...'
Dnskey.all.each do |x|

View file

@ -975,7 +975,7 @@ describe 'EPP Contact', epp: true do
<command>
<check>
<contact:check
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>FIXED:CHECK-1234</contact:id>
<contact:id>check-4321</contact:id>
</contact:check>
@ -991,7 +991,7 @@ describe 'EPP Contact', epp: true do
<command>
<check>
<contact:check
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>FIXED:CHECK-LEGACY</contact:id>
<contact:id>CID:FIXED:CHECK-LEGACY</contact:id>
</contact:check>

View file

@ -317,7 +317,7 @@ describe 'EPP Domain', epp: true do
response = epp_plain_request(xml)
response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000'
Domain.first.valid_to.should be_within(5).of(1.year.since)
Domain.first.valid_to.should be_within(60).of(1.year.since)
end
it 'does not create a domain with invalid period' do
@ -1501,7 +1501,8 @@ describe 'EPP Domain', epp: true do
end
it 'should not allow any update when status pending update' do
domain.domain_statuses.create(value: DomainStatus::PENDING_UPDATE)
domain.statuses << DomainStatus::PENDING_UPDATE
domain.save
existing_pw = domain.auth_info
@ -1592,11 +1593,10 @@ describe 'EPP Domain', epp: true do
new_contact = d.tech_contacts.find_by(code: 'FIXED:MAK21')
new_contact.should be_truthy
d.domain_statuses.count.should == 2
d.domain_statuses.first.description.should == 'Payment overdue.'
d.domain_statuses.first.value.should == 'clientHold'
d.statuses.count.should == 2
d.statuses.include?('clientHold').should == true
d.statuses.include?('clientUpdateProhibited').should == true
d.domain_statuses.last.value.should == 'clientUpdateProhibited'
d.dnskeys.count.should == 2
response = epp_plain_request(xml)
@ -1621,39 +1621,39 @@ describe 'EPP Domain', epp: true do
response[:results][2][:msg].should == 'Contact already exists on this domain [contact_code_cache]'
response[:results][2][:value].should == 'FIXED:MAK21'
response[:results][3][:msg].should == 'Status already exists on this domain [value]'
if response[:results][3][:value] == 'clientHold'
response[:results][3][:value].should == 'clientHold'
else
response[:results][3][:value].should == 'clientUpdateProhibited'
end
# response[:results][3][:msg].should == 'Status already exists on this domain [value]'
# if response[:results][3][:value] == 'clientHold'
# response[:results][3][:value].should == 'clientHold'
# else
# response[:results][3][:value].should == 'clientUpdateProhibited'
# end
response[:results][4][:msg].should == 'Status already exists on this domain [value]'
if response[:results][4][:value] == 'clientHold'
response[:results][4][:value].should == 'clientHold'
else
response[:results][4][:value].should == 'clientUpdateProhibited'
end
# response[:results][4][:msg].should == 'Status already exists on this domain [value]'
# if response[:results][4][:value] == 'clientHold'
# response[:results][4][:value].should == 'clientHold'
# else
# response[:results][4][:value].should == 'clientUpdateProhibited'
# end
response[:results][5][:msg].should == 'Public key already exists [public_key]'
if response[:results][5][:value] == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f'
response[:results][5][:value].should ==
response[:results][3][:msg].should == 'Public key already exists [public_key]'
if response[:results][3][:value] == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f'
response[:results][3][:value].should ==
'700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f'
else
response[:results][5][:value].should ==
response[:results][3][:value].should ==
'841936717ae427ace63c28d04918569a841936717ae427ace63c28d0'
end
response[:results][6][:msg].should == 'Public key already exists [public_key]'
if response[:results][6][:value] == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f'
response[:results][6][:value].should ==
response[:results][4][:msg].should == 'Public key already exists [public_key]'
if response[:results][4][:value] == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f'
response[:results][4][:value].should ==
'700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f'
else
response[:results][6][:value].should ==
response[:results][4][:value].should ==
'841936717ae427ace63c28d04918569a841936717ae427ace63c28d0'
end
d.domain_statuses.count.should == 2
d.statuses.count.should == 2
end
it 'updates domain with registrant change what triggers action pending' do
@ -1729,8 +1729,8 @@ describe 'EPP Domain', epp: true do
new_contact = d.tech_contacts.find_by(code: 'FIXED:PENDINGMAK21')
new_contact.should_not be_truthy # aka should not add new contact
d.domain_statuses.count.should == 1
d.domain_statuses.first.value.should == 'pendingUpdate'
d.statuses.count.should == 1
d.statuses.first.should == 'pendingUpdate'
d.dnskeys.count.should == 0
end
@ -1840,10 +1840,11 @@ describe 'EPP Domain', epp: true do
response[:results][0][:msg].should == 'Command completed successfully'
response[:results][0][:result_code].should == '1000'
d.reload
d.dnskeys.count.should == 1
d.domain_statuses.count.should == 1
d.domain_statuses.first.value.should == 'clientUpdateProhibited'
d.statuses.count.should == 1
d.statuses.first.should == 'clientUpdateProhibited'
rem_ns = d.nameservers.find_by(hostname: 'ns1.example.com')
rem_ns.should be_falsey
@ -1862,13 +1863,17 @@ describe 'EPP Domain', epp: true do
response[:results][1][:value].should == 'FIXED:CITIZEN_1234'
response[:results][2][:result_code].should == '2303'
response[:results][2][:msg].should == 'Status was not found'
response[:results][2][:value].should == 'clientHold'
response[:results][2][:msg].should == 'DS was not found'
response[:results][2][:value].should == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f'
response[:results][3][:result_code].should == '2303'
response[:results][3][:msg].should == 'Status was not found'
response[:results][3][:value].should == 'clientHold'
end
it 'does not remove server statuses' do
d = Domain.last
d.domain_statuses.create(value: DomainStatus::SERVER_HOLD)
domain.statuses << DomainStatus::SERVER_HOLD
domain.save
xml = domain_update_xml({
name: { value: domain.name },
@ -2079,9 +2084,10 @@ describe 'EPP Domain', epp: true do
Domain.start_expire_period
Domain.start_redemption_grace_period
domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 1
domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 1
domain.domain_statuses.where(value: DomainStatus::OK).count.should == 0
domain.reload
domain.statuses.include?(DomainStatus::EXPIRED).should == true
domain.statuses.include?(DomainStatus::SERVER_HOLD).should == true
domain.statuses.include?(DomainStatus::OK).should == false
exp_date = domain.valid_to.to_date
@ -2095,9 +2101,10 @@ describe 'EPP Domain', epp: true do
response[:results][0][:msg].should == 'Command completed successfully'
response[:results][0][:result_code].should == '1000'
domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 0
domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 0
domain.domain_statuses.where(value: DomainStatus::OK).count.should == 1
domain.reload
domain.statuses.include?(DomainStatus::EXPIRED).should == false
domain.statuses.include?(DomainStatus::SERVER_HOLD).should == false
domain.statuses.include?(DomainStatus::OK).should == true
domain.reload
domain.valid_to.should be_within(5).of(new_valid_to)
@ -2122,7 +2129,7 @@ describe 'EPP Domain', epp: true do
### INFO ###
it 'returns domain info' do
domain.domain_statuses.build(value: DomainStatus::CLIENT_HOLD, description: 'Payment overdue.')
domain.statuses << DomainStatus::CLIENT_HOLD
domain.nameservers.build(hostname: 'ns1.example.com', ipv4: '192.168.1.1', ipv6: '1080:0:0:0:8:800:200C:417A')
domain.dnskeys.build(
@ -2157,7 +2164,6 @@ describe 'EPP Domain', epp: true do
inf_data = response[:parsed].css('resData infData')
inf_data.css('name').text.should == domain.name
inf_data.css('status').text.should == 'Payment overdue.'
inf_data.css('status').first[:s].should == 'clientHold'
inf_data.css('registrant').text.should == domain.registrant_code
inf_data.css('roid').text.should == domain.roid
@ -2318,7 +2324,8 @@ describe 'EPP Domain', epp: true do
end
it 'does not delete domain with specific status' do
domain.domain_statuses.create(value: DomainStatus::CLIENT_DELETE_PROHIBITED)
domain.statuses << DomainStatus::CLIENT_DELETE_PROHIBITED
domain.save
response = epp_plain_request(@epp_xml.domain.delete({
name: { value: domain.name }
@ -2336,7 +2343,8 @@ describe 'EPP Domain', epp: true do
end
it 'does not delete domain with pending delete' do
domain.domain_statuses.create(value: DomainStatus::PENDING_DELETE)
domain.statuses << DomainStatus::PENDING_DELETE
domain.save
response = epp_plain_request(@epp_xml.domain.delete({
name: { value: domain.name }

View file

@ -4,6 +4,7 @@ describe 'EPP Helper', epp: true do
context 'in context of Domain' do
before(:all) { @uniq_no = proc { @i ||= 0; @i += 1 } }
# rubocop: disable Metrics/LineLength
it 'generates valid transfer xml' do
dn = next_domain_name
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@ -11,7 +12,7 @@ describe 'EPP Helper', epp: true do
<command>
<transfer op="query">
<domain:transfer
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
<domain:name>' + dn + '</domain:name>
<domain:authInfo>
<domain:pw roid="citizen_1234-REP">98oiewslkfkd</domain:pw>
@ -31,7 +32,7 @@ describe 'EPP Helper', epp: true do
<command>
<transfer op="approve">
<domain:transfer
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
<domain:name>one.ee</domain:name>
<domain:authInfo>
<domain:pw roid="askdf">test</domain:pw>
@ -53,5 +54,6 @@ describe 'EPP Helper', epp: true do
generated = Nokogiri::XML(xml).to_s.squish
generated.should == expected
end
# rubocop: enable Metrics/LineLength
end
end

View file

@ -3,7 +3,7 @@
<command>
<create>
<contact:create
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>loc_int</contact:id>
<contact:postalInfo type="int">
<contact:name>John Doe Int</contact:name>

View file

@ -3,7 +3,7 @@
<command>
<delete>
<contact:delete
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>dwa1234</contact:id>
</contact:delete>
</delete>

View file

@ -3,7 +3,7 @@
<command>
<delete>
<contact:delete
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
</contact:delete>
</delete>
<clTRID>ABC-12345</clTRID>

View file

@ -3,7 +3,7 @@
<command>
<info>
<contact:info
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>info-4444</contact:id>
<contact:authInfo>
<contact:pw>2fooBAR</contact:pw>

View file

@ -3,7 +3,7 @@
<command>
<info>
<contact:info
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
</contact:info>
</info>
<clTRID>ABC-12345</clTRID>

View file

@ -3,7 +3,7 @@
<command>
<update>
<contact:update
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id>
<contact:chg>
<contact:postalInfo type="int">

View file

@ -3,7 +3,7 @@
<command>
<update>
<contact:update
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
</contact:update>
</update>
<clTRID>ABC-12345</clTRID>

View file

@ -3,7 +3,7 @@
<command>
<update>
<contact:update
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id>
<contact:chg>
<contact:voice x="1234">123456798</contact:voice>

View file

@ -41,7 +41,7 @@ describe 'EPP Session', epp: true do
end
it 'prohibits further actions unless logged in' do
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/domain-1.0.xsd'))
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/domain-eis-1.0.xsd'))
response = epp_plain_request(@epp_xml.domain.info(name: { value: 'test.ee' }))
response[:msg].should == 'You need to login first.'
response[:result_code].should == '2002'
@ -55,6 +55,14 @@ describe 'EPP Session', epp: true do
response[:clTRID].should be_nil
end
it 'should return latin only error' do
wrong_user = @epp_xml.session.login(clID: { value: '你好你好' }, pw: { value: 'ghyt9e4fu' })
response = epp_plain_request(wrong_user)
response[:msg].should == 'Parameter value policy error. Allowed only Latin characters.'
response[:result_code].should == '2306'
response[:clTRID].should == 'ABC-12345'
end
context 'with valid user' do
it 'logs in epp user' do
response = epp_plain_request(@login_xml_cache)

View file

@ -26,7 +26,8 @@ feature 'DomainDeleteConfirm', type: :feature do
registrant_verification_token: '123',
registrant_verification_asked_at: Time.zone.now
)
@domain.domain_statuses.create(value: DomainStatus::PENDING_DELETE)
@domain.statuses << DomainStatus::PENDING_DELETE
@domain.save
end
it 'should see warning info if token is missing in request' do

View file

@ -26,7 +26,8 @@ feature 'DomainUpdateConfirm', type: :feature do
registrant_verification_token: '123',
registrant_verification_asked_at: Time.zone.now
)
@domain.domain_statuses.create(value: DomainStatus::PENDING_UPDATE)
@domain.statuses << DomainStatus::PENDING_UPDATE
@domain.save
end
it 'should see warning info if token is missing in request' do

View file

@ -63,7 +63,7 @@ describe BankStatement do
AccountActivity.count.should == 1
r.cash_account.balance.should == 240.0
r.cash_account.balance.should == 200.0
bs.bank_transactions.unbinded.count.should == 1
bs.partially_binded?.should == true

View file

@ -45,7 +45,7 @@ describe BankTransaction do
bt.bind_invoice(invoice.number)
invoice.receipt_date.should_not be_blank
r.cash_account.balance.should == 240.0
r.cash_account.balance.should == 200.0
end
it 'should not bind transaction with mismatching sums' do

View file

@ -96,50 +96,60 @@ describe Domain do
it 'should expire domains' do
Domain.start_expire_period
@domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 0
@domain.statuses.include?(DomainStatus::EXPIRED).should == false
@domain.valid_to = Time.zone.now - 10.days
@domain.save
Domain.start_expire_period
@domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 1
@domain.reload
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
Domain.start_expire_period
@domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 1
@domain.reload
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
end
it 'should start redemption grace period' do
Domain.start_redemption_grace_period
@domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 0
@domain.reload
@domain.statuses.include?(DomainStatus::SERVER_HOLD).should == false
@domain.outzone_at = Time.zone.now
@domain.domain_statuses.create(value: DomainStatus::SERVER_MANUAL_INZONE) # this prohibits server_hold
@domain.statuses << DomainStatus::SERVER_MANUAL_INZONE # this prohibits server_hold
@domain.save
Domain.start_redemption_grace_period
@domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 0
@domain.reload
@domain.statuses.include?(DomainStatus::SERVER_HOLD).should == false
@domain.domain_statuses.destroy_all
@domain.statuses = []
@domain.save
Domain.start_redemption_grace_period
@domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 1
@domain.reload
@domain.statuses.include?(DomainStatus::SERVER_HOLD).should == true
end
it 'should start delete period' do
Domain.start_delete_period
@domain.domain_statuses.where(value: DomainStatus::DELETE_CANDIDATE).count.should == 0
@domain.reload
@domain.statuses.include?(DomainStatus::DELETE_CANDIDATE).should == false
@domain.delete_at = Time.zone.now
@domain.domain_statuses.create(value: DomainStatus::SERVER_DELETE_PROHIBITED) # this prohibits delete_candidate
@domain.statuses << DomainStatus::SERVER_DELETE_PROHIBITED # this prohibits delete_candidate
@domain.save
Domain.start_delete_period
@domain.domain_statuses.where(value: DomainStatus::DELETE_CANDIDATE).count.should == 0
@domain.reload
@domain.statuses.include?(DomainStatus::DELETE_CANDIDATE).should == false
@domain.domain_statuses.destroy_all
@domain.statuses = []
@domain.save
Domain.start_delete_period
@domain.reload
@domain.domain_statuses.where(value: DomainStatus::DELETE_CANDIDATE).count.should == 1
@domain.statuses.include?(DomainStatus::DELETE_CANDIDATE).should == true
end
it 'should destroy delete candidates' do
@ -159,15 +169,16 @@ describe Domain do
end
it 'should set force delete time' do
@domain.statuses = ['ok']
@domain.set_force_delete
@domain.domain_statuses.count.should == 6
fda = Time.zone.now + Setting.redemption_grace_period
@domain.statuses.count.should == 6
fda = Time.zone.now + Setting.redemption_grace_period.days
@domain.force_delete_at.should be_within(20).of(fda)
@domain.unset_force_delete
@domain.domain_statuses.count.should == 1
@domain.statuses.count.should == 1
@domain.force_delete_at.should be_nil
end
@ -175,7 +186,7 @@ describe Domain do
before :all do
@domain.registrant_verification_token = 123
@domain.registrant_verification_asked_at = Time.zone.now
@domain.domain_statuses.create(value: DomainStatus::PENDING_UPDATE)
@domain.statuses << DomainStatus::PENDING_UPDATE
end
it 'should be registrant update confirm ready' do
@ -187,7 +198,7 @@ describe Domain do
end
it 'should not be registrant update confirm ready when no correct status' do
@domain.domain_statuses.delete_all
@domain.statuses = []
@domain.registrant_update_confirmable?('123').should == false
end
end
@ -196,7 +207,7 @@ describe Domain do
before :all do
@domain.registrant_verification_token = 123
@domain.registrant_verification_asked_at = Time.zone.now
@domain.domain_statuses.create(value: DomainStatus::PENDING_UPDATE)
@domain.statuses << DomainStatus::PENDING_UPDATE
end
it 'should be registrant update confirm ready' do
@ -208,7 +219,7 @@ describe Domain do
end
it 'should not be registrant update confirm ready when no correct status' do
@domain.domain_statuses.delete_all
@domain.statuses = []
@domain.registrant_update_confirmable?('123').should == false
end
end
@ -441,24 +452,23 @@ describe Domain do
it 'manages statuses automatically' do
d = Fabricate(:domain)
expect(d.domain_statuses.count).to eq(1)
expect(d.domain_statuses.first.value).to eq(DomainStatus::OK)
expect(d.statuses.count).to eq(1)
expect(d.statuses.first).to eq(DomainStatus::OK)
d.period = 2
d.save
d.reload
expect(d.statuses.count).to eq(1)
expect(d.statuses.first).to eq(DomainStatus::OK)
expect(d.domain_statuses.count).to eq(1)
expect(d.domain_statuses.first.reload.value).to eq(DomainStatus::OK)
d.domain_statuses.build(value: DomainStatus::CLIENT_DELETE_PROHIBITED)
d.statuses << DomainStatus::CLIENT_DELETE_PROHIBITED
d.save
d.reload
expect(d.domain_statuses.count).to eq(1)
expect(d.domain_statuses.first.value).to eq(DomainStatus::CLIENT_DELETE_PROHIBITED)
expect(d.statuses.count).to eq(1)
expect(d.statuses.first).to eq(DomainStatus::CLIENT_DELETE_PROHIBITED)
end
with_versioning do

View file

@ -7,6 +7,7 @@ require 'shoulda/matchers'
require 'capybara/poltergeist'
require 'paper_trail/frameworks/rspec'
PaperTrail.whodunnit = 'autotest'
require "money-rails/test_helpers"
if ENV['ROBOT']
require 'simplecov'