Merge branch 'master' into alpha

This commit is contained in:
Priit Tark 2015-08-12 14:26:47 +03:00
commit 18f80130cf
90 changed files with 2996 additions and 2090 deletions

View file

@ -9,7 +9,7 @@ source 'https://rubygems.org'
# core # core
gem 'rails', '4.2.3' # when update, all initializers eis_custom files needs check/update gem 'rails', '4.2.3' # when update, all initializers eis_custom files needs check/update
gem 'iso8601', '~> 0.8.2' # for dates and times gem 'iso8601', '~> 0.8.6' # for dates and times
gem 'hashie-forbidden_attributes', '~> 0.1.1' gem 'hashie-forbidden_attributes', '~> 0.1.1'
# load env # load env
@ -18,6 +18,8 @@ gem 'figaro', '~> 1.1.1'
# model related # model related
gem 'pg', '~> 0.18.0' gem 'pg', '~> 0.18.0'
gem 'ransack', '~> 1.5.1' # for searching gem 'ransack', '~> 1.5.1' # for searching
gem 'validates_email_format_of', '~> 1.6.3' # validates email against RFC 2822 and RFC 3696
# with polymorphic fix # with polymorphic fix
gem 'paper_trail', gem 'paper_trail',
github: 'airblade/paper_trail', github: 'airblade/paper_trail',
@ -65,7 +67,7 @@ gem 'money-rails', '~> 1.4.1'
# deploy # deploy
gem 'whenever', '~> 0.9.4', require: false gem 'whenever', '~> 0.9.4', require: false
gem 'data_migrate', gem 'data_migrate',
github: 'gitlabeu/data_migrate', github: 'internetee/data-migrate',
ref: '35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81' ref: '35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81'
# monitors # monitors

View file

@ -9,7 +9,7 @@ GIT
request_store (~> 1.1.0) request_store (~> 1.1.0)
GIT GIT
remote: https://github.com/gitlabeu/data_migrate.git remote: https://github.com/internetee/data-migrate.git
revision: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81 revision: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
ref: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81 ref: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
specs: specs:
@ -81,15 +81,15 @@ GEM
akami (1.3.1) akami (1.3.1)
gyoku (>= 0.4.0) gyoku (>= 0.4.0)
nokogiri nokogiri
arel (6.0.0) arel (6.0.3)
ast (2.0.0) ast (2.1.0)
astrolabe (1.3.0) astrolabe (1.3.1)
parser (>= 2.2.0.pre.3, < 3.0) parser (~> 2.2)
autodoc (0.5.0) autodoc (0.5.1)
actionpack actionpack
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
rspec rspec
autoprefixer-rails (5.2.1) autoprefixer-rails (5.2.1.1)
execjs execjs
json json
axiom-types (0.1.1) axiom-types (0.1.1)
@ -129,8 +129,6 @@ GEM
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
xpath (~> 2.0) xpath (~> 2.0)
celluloid (0.16.0)
timers (~> 4.0.0)
chronic (0.10.2) chronic (0.10.2)
cliver (0.3.2) cliver (0.3.2)
coderay (1.1.0) coderay (1.1.0)
@ -146,7 +144,7 @@ GEM
concord (0.1.5) concord (0.1.5)
adamantium (~> 0.2.0) adamantium (~> 0.2.0)
equalizer (~> 0.0.9) equalizer (~> 0.0.9)
countries (0.11.4) countries (0.11.5)
currencies (~> 0.4.2) currencies (~> 0.4.2)
i18n_data (~> 0.7.0) i18n_data (~> 0.7.0)
crack (0.4.2) crack (0.4.2)
@ -187,7 +185,7 @@ GEM
faker (1.4.3) faker (1.4.3)
i18n (~> 0.5) i18n (~> 0.5)
fastercsv (1.5.5) fastercsv (1.5.5)
ffi (1.9.9) ffi (1.9.10)
figaro (1.1.1) figaro (1.1.1)
thor (~> 0.14) thor (~> 0.14)
flay (2.4.0) flay (2.4.0)
@ -197,7 +195,7 @@ GEM
ruby_parser (~> 3.1, > 3.1.0) ruby_parser (~> 3.1, > 3.1.0)
sexp_processor (~> 4.4) sexp_processor (~> 4.4)
formatador (0.2.5) formatador (0.2.5)
globalid (0.3.5) globalid (0.3.6)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
grape (0.12.0) grape (0.12.0)
activesupport activesupport
@ -209,7 +207,7 @@ GEM
rack-accept rack-accept
rack-mount rack-mount
virtus (>= 1.0.0) virtus (>= 1.0.0)
guard (2.12.7) guard (2.12.9)
formatador (>= 0.2.4) formatador (>= 0.2.4)
listen (>= 2.7, <= 4.0) listen (>= 2.7, <= 4.0)
lumberjack (~> 1.0) lumberjack (~> 1.0)
@ -243,14 +241,13 @@ GEM
hashie-forbidden_attributes (0.1.1) hashie-forbidden_attributes (0.1.1)
hashie (>= 3.0) hashie (>= 3.0)
highline (1.6.21) highline (1.6.21)
hitimes (1.2.2)
hpricot (0.8.6) hpricot (0.8.6)
html2haml (2.0.0) html2haml (2.0.0)
erubis (~> 2.7.0) erubis (~> 2.7.0)
haml (~> 4.0.0) haml (~> 4.0.0)
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
ruby_parser (~> 3.5) ruby_parser (~> 3.5)
html5_validators (1.2.1) html5_validators (1.2.2)
httpclient (2.6.0.1) httpclient (2.6.0.1)
httpi (2.4.1) httpi (2.4.1)
rack rack
@ -278,10 +275,9 @@ GEM
kgio (2.9.3) kgio (2.9.3)
launchy (2.4.3) launchy (2.4.3)
addressable (~> 2.3) addressable (~> 2.3)
libv8 (3.16.14.8) libv8 (3.16.14.11)
libxml-ruby (2.8.0) libxml-ruby (2.8.0)
listen (2.10.1) listen (3.0.3)
celluloid (~> 0.16.0)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
loofah (2.0.2) loofah (2.0.2)
@ -293,11 +289,11 @@ GEM
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
method_source (0.8.2) method_source (0.8.2)
mime-types (2.6.1) mime-types (2.6.1)
mina (0.3.4) mina (0.3.7)
open4 (~> 1.3.4) open4 (~> 1.3.4)
rake rake
mini_portile (0.6.2) mini_portile (0.6.2)
minitest (5.7.0) minitest (5.8.0)
monetize (1.1.0) monetize (1.1.0)
money (~> 6.5.0) money (~> 6.5.0)
money (6.5.1) money (6.5.1)
@ -307,20 +303,20 @@ GEM
monetize (~> 1.1.0) monetize (~> 1.1.0)
money (~> 6.5.0) money (~> 6.5.0)
railties (>= 3.0) railties (>= 3.0)
multi_json (1.11.1) multi_json (1.11.2)
multi_xml (0.5.5) multi_xml (0.5.5)
nenv (0.2.0) nenv (0.2.0)
newrelic_rpm (3.12.0.288) newrelic_rpm (3.12.0.288)
nokogiri (1.6.6.2) nokogiri (1.6.6.2)
mini_portile (~> 0.6.0) mini_portile (~> 0.6.0)
nori (2.6.0) nori (2.6.0)
notiffany (0.0.6) notiffany (0.0.7)
nenv (~> 0.1) nenv (~> 0.1)
shellany (~> 0.0) shellany (~> 0.0)
nprogress-rails (0.1.6.7) nprogress-rails (0.1.6.7)
open4 (1.3.4) open4 (1.3.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
parser (2.2.2.5) parser (2.2.2.6)
ast (>= 1.1, < 3.0) ast (>= 1.1, < 3.0)
pdfkit (0.6.2) pdfkit (0.6.2)
pg (0.18.2) pg (0.18.2)
@ -354,7 +350,7 @@ GEM
rack rack
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
railroady (1.3.0) railroady (1.3.1)
rails (4.2.3) rails (4.2.3)
actionmailer (= 4.2.3) actionmailer (= 4.2.3)
actionpack (= 4.2.3) actionpack (= 4.2.3)
@ -382,7 +378,7 @@ GEM
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.0.0) rainbow (2.0.0)
raindrops (0.14.0) raindrops (0.15.0)
rake (10.4.2) rake (10.4.2)
ransack (1.5.1) ransack (1.5.1)
actionpack (>= 3.0) actionpack (>= 3.0)
@ -398,7 +394,7 @@ GEM
parser (~> 2.2.0.pre.7) parser (~> 2.2.0.pre.7)
rainbow (>= 1.99, < 3.0) rainbow (>= 1.99, < 3.0)
unparser (~> 0.2.2) unparser (~> 0.2.2)
ref (1.0.5) ref (2.0.0)
request_store (1.1.0) request_store (1.1.0)
responders (2.1.0) responders (2.1.0)
railties (>= 4.2.0, < 5) railties (>= 4.2.0, < 5)
@ -406,15 +402,15 @@ GEM
rspec-core (~> 3.3.0) rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0) rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0) rspec-mocks (~> 3.3.0)
rspec-core (3.3.1) rspec-core (3.3.2)
rspec-support (~> 3.3.0) rspec-support (~> 3.3.0)
rspec-expectations (3.3.0) rspec-expectations (3.3.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0) rspec-support (~> 3.3.0)
rspec-mocks (3.3.1) rspec-mocks (3.3.2)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0) rspec-support (~> 3.3.0)
rspec-rails (3.3.2) rspec-rails (3.3.3)
actionpack (>= 3.0, < 4.3) actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3) activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3) railties (>= 3.0, < 4.3)
@ -433,7 +429,7 @@ GEM
ruby2ruby (2.1.4) ruby2ruby (2.1.4)
ruby_parser (~> 3.1) ruby_parser (~> 3.1)
sexp_processor (~> 4.0) sexp_processor (~> 4.0)
ruby_parser (3.7.0) ruby_parser (3.7.1)
sexp_processor (~> 4.1) sexp_processor (~> 4.1)
rubycritic (1.4.0) rubycritic (1.4.0)
flay (= 2.4.0) flay (= 2.4.0)
@ -442,7 +438,7 @@ GEM
reek (= 1.6.5) reek (= 1.6.5)
virtus (~> 1.0) virtus (~> 1.0)
safe_yaml (1.0.4) safe_yaml (1.0.4)
sass (3.4.15) sass (3.4.16)
sass-rails (5.0.3) sass-rails (5.0.3)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (~> 3.1) sass (~> 3.1)
@ -496,8 +492,6 @@ GEM
thor (0.19.1) thor (0.19.1)
thread_safe (0.3.5) thread_safe (0.3.5)
tilt (1.4.1) tilt (1.4.1)
timers (4.0.1)
hitimes
traceroute (0.5.0) traceroute (0.5.0)
rails (>= 3.0.0) rails (>= 3.0.0)
turbolinks (2.5.3) turbolinks (2.5.3)
@ -521,6 +515,8 @@ GEM
parser (~> 2.2.2) parser (~> 2.2.2)
procto (~> 0.0.2) procto (~> 0.0.2)
uuidtools (2.1.5) uuidtools (2.1.5)
validates_email_format_of (1.6.3)
i18n
virtus (1.0.5) virtus (1.0.5)
axiom-types (~> 0.1) axiom-types (~> 0.1)
coercible (~> 1.0) coercible (~> 1.0)
@ -531,7 +527,7 @@ GEM
wasabi (3.5.0) wasabi (3.5.0)
httpi (~> 2.0) httpi (~> 2.0)
nokogiri (>= 1.4.2) nokogiri (>= 1.4.2)
websocket-driver (0.5.4) websocket-driver (0.6.2)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2) websocket-extensions (0.1.2)
whenever (0.9.4) whenever (0.9.4)
@ -578,7 +574,7 @@ DEPENDENCIES
html2haml (~> 2.0.0) html2haml (~> 2.0.0)
html5_validators (~> 1.2.0) html5_validators (~> 1.2.0)
isikukood isikukood
iso8601 (~> 0.8.2) iso8601 (~> 0.8.6)
jbuilder (~> 2.2.6) jbuilder (~> 2.2.6)
jquery-rails (~> 4.0.3) jquery-rails (~> 4.0.3)
jquery-ui-rails (~> 5.0.3) jquery-ui-rails (~> 5.0.3)
@ -622,4 +618,5 @@ DEPENDENCIES
uglifier (~> 2.7.1) uglifier (~> 2.7.1)
unicorn unicorn
uuidtools (~> 2.1.4) uuidtools (~> 2.1.4)
validates_email_format_of (~> 1.6.3)
whenever (~> 0.9.4) whenever (~> 0.9.4)

View file

@ -7,6 +7,7 @@ class Admin::BankTransactionsController < AdminController
end end
def create def create
comma_support_for(:bank_transaction, :sum)
@bank_transaction = BankTransaction.new( @bank_transaction = BankTransaction.new(
bank_transaction_params.merge(bank_statement_id: params[:bank_statement_id]) bank_transaction_params.merge(bank_statement_id: params[:bank_statement_id])
) )
@ -21,6 +22,7 @@ class Admin::BankTransactionsController < AdminController
end end
def update def update
comma_support_for(:bank_transaction, :sum)
if @bank_transaction.update(bank_transaction_params) if @bank_transaction.update(bank_transaction_params)
flash[:notice] = I18n.t('record_updated') flash[:notice] = I18n.t('record_updated')
redirect_to [:admin, @bank_transaction] redirect_to [:admin, @bank_transaction]

View file

@ -1,17 +1,17 @@
class Admin::DomainVersionsController < AdminController class Admin::DomainVersionsController < AdminController
load_and_authorize_resource load_and_authorize_resource
# rubocop:disable Style/GuardClause
def index def index
@domain = Domain.find(params[:domain_id]) @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first
@versions = @domain.versions @versions = @domain.versions
if @domain.pending_json.present?
frame = Nokogiri::XML(@domain.pending_json['frame'])
@pending_user = User.find(@domain.pending_json['current_user_id'])
@pending_domain = Epp::Domain.find(@domain.id)
@pending_domain.update(frame, @pending_user, false)
end
end end
# rubocop:enable Style/GuardClause
# def index
# # @q = DomainVersion.deleted.search(params[:q])
# # @domains = @q.result.page(params[:page])
# end
# def show
# @versions = DomainVersion.where(item_id: params[:id])
# end
end end

View file

@ -18,7 +18,7 @@ class Admin::DomainsController < AdminController
normalize_search_parameters do normalize_search_parameters do
@q = domains.search(params[:q]) @q = domains.search(params[:q])
@domains = @q.result.page(params[:page]) @domains = @q.result.page(params[:page])
if @domains.count == 1 if @domains.count == 1 && params[:q][:name_matches].present?
redirect_to [:admin, @domains.first] and return redirect_to [:admin, @domains.first] and return
elsif @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/ elsif @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/
# if we do not get any results, add wildcards to the name field and search again # if we do not get any results, add wildcards to the name field and search again
@ -83,7 +83,7 @@ class Admin::DomainsController < AdminController
def domain_params def domain_params
if params[:domain] if params[:domain]
params.require(:domain).permit({ statuses: [] }) params.require(:domain).permit({ statuses: [], status_notes_array: [] })
else else
{ statuses: [] } { statuses: [] }
end end

View file

@ -16,7 +16,7 @@ class Admin::InvoicesController < AdminController
flash[:notice] = t(:record_created) flash[:notice] = t(:record_created)
redirect_to [:admin, @invoice] redirect_to [:admin, @invoice]
else else
flash[:alert] = t(:failed_to_create_record) flash.now[:alert] = t(:failed_to_create_record)
render 'new' render 'new'
end end
end end

View file

@ -0,0 +1,35 @@
class Admin::PendingDeletesController < AdminController
before_action :find_domain
before_action :check_status
def update
authorize! :update, :pending
@epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending
if @epp_domain.apply_pending_delete!
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
else
redirect_to admin_edit_domain_path(@domain.id), alert: t(:failure)
end
end
def destroy
authorize! :destroy, :pending
if @domain.clean_pendings!
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
else
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
end
end
private
def find_domain
@domain = Domain.find(params[:domain_id])
end
def check_status
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_delete?
end
end

View file

@ -0,0 +1,35 @@
class Admin::PendingUpdatesController < AdminController
before_action :find_domain
before_action :check_status
def update
authorize! :update, :pending
@epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending
if @epp_domain.apply_pending_update!
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
else
redirect_to admin_edit_domain_path(@domain.id), alert: t(:failure)
end
end
def destroy
authorize! :destroy, :pending
if @domain.clean_pendings!
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
else
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
end
end
private
def find_domain
@domain = Domain.find(params[:domain_id])
end
def check_status
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_update?
end
end

View file

@ -17,6 +17,7 @@ class Admin::PricelistsController < AdminController
end end
def create def create
comma_support_for(:pricelist, :price)
@pricelist = Pricelist.new(pricelist_params) @pricelist = Pricelist.new(pricelist_params)
if @pricelist.save if @pricelist.save
@ -27,6 +28,7 @@ class Admin::PricelistsController < AdminController
end end
def update def update
comma_support_for(:pricelist, :price)
if @pricelist.update_attributes(pricelist_params) if @pricelist.update_attributes(pricelist_params)
redirect_to admin_pricelists_url redirect_to admin_pricelists_url
else else

View file

@ -61,7 +61,7 @@ class Admin::SettingsController < AdminController
:expire_pending_confirmation :expire_pending_confirmation
] ]
floats = [:registry_vat_prc] floats = [:registry_vat_prc, :minimum_deposit]
booleans = [ booleans = [
:ds_data_allowed, :ds_data_allowed,

View file

@ -5,6 +5,22 @@ class Admin::ZonefileSettingsController < AdminController
@zonefile_settings = ZonefileSetting.all @zonefile_settings = ZonefileSetting.all
end end
def new
@zonefile_setting = ZonefileSetting.new
end
def create
@zonefile_setting = ZonefileSetting.new(zonefile_setting_params)
if @zonefile_setting.save
flash[:notice] = I18n.t('record_created')
redirect_to admin_zonefile_settings_path
else
flash.now[:alert] = I18n.t('failed_to_create_record')
render 'new'
end
end
def edit def edit
@zonefile_setting = ZonefileSetting.find(params[:id]) @zonefile_setting = ZonefileSetting.find(params[:id])
end end
@ -19,6 +35,16 @@ class Admin::ZonefileSettingsController < AdminController
end end
end end
def destroy
if @zonefile_setting.destroy
flash[:notice] = I18n.t('record_deleted')
redirect_to admin_zonefile_settings_path
else
flash.now[:alert] = I18n.t('failed_to_delete_record')
render 'edit'
end
end
private private
def set_zonefile_setting def set_zonefile_setting
@ -26,6 +52,9 @@ class Admin::ZonefileSettingsController < AdminController
end end
def zonefile_setting_params def zonefile_setting_params
params.require(:zonefile_setting).permit(:ttl, :refresh, :retry, :expire, :minimum_ttl, :email) params.require(:zonefile_setting).permit(
:origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email,
:master_nameserver, :ns_records, :a_records, :a4_records
)
end end
end end

View file

@ -70,4 +70,10 @@ class ApplicationController < ActionController::Base
return 'public' if user.nil? return 'public' if user.nil?
"#{user.id}-#{user.class}: #{user.username}" "#{user.id}-#{user.class}: #{user.username}"
end end
def comma_support_for(parent_key, key)
return if params[parent_key].blank?
return if params[parent_key][key].blank?
params[parent_key][key].sub!(/,/, '.')
end
end end

View file

@ -13,7 +13,7 @@ class Registrar::DepositsController < RegistrarController
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
flash[:alert] = t(:failed_to_create_record) flash.now[:alert] = t(:failed_to_create_record)
render 'new' render 'new'
end end
end end

View file

@ -2,21 +2,41 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller
before_action :init_domain, except: :new before_action :init_domain, except: :new
before_action :init_contacts_autocomplete_map, only: [:new, :edit, :create, :update] before_action :init_contacts_autocomplete_map, only: [:new, :edit, :create, :update]
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def index def index
authorize! :view, Depp::Domain authorize! :view, Depp::Domain
limit, offset = pagination_details
res = depp_current_user.repp_request('domains', { details: true, limit: limit, offset: offset }) params[:q] ||= {}
if res.code == '200' if params[:statuses_contains]
@response = res.parsed_body.with_indifferent_access domains = current_user.registrar.domains.includes(:registrar, :registrant).where(
@contacts = @response ? @response[:contacts] : [] "statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
)
@paginatable_array = Kaminari.paginate_array( else
[], total_count: @response[:total_number_of_records] domains = current_user.registrar.domains.includes(:registrar, :registrant)
).page(params[:page]).per(limit)
end end
flash.now[:epp_results] = [{ 'code' => res.code, 'msg' => res.message }]
normalize_search_parameters do
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])
if @domains.count == 1 && params[:q][:name_matches].present?
redirect_to info_registrar_domains_path(domain_name: @domains.first.name) and return
elsif @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/
# if we do not get any results, add wildcards to the name field and search again
n_cache = params[:q][:name_matches]
params[:q][:name_matches] = "%#{params[:q][:name_matches]}%"
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])
params[:q][:name_matches] = n_cache # we don't want to show wildcards in search form
end
end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def info def info
authorize! :view, Depp::Domain authorize! :view, Depp::Domain
@ -123,4 +143,18 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller
# @priv_contacts_autocomplete_map ||= # @priv_contacts_autocomplete_map ||=
# current_user.registrar.priv_contacts.pluck(:name, :code).map { |c| ["#{c.second} #{c.first}", c.second] } # current_user.registrar.priv_contacts.pluck(:name, :code).map { |c| ["#{c.second} #{c.first}", c.second] }
end end
def normalize_search_parameters
ca_cache = params[:q][:valid_to_lteq]
begin
end_time = params[:q][:valid_to_lteq].try(:to_date)
params[:q][:valid_to_lteq] = end_time.try(:end_of_day)
rescue
logger.warn('Invalid date')
end
yield
params[:q][:valid_to_lteq] = ca_cache
end
end end

View file

@ -45,4 +45,14 @@ module ApplicationHelper
# can be api user or some other user # can be api user or some other user
link_to(model.updator, ['admin', model.updator]) link_to(model.updator, ['admin', model.updator])
end end
def currency(amount)
amount ||= 0
format("%01.2f", amount.round(2)).sub(/\./, ',')
end
def plain_username(username)
username ||= ''
username.split(':').last.to_s.strip
end
end end

View file

@ -5,10 +5,12 @@ class DomainDeleteConfirmJob < Que::Job
domain = Epp::Domain.find(domain_id) domain = Epp::Domain.find(domain_id)
case action case action
when RegistrantVerification::CONFIRMED when RegistrantVerification::CONFIRMED
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
domain.apply_pending_delete! domain.apply_pending_delete!
domain.clean_pendings! domain.clean_pendings!
when RegistrantVerification::REJECTED when RegistrantVerification::REJECTED
DomainMailer.pending_delete_rejected_notification(domain).deliver_now DomainMailer.pending_delete_rejected_notification(domain).deliver_now
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
domain.clean_pendings! domain.clean_pendings!
end end
destroy # it's best to destroy the job in the same transaction destroy # it's best to destroy the job in the same transaction

View file

@ -5,10 +5,12 @@ class DomainUpdateConfirmJob < Que::Job
domain = Epp::Domain.find(domain_id) domain = Epp::Domain.find(domain_id)
case action case action
when RegistrantVerification::CONFIRMED when RegistrantVerification::CONFIRMED
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
domain.apply_pending_update! domain.apply_pending_update!
domain.clean_pendings! domain.clean_pendings!
when RegistrantVerification::REJECTED when RegistrantVerification::REJECTED
DomainMailer.pending_update_rejected_notification_for_new_registrant(domain).deliver_now DomainMailer.pending_update_rejected_notification_for_new_registrant(domain).deliver_now
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
domain.clean_pendings! domain.clean_pendings!
end end
destroy # it's best to destroy the job in the same transaction destroy # it's best to destroy the job in the same transaction

View file

@ -123,7 +123,8 @@ class Ability
can :manage, WhiteIp can :manage, WhiteIp
can :read, ApiLog::EppLog can :read, ApiLog::EppLog
can :read, ApiLog::ReppLog can :read, ApiLog::ReppLog
# can :index, :delayed_job can :update, :pending
can :destroy, :pending
can :create, :zonefile can :create, :zonefile
can :access, :settings_menu can :access, :settings_menu
end end

View file

@ -0,0 +1,7 @@
module Statuses
extend ActiveSupport::Concern
def force_delete?
statuses.include?(DomainStatus::FORCE_DELETE)
end
end

View file

@ -19,6 +19,7 @@ class Contact < ActiveRecord::Base
# Phone nr validation is very minimam in order to support legacy requirements # Phone nr validation is very minimam in order to support legacy requirements
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/ validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/
validates :email, format: /@/ validates :email, format: /@/
validates :email, email_format: { message: :invalid }, if: proc { |c| c.email_changed? }
validates :ident, validates :ident,
format: { with: /\d{4}-\d{2}-\d{2}/, message: :invalid_birthday_format }, format: { with: /\d{4}-\d{2}-\d{2}/, message: :invalid_birthday_format },
if: proc { |c| c.ident_type == 'birthday' } if: proc { |c| c.ident_type == 'birthday' }

View file

@ -7,6 +7,11 @@ class Deposit
attr_accessor :amount, :description, :registrar, :registrar_id attr_accessor :amount, :description, :registrar, :registrar_id
validates :amount, :registrar, presence: true validates :amount, :registrar, presence: true
validate :validate_amount
def validate_amount
return if BigDecimal.new(amount) >= Setting.minimum_deposit
errors.add(:amount, I18n.t(:is_too_small_minimum_deposit_is, amount: Setting.minimum_deposit, currency: 'EUR'))
end
def initialize(attributes = {}) def initialize(attributes = {})
attributes.each do |name, value| attributes.each do |name, value|
@ -18,6 +23,10 @@ class Deposit
false false
end end
def amount
BigDecimal.new(@amount.to_s.sub(/,/, '.'))
end
def issue_prepayment_invoice def issue_prepayment_invoice
valid? && registrar.issue_prepayment_invoice(amount, description) valid? && registrar.issue_prepayment_invoice(amount, description)
end end

View file

@ -71,6 +71,7 @@ module Depp
private private
# rubocop:disable Metrics/AbcSize
def validate_existance_in_server def validate_existance_in_server
return if errors.any? return if errors.any?
res = server.open_connection res = server.open_connection
@ -92,7 +93,10 @@ module Depp
rescue OpenSSL::SSL::SSLError => e rescue OpenSSL::SSL::SSLError => e
Rails.logger.error "INVALID CERT: #{e}" Rails.logger.error "INVALID CERT: #{e}"
Rails.logger.error "INVALID CERT DEBUG INFO: epp_hostname: #{ENV['epp_hostname']}," \
"port: #{ENV['epp_port']}, cert_path: #{ENV['cert_path']}, key_path: #{ENV['key_path']}"
errors.add(:base, :invalid_cert) errors.add(:base, :invalid_cert)
end end
# rubocop:enable Metrics/AbcSize
end end
end end

View file

@ -1,6 +1,7 @@
# rubocop: disable Metrics/ClassLength # rubocop: disable Metrics/ClassLength
class Domain < ActiveRecord::Base class Domain < ActiveRecord::Base
include Versions # version/domain_version.rb include Versions # version/domain_version.rb
include Statuses
has_paper_trail class_name: "DomainVersion", meta: { children: :children_log } has_paper_trail class_name: "DomainVersion", meta: { children: :children_log }
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains # TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
@ -105,6 +106,13 @@ class Domain < ActiveRecord::Base
errors.add(:base, :invalid_auth_information_reserved) errors.add(:base, :invalid_auth_information_reserved)
end end
validate :check_permissions
def check_permissions
return unless force_delete?
errors.add(:base, I18n.t(:object_status_prohibits_operation))
false
end
validates :nameservers, object_count: { validates :nameservers, object_count: {
min: -> { Setting.ns_min_count }, min: -> { Setting.ns_min_count },
max: -> { Setting.ns_max_count } max: -> { Setting.ns_max_count }
@ -341,6 +349,14 @@ class Domain < ActiveRecord::Base
true true
end end
def poll_message!(message_key)
registrar.messages.create!(
body: "#{I18n.t(message_key)}: #{name}",
attached_obj_id: id,
attached_obj_type: self.class.to_s
)
end
def preclean_pendings def preclean_pendings
self.registrant_verification_token = nil self.registrant_verification_token = nil
self.registrant_verification_asked_at = nil self.registrant_verification_asked_at = nil
@ -351,6 +367,8 @@ class Domain < ActiveRecord::Base
self.pending_json = {} self.pending_json = {}
statuses.delete(DomainStatus::PENDING_UPDATE) statuses.delete(DomainStatus::PENDING_UPDATE)
statuses.delete(DomainStatus::PENDING_DELETE) statuses.delete(DomainStatus::PENDING_DELETE)
status_notes[DomainStatus::PENDING_UPDATE] = ''
status_notes[DomainStatus::PENDING_DELETE] = ''
save save
end end
@ -530,21 +548,16 @@ class Domain < ActiveRecord::Base
self.delete_at = outzone_at + Setting.redemption_grace_period.days self.delete_at = outzone_at + Setting.redemption_grace_period.days
end end
# rubocop:disable Metrics/AbcSize
def set_force_delete def set_force_delete
statuses << DomainStatus::FORCE_DELETE self.statuses_backup = statuses
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::CLIENT_DELETE_PROHIBITED)
statuses.delete(DomainStatus::SERVER_DELETE_PROHIBITED) statuses.delete(DomainStatus::SERVER_DELETE_PROHIBITED)
statuses.delete(DomainStatus::PENDING_UPDATE)
statuses.delete(DomainStatus::PENDING_TRANSFER)
statuses.delete(DomainStatus::PENDING_RENEW)
statuses.delete(DomainStatus::PENDING_CREATE)
self.force_delete_at = Time.zone.now + Setting.redemption_grace_period.days unless force_delete_at
save(validate: false)
end
def unset_force_delete
statuses.delete(DomainStatus::FORCE_DELETE) statuses.delete(DomainStatus::FORCE_DELETE)
statuses.delete(DomainStatus::SERVER_RENEW_PROHIBITED) statuses.delete(DomainStatus::SERVER_RENEW_PROHIBITED)
statuses.delete(DomainStatus::SERVER_TRANSFER_PROHIBITED) statuses.delete(DomainStatus::SERVER_TRANSFER_PROHIBITED)
@ -552,7 +565,28 @@ class Domain < ActiveRecord::Base
statuses.delete(DomainStatus::SERVER_MANUAL_INZONE) statuses.delete(DomainStatus::SERVER_MANUAL_INZONE)
statuses.delete(DomainStatus::PENDING_DELETE) statuses.delete(DomainStatus::PENDING_DELETE)
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
self.force_delete_at = Time.zone.now + Setting.redemption_grace_period.days unless force_delete_at
save(validate: false)
end
# rubocop:enable Metrics/AbcSize
def unset_force_delete
s = []
s << DomainStatus::EXPIRED if statuses.include?(DomainStatus::EXPIRED)
s << DomainStatus::SERVER_HOLD if statuses.include?(DomainStatus::SERVER_HOLD)
s << DomainStatus::DELETE_CANDIDATE if statuses.include?(DomainStatus::DELETE_CANDIDATE)
self.statuses = (statuses_backup + s).uniq
self.force_delete_at = nil self.force_delete_at = nil
self.statuses_backup = []
save(validate: false) save(validate: false)
end end
@ -570,13 +604,19 @@ class Domain < ActiveRecord::Base
end end
def pending_update? def pending_update?
statuses.include?(DomainStatus::PENDING_UPDATE) statuses.include?(DomainStatus::PENDING_UPDATE) && !statuses.include?(DomainStatus::FORCE_DELETE)
end end
# public api
def update_prohibited? def update_prohibited?
pending_update_prohibited? && pending_delete_prohibited? pending_update_prohibited? && pending_delete_prohibited?
end end
# public api
def delete_prohibited?
statuses.include?(DomainStatus::FORCE_DELETE)
end
# TODO: Review the list and disallow epp calls # TODO: Review the list and disallow epp calls
def pending_update_prohibited? def pending_update_prohibited?
(statuses & [ (statuses & [
@ -599,7 +639,7 @@ class Domain < ActiveRecord::Base
end end
def pending_delete? def pending_delete?
statuses.include?(DomainStatus::PENDING_DELETE) statuses.include?(DomainStatus::PENDING_DELETE) && !statuses.include?(DomainStatus::FORCE_DELETE)
end end
# TODO: Review the list and disallow epp calls # TODO: Review the list and disallow epp calls
@ -645,5 +685,13 @@ class Domain < ActiveRecord::Base
def update_whois_record def update_whois_record
whois_record.blank? ? create_whois_record : whois_record.save whois_record.blank? ? create_whois_record : whois_record.save
end end
def status_notes_array=(notes)
self.status_notes = {}
notes ||= []
statuses.each_with_index do |status, i|
status_notes[status] = notes[i]
end
end
end end
# rubocop: enable Metrics/ClassLength # rubocop: enable Metrics/ClassLength

View file

@ -120,12 +120,49 @@ class DomainStatus < ActiveRecord::Base
end end
class << self class << self
def statuses_for_client def admin_statuses
CLIENT_STATUSES.map { |x| x.sub('client', '') } [
SERVER_HOLD,
# sync with admin_statuses_map
# SERVER_MANUAL_INZONE,
# SERVER_RENEW_PROHIBITED,
# SERVER_TRANSFER_PROHIBITED,
# SERVER_REGISTRANT_CHANGE_PROHIBITED,
# SERVER_ADMIN_CHANGE_PROHIBITED,
# SERVER_TECH_CHANGE_PROHIBITED,
SERVER_DELETE_PROHIBITED,
SERVER_UPDATE_PROHIBITED
]
end end
def statuses_for_admin def admin_statuses_map
SERVER_STATUSES.map { |x| [x.sub('server', ''), x] } [
['Hold', SERVER_HOLD],
# sync with admin_statuses
# ['ManualInzone', SERVER_MANUAL_INZONE],
# [''],
# ['RenewProhibited', SERVER_RENEW_PROHIBITED],
# ['TransferProhibited', SERVER_TRANSFER_PROHIBITED],
# ['RegistrantChangeProhibited', SERVER_REGISTRANT_CHANGE_PROHIBITED],
# ['AdminChangeProhibited', SERVER_ADMIN_CHANGE_PROHIBITED],
# ['TechChangeProhibited', SERVER_TECH_CHANGE_PROHIBITED],
# [''],
['UpdateProhibited', SERVER_UPDATE_PROHIBITED],
['DeleteProhibited', SERVER_DELETE_PROHIBITED]
]
end
def admin_not_deletable_statuses
[
OK,
INACTIVE,
FORCE_DELETE,
PENDING_CREATE,
PENDING_DELETE,
PENDING_RENEW,
PENDING_TRANSFER,
PENDING_UPDATE
]
end end
end end
end end

View file

@ -4,7 +4,7 @@ class Epp::Domain < Domain
before_validation :manage_permissions before_validation :manage_permissions
def manage_permissions def manage_permissions
return unless update_prohibited? return unless update_prohibited? || delete_prohibited?
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation)) add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
false false
end end
@ -433,9 +433,10 @@ class Epp::Domain < Domain
return unless update(frame, user, false) return unless update(frame, user, false)
clean_pendings! clean_pendings!
self.deliver_emails = true # turn on email delivery for epp self.deliver_emails = true # turn on email delivery
DomainMailer.registrant_updated_notification_for_new_registrant(self).deliver_now DomainMailer.registrant_updated_notification_for_new_registrant(self).deliver_now
old_registrant_email.deliver_now old_registrant_email.deliver_now
true
end end
def apply_pending_delete! def apply_pending_delete!
@ -446,6 +447,7 @@ class Epp::Domain < Domain
DomainMailer.delete_confirmation(self).deliver_now DomainMailer.delete_confirmation(self).deliver_now
clean_pendings! if epp_destroy(frame, user, false) clean_pendings! if epp_destroy(frame, user, false)
true
end end
def attach_legal_document(legal_document_data) def attach_legal_document(legal_document_data)
@ -460,7 +462,7 @@ class Epp::Domain < Domain
def epp_destroy(frame, user_id, verify = true) def epp_destroy(frame, user_id, verify = true)
return false unless valid? return false unless valid?
if verify && if verify &&
Setting.request_confirmation_on_domain_deletion_enabled && Setting.request_confirmation_on_domain_deletion_enabled &&
frame.css('delete').attr('verified').to_s.downcase != 'yes' frame.css('delete').attr('verified').to_s.downcase != 'yes'
@ -579,7 +581,14 @@ class Epp::Domain < Domain
# rubocop: disable Metrics/MethodLength # rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize # rubocop: disable Metrics/AbcSize
def query_transfer(frame, current_user) def query_transfer(frame, current_user)
unless can_be_transferred_to?(current_user.registrar) unless transferrable?
throw :epp_error, {
code: '2304',
msg: I18n.t(:object_status_prohibits_operation)
}
end
if current_user.registrar == registrar
throw :epp_error, { throw :epp_error, {
code: '2002', code: '2002',
msg: I18n.t(:domain_already_belongs_to_the_querying_registrar) msg: I18n.t(:domain_already_belongs_to_the_querying_registrar)
@ -737,8 +746,15 @@ class Epp::Domain < Domain
true true
end end
def can_be_transferred_to?(new_registrar) def transferrable?
new_registrar != registrar (statuses & [
DomainStatus::PENDING_CREATE,
DomainStatus::PENDING_UPDATE,
DomainStatus::PENDING_DELETE,
DomainStatus::PENDING_RENEW,
DomainStatus::PENDING_TRANSFER,
DomainStatus::FORCE_DELETE
]).empty?
end end
## SHARED ## SHARED

View file

@ -12,7 +12,7 @@ class Invoice < ActiveRecord::Base
} }
attr_accessor :billing_email attr_accessor :billing_email
validates :billing_email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }, allow_blank: true validates :billing_email, email_format: { message: :invalid }, allow_blank: true
validates :invoice_type, :due_date, :currency, :seller_name, validates :invoice_type, :due_date, :currency, :seller_name,
:seller_iban, :buyer_name, :invoice_items, :vat_prc, presence: true :seller_iban, :buyer_name, :invoice_items, :vat_prc, presence: true

View file

@ -45,7 +45,9 @@ class Registrar < ActiveRecord::Base
end end
end end
validates :email, :billing_email, format: /@/, allow_blank: true validates :email, :billing_email,
email_format: { message: :invalid },
allow_blank: true, if: proc { |c| c.email_changed? }
WHOIS_TRIGGERS = %w(name email phone street city state zip) WHOIS_TRIGGERS = %w(name email phone street city state zip)

View file

@ -1,7 +1,16 @@
class ZonefileSetting < ActiveRecord::Base class ZonefileSetting < ActiveRecord::Base
include Versions # version/zonefile_setting_version.rb include Versions # version/zonefile_setting_version.rb
validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, presence: true validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, :master_nameserver, presence: true
validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true } validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true }
validates :origin, uniqueness: true
before_destroy :check_for_dependencies
def check_for_dependencies
dc = Domain.where("name ILIKE ?", "%.#{origin}").count
return if dc == 0
errors.add(:base, I18n.t('there_are_count_domains_in_this_zone', count: dc))
false
end
def self.generate_zonefiles def self.generate_zonefiles
pluck(:origin).each do |origin| pluck(:origin).each do |origin|

View file

@ -33,7 +33,8 @@ class DomainNameValidator < ActiveModel::EachValidator
def validate_blocked(value) def validate_blocked(value)
return true unless value return true unless value
BlockedDomain.where("names @> ?::varchar[]", "{#{value}}").count == 0 return false if BlockedDomain.where("names @> ?::varchar[]", "{#{value}}").count > 0
ZonefileSetting.where(origin: value).count == 0
end end
end end
end end

View file

@ -63,7 +63,7 @@
%tr %tr
%td= link_to(l(x.paid_at, format: :date_long), [:admin, x]) %td= link_to(l(x.paid_at, format: :date_long), [:admin, x])
%td= x.buyer_name %td= x.buyer_name
%td= x.sum %td= currency(x.sum)
%td= x.currency %td= x.currency
- c = x.binded? ? 'text-success' : 'text-danger' - c = x.binded? ? 'text-success' : 'text-danger'
%td{class: c}= x.binded? ? t(:binded) : t(:not_binded) %td{class: c}= x.binded? ? t(:binded) : t(:not_binded)

View file

@ -18,7 +18,7 @@
.form-group .form-group
= f.label :sum, class: 'col-md-4 control-label required' = f.label :sum, class: 'col-md-4 control-label required'
.col-md-8 .col-md-8
= f.text_field(:sum, class: 'form-control', required: true) = f.text_field(:sum, value: currency(f.object.sum), class: 'form-control', required: true)
.form-group .form-group
= f.label :reference_no, class: 'col-md-4 control-label required' = f.label :reference_no, class: 'col-md-4 control-label required'

View file

@ -36,7 +36,7 @@
%dd= @bank_transaction.description %dd= @bank_transaction.description
%dt= t(:sum) %dt= t(:sum)
%dd= @bank_transaction.sum %dd= currency(@bank_transaction.sum)
%dt= t(:currency) %dt= t(:currency)
%dd= @bank_transaction.currency %dd= @bank_transaction.currency

View file

@ -5,7 +5,12 @@
.col-md-8 .col-md-8
.tab-content{style:'margin-top: 20px;'} .tab-content{style:'margin-top: 20px;'}
#general-tab.tab-pane.active #general-tab.tab-pane.active
= render 'admin/contacts/form_partials/statuses', f: f = render 'admin/shared/form/statuses', f: f,
model: 'contact',
admin_statuses_map: Contact.admin_statuses_map,
disabled_statuses: Contact::STATUSES - Contact.admin_statuses,
not_deletable_statuses: [Contact::OK, Contact::LINKED]
.row .row
.col-md-8.text-right .col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary') = button_tag(t(:save), class: 'btn btn-primary')

View file

@ -1,5 +1,5 @@
- content_for :actions do - content_for :actions do
= link_to(t(:add_new_status), '#', class: 'btn btn-primary js-add-contact-status') = link_to(t(:add_new_status), '#', class: 'btn btn-primary js-add-status')
= link_to(t(:back_to_contact), [:admin, @contact], class: 'btn btn-default') = link_to(t(:back_to_contact), [:admin, @contact], class: 'btn btn-default')
= render 'shared/title', name: "#{t(:edit)}: #{@contact.name}" = render 'shared/title', name: "#{t(:edit)}: #{@contact.name}"

View file

@ -1,32 +1,65 @@
- if version.present? && domain.present? - statuses_link ||= false
- children = HashWithIndifferentAccess.new(version.children) - version ||= false
- nameservers = children[:nameservers] || [] - domain ||= false
- tech_contacts = children[:tech_contacts] || [] - pending_user ||= false
- admin_contacts = children[:admin_contacts] || []
- registrant = children[:registrant] || [] - if domain.present?
- if version # normal history
- children = HashWithIndifferentAccess.new(version.children)
- nameservers = children[:nameservers] || []
- tech_contacts = children[:tech_contacts] || []
- admin_contacts = children[:admin_contacts] || []
- registrant = children[:registrant] || []
- event = version.event
- creator = plain_username(version.terminator)
- else # pending history
- nameservers = domain.nameservers
- tech_contacts = domain.tech_contacts
- admin_contacts = domain.admin_contacts
- registrant = [domain.registrant]
- creator = pending_user.try(:username)
- event = 'pending'
%td %td
%p.nowrap %p.nowrap
= l(domain.updated_at, format: :short) = l(domain.updated_at, format: :shorts)
= version.event - if statuses_link
%br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id])
%p.text-right %p.text-right
= version.terminator = event
%br
= creator
%td
%p
- domain.statuses.each do |s|
= s
- notes = domain.status_notes[s]
- if notes
%br
%i= notes
%br
- if domain.pending_json.present?
%p
= link_to t(:pending_epp), '#', class: 'js-pending-toggle'
%td %td
%p %p
= "#{domain.period}#{domain.period_unit}" = "#{domain.period}#{domain.period_unit}"
= "#{l(domain.valid_from, format: :date)} - #{l(domain.valid_to, format: :date)}" %br
%p = "#{l(domain.valid_from, format: :date)}"
= domain.status %br
= "#{l(domain.valid_to, format: :date)}"
%td %td
- registrant.each do |oc| - registrant.each do |r|
%p %p
= oc[:name] = r[:name]
= oc[:phone] = r[:phone]
= oc[:email] = r[:email]
%p %p
= oc[:code] = r[:code]
%td %td
- admin_contacts.each do |ac| - admin_contacts.each do |ac|
@ -47,8 +80,8 @@
= tc[:code] = tc[:code]
%td %td
- nameservers.each do |ns| %p
%p - nameservers.each do |ns|
= ns[:hostname] = ns[:hostname]
%br %br
= ns[:ipv4] = ns[:ipv4]
@ -58,69 +91,13 @@
%p %p
= domain.registrar.name = domain.registrar.name
-# %td - if domain.pending_json.present?
-# = version.children.inspect %tr.js-pending{ style: 'display: none;' }
%td{colspan: 8}
-# %td{ class: changes.include?(:domain) ? 'edit-highlight' : 'no-highlight' } = preserve do
-# - if children[:domain] %pre
-# %p{:style => "font-size:x-small;"} - formatted_req = Nokogiri::XML(domain.pending_json['frame'])
-# = children[:domain][:period] - if formatted_req.errors.none?
-# = children[:domain][:period_unit] if children[:domain][:period] = formatted_req
-# - if children[:domain][:valid_to] && children[:domain][:valid_from] - else
-# = "," = domain.pending_json['frame']
-# = l(children[:domain][:valid_from], format: :date) + '-' + l(children[:domain][:valid_to], format: :date)
-# - if children[:domain].try(:[], :registrar_id)
-# = ","
-# = Registrar.find(children[:domain][:registrar_id]).try(:name)
-# - if children[:domain][:status]
-# = ',' + children[:domain][:status]
-# %td{ class: changes.include?(:registrant) ? 'edit-highlight' : 'no-highlight' }
-# - if children[:registrant]
-# %p{:style => "font-size:x-small;"}
-# = children[:registrant][:name]
-# = ","
-# = children[:registrant][:phone]
-# = ","
-# = children[:registrant][:email]
-# = ","
-# = children[:registrant][:code]
-# %td{ class: changes.include?(:admin_contacts) ? 'edit-highlight' : 'no-highlight' }
-# - if children[:admin_contacts]
-# - children[:admin_contacts].each do |ac|
-# %p{:style => "font-size:x-small;"}
-# = ac[:name]
-# = ","
-# = ac[:phone]
-# = ","
-# = ac[:email]
-# = ","
-# = ac[:code]
-# %td{ class: changes.include?(:tech_contacts) ? 'edit-highlight' : 'no-highlight' }
-# - if children[:tech_contacts]
-# - children[:tech_contacts].each do |tc|
-# %p{:style => "font-size:x-small;"}
-# = tc[:name]
-# = ","
-# = tc[:phone]
-# = ","
-# = tc[:email]
-# = ","
-# = tc[:code]
-# %td{ class: changes.include?(:nameservers) ? 'edit-highlight' : 'no-highlight' }
-# - if children[:nameservers]
-# - children[:nameservers].each do |ns|
-# %p{:style => "font-size:x-small;"}
-# = ns[:hostname]
-# = ","
-# = ns[:ipv4] || ns[:ipv6]
-# %td
-# %p{ :style => 'font-size:x-small;' }
-# = l(version.created_at, format: :short)
-# = whodunnit_with_protocol(version.whodunnit)
-# = version.event

View file

@ -9,20 +9,36 @@
%thead %thead
%tr %tr
%th{class: 'col-xs-1'}= t(:timestap) %th{class: 'col-xs-1'}= t(:timestap)
%th{class: 'col-xs-2'}= t(:period) %th{class: 'col-xs-2'}= t(:statuses)
%th{class: 'col-xs-2'}= t(:owner) %th{class: 'col-xs-1'}= t(:period)
%th{class: 'col-xs-2'}= t(:registrant)
%th{class: 'col-xs-2'}= t(:admin) %th{class: 'col-xs-2'}= t(:admin)
%th{class: 'col-xs-2'}= t(:tech) %th{class: 'col-xs-2'}= t(:tech)
%th{class: 'col-xs-2'}= t(:nameservers) %th{class: 'col-xs-2'}= t(:nameservers)
%th{class: 'col-xs-2'}= t(:registrar) %th{class: 'col-xs-2'}= t(:registrar)
%tbody %tbody
- if @pending_domain.present?
%tr.small
= render 'admin/domain_versions/version',
domain: @pending_domain, pending_user: @pending_user, statuses_link: true
-# current version
- if @domain.versions.present? - if @domain.versions.present?
%tr.small %tr.small
= render 'admin/domain_versions/version', = render 'admin/domain_versions/version',
domain: @domain, version: @domain.versions.last domain: @domain, version: @domain.versions.last
-# all other older versions
- @domain.versions.not_creates.reverse.each do |version| - @domain.versions.not_creates.reverse.each do |version|
%tr.small %tr.small
= render 'admin/domain_versions/version', = render 'admin/domain_versions/version',
domain: version.reify, version: version.previous domain: version.reify, version: version.previous
:coffee
$(document).on 'click', '.js-pending-toggle', (e) ->
e.preventDefault()
$(document).on 'mousedown', '.js-pending-toggle', (e) ->
target = $(e.target)
target.parents('tr').next('tr.js-pending').toggle()

View file

@ -1,28 +0,0 @@
-# .row
-# .col-sm-12
-# %h2.text-center-xs= t(:domains)
-# %hr
-# .row
-# .col-md-12
-# .table-responsive
-# %table.table.table-hover.table-bordered.table-condensed
-# %thead
-# %tr
-# %th{class: 'col-xs-1'}
-# = t(:name)
-# %th{class: 'col-xs-1'}
-# = sort_link(@q, 'whodunnit')
-# %th{class: 'col-xs-1'}
-# = sort_link(@q, 'created_at')
-# %tbody
-# - @domains.each do |domain|
-# - obj = domain.reify
-# %tr
-# %td= link_to(obj.name, admin_domain_version_path(obj))
-# %td= whodunnit_with_protocol(domain.whodunnit) unless domain.whodunnit.nil?
-# %td= l(obj.created_at, format: :short)
-# .row
-# .col-md-12
-# = paginate @domains

View file

@ -6,7 +6,12 @@
.col-md-8 .col-md-8
.tab-content{style:'margin-top: 20px;'} .tab-content{style:'margin-top: 20px;'}
#general-tab.tab-pane.active #general-tab.tab-pane.active
= render 'admin/domains/form_partials/statuses', f: f = render 'admin/shared/form/statuses', f: f,
model: 'domain',
admin_statuses_map: DomainStatus.admin_statuses_map,
disabled_statuses: DomainStatus::STATUSES - DomainStatus.admin_statuses,
not_deletable_statuses: DomainStatus.admin_not_deletable_statuses
.row .row
.col-md-8.text-right .col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary') = button_tag(t(:save), class: 'btn btn-primary')

View file

@ -1,5 +1,13 @@
- content_for :actions do - content_for :actions do
= link_to(t(:add_new_status), '#', class: 'btn btn-primary js-add-status')
- if @domain.force_deletable?
= link_to(t(:set_force_delete), set_force_delete_admin_domain_path(@domain),
method: :post, data: { confirm: t(:are_you_sure) }, class: 'btn btn-warning')
- else
= link_to(t(:unset_force_delete), unset_force_delete_admin_domain_path(@domain),
method: :post, data: { confirm: t(:are_you_sure) }, class: 'btn btn-warning')
= link_to(t(:back_to_domain), [:admin, @domain], class: 'btn btn-default') = link_to(t(:back_to_domain), [:admin, @domain], class: 'btn btn-default')
= render 'shared/title', name: "#{t(:edit)}: #{@domain.name}" = render 'shared/title', name: "#{t(:edit)}: #{@domain.name}"
= render 'form' = render 'form'

View file

@ -0,0 +1,8 @@
- if (status == DomainStatus::PENDING_DELETE && f.object.pending_json.present?)
= link_to(t(:apply_pending), admin_domain_pending_delete_path(f.object.id, f.object.id),
method: :patch, data: { confirm: t(:are_you_sure) },
class: 'btn btn-danger btn-xs')
= link_to(t(:delete_pending), admin_domain_pending_delete_path(f.object.id, f.object.id),
method: :delete, data: { confirm: t(:are_you_sure) },
class: 'btn btn-danger btn-xs')

View file

@ -0,0 +1,8 @@
- if (status == DomainStatus::PENDING_UPDATE && f.object.pending_json.present?)
= link_to(t(:apply_pending), admin_domain_pending_update_path(f.object.id, f.object.id),
method: :patch, data: { confirm: t(:are_you_sure) },
class: 'btn btn-danger btn-xs')
= link_to(t(:delete_pending), admin_domain_pending_update_path(f.object.id, f.object.id),
method: :delete, data: { confirm: t(:are_you_sure) },
class: 'btn btn-danger btn-xs')

View file

@ -1,29 +0,0 @@
#domain-statuses
- @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-status')
.panel-body
.form-group
= f.label 'status', class: 'col-md-2 control-label'
.col-md-10
= select_tag 'domain[statuses][]', options_for_select(DomainStatus.statuses_for_admin, x), include_blank: true, class: 'form-control'
.form-group
= label_tag t(:description), nil, class: 'col-md-2 control-label'
.col-md-10
= 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")
$('.destroy-status').on 'click', (e) ->
e.preventDefault()
if $('.panel').length > 1
$(this).parents('.panel').remove()
else
$(this).parents('.panel').find('select').val('')

View file

@ -6,9 +6,13 @@
%thead %thead
%tr %tr
%th{class: 'col-xs-6'}= t(:status) %th{class: 'col-xs-6'}= t(:status)
%th{class: 'col-xs-6'}= t(:description) %th{class: 'col-xs-6'}= t(:notes)
%tbody %tbody
- @domain.statuses.each do |x| - @domain.statuses.each do |status|
%tr %tr
%td= x
%td %td
- if @domain.pending_json.present? && [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE].include?(status)
= link_to status, admin_domain_domain_versions_path(@domain.id)
- else
= status
%td= @domain.status_notes[status]

View file

@ -1,10 +1,6 @@
- content_for :actions do - content_for :actions do
= link_to(t(:edit_statuses), edit_admin_domain_path(@domain), class: 'btn btn-primary') = link_to(t(:edit_statuses), edit_admin_domain_path(@domain), class: 'btn btn-primary')
= link_to(t(:history), admin_domain_domain_versions_path(@domain.id), method: :get, class: 'btn btn-primary') = link_to(t(:history), admin_domain_domain_versions_path(@domain.id), method: :get, class: 'btn btn-primary')
- if @domain.force_deletable?
= link_to(t(:set_force_delete), set_force_delete_admin_domain_path(@domain), method: :post, data: { confirm: t(:are_you_sure) }, class: 'btn btn-warning')
- else
= link_to(t(:unset_force_delete), unset_force_delete_admin_domain_path(@domain), method: :post, data: { confirm: t(:are_you_sure) }, class: 'btn btn-warning')
= render 'shared/title', name: @domain.name = render 'shared/title', name: @domain.name

View file

@ -15,7 +15,7 @@
.form-group .form-group
= f.label :price = f.label :price
.input-group .input-group
= f.text_field(:price, class: 'form-control') = f.text_field(:price, value: currency(f.object.price), class: 'form-control')
%span.input-group-addon= Money.default_currency %span.input-group-addon= Money.default_currency
.form-group.input-daterange .form-group.input-daterange
= f.label :valid_from, t(:valid) = f.label :valid_from, t(:valid)

View file

@ -33,7 +33,7 @@
%td= pricelist.category %td= pricelist.category
%td= pricelist.duration %td= pricelist.duration
%td= pricelist.operation_category %td= pricelist.operation_category
%td= pricelist.price %td= currency(pricelist.price)
%td= l(pricelist.valid_from, format: :ydate) %td= l(pricelist.valid_from, format: :ydate)
%td= l(pricelist.valid_to, format: :ydate) %td= l(pricelist.valid_to, format: :ydate)
%td= link_to(t(:edit), edit_admin_pricelist_path(pricelist), class: 'btn btn-xs btn-primary') %td= link_to(t(:edit), edit_admin_pricelist_path(pricelist), class: 'btn btn-xs btn-primary')

View file

@ -47,7 +47,7 @@
%th{class: 'col-xs-6'}= t(:setting) %th{class: 'col-xs-6'}= t(:setting)
%th{class: 'col-xs-6'}= t(:value) %th{class: 'col-xs-6'}= t(:value)
%tbody %tbody
= render 'setting_row', var: :transfer_wait_time /= render 'setting_row', var: :transfer_wait_time
= render 'setting_row', var: :ds_algorithm = render 'setting_row', var: :ds_algorithm
= render 'setting_row', var: :client_side_status_editing_enabled = render 'setting_row', var: :client_side_status_editing_enabled
= render 'setting_row', var: :api_ip_whitelist_enabled = render 'setting_row', var: :api_ip_whitelist_enabled
@ -69,6 +69,7 @@
= render 'setting_row', var: :invoice_number_max = render 'setting_row', var: :invoice_number_max
= render 'setting_row', var: :days_to_keep_invoices_active = render 'setting_row', var: :days_to_keep_invoices_active
= render 'setting_row', var: :days_to_keep_overdue_invoices_active = render 'setting_row', var: :days_to_keep_overdue_invoices_active
= render 'setting_row', var: :minimum_deposit
= render 'setting_row', var: :registry_billing_email = render 'setting_row', var: :registry_billing_email
= render 'setting_row', var: :registry_invoice_contact = render 'setting_row', var: :registry_invoice_contact
= render 'setting_row', var: :registry_vat_no = render 'setting_row', var: :registry_vat_no

View file

@ -1,35 +1,38 @@
#js-contact-statuses #js-statuses
- f.object.statuses.each do |s| - f.object.statuses.each do |s|
- disabled = !Contact.admin_statuses.include?(s) - disabled = disabled_statuses.include?(s)
- disabled_style = disabled ? 'display: none' : '' - disabled_style = disabled ? 'display: none' : ''
- delete_style = [Contact::OK, Contact::LINKED].include?(s) ? 'display: none' : '' - delete_style = not_deletable_statuses.include?(s) ? 'display: none' : ''
.panel.panel-default .panel.panel-default
.panel-heading.clearfix .panel-heading.clearfix
.pull-left= t(:status) .pull-left= t(:status)
.pull-right .pull-right
- if model == 'domain'
= render 'admin/domains/form/pending_update', f: f, status: s
= render 'admin/domains/form/pending_delete', f: f, status: s
= link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style) = link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style)
.panel-body .panel-body
.form-group .form-group
= f.label 'status', class: 'col-md-2 control-label' = f.label 'status', class: 'col-md-2 control-label'
.col-md-10 .col-md-10
.js-select{style: disabled_style} .js-select{style: disabled_style}
= select_tag 'contact[statuses][]', = select_tag "#{model}[statuses][]",
options_for_select(Contact::admin_statuses_map, s), options_for_select(admin_statuses_map, s),
include_blank: true, class: "form-control" include_blank: true, class: "form-control"
- if disabled - if disabled
.disabled-value.js-disabled-value .disabled-value.js-disabled-value
= s = s
= hidden_field_tag 'contact[statuses][]', s, readonly: true = hidden_field_tag "#{model}[statuses][]", s, readonly: true
.form-group .form-group
= label_tag t(:notes), nil, class: 'col-md-2 control-label' = label_tag t(:notes), nil, class: 'col-md-2 control-label'
.col-md-10 .col-md-10
- value = f.object.new_record? ? '' : f.object.status_notes[s] - value = f.object.new_record? ? '' : f.object.status_notes[s]
= text_field_tag 'contact[status_notes_array][]', value, class: 'form-control' = text_field_tag "#{model}[status_notes_array][]", value, class: 'form-control'
:coffee :coffee
$("#js-contact-statuses").nestedAttributes $("#js-statuses").nestedAttributes
bindAddTo: $(".js-add-contact-status") bindAddTo: $(".js-add-status")
afterAdd: (el) -> afterAdd: (el) ->
if el.find('.js-disabled-value') if el.find('.js-disabled-value')
el.find('.js-disabled-value').remove() el.find('.js-disabled-value').remove()

View file

@ -0,0 +1,80 @@
= form_for [:admin, @zonefile_setting], html: { class: 'form-horizontal' } do |f|
.row
.col-md-8
#domain-statuses
= render 'shared/full_errors', object: f.object
.form-group
.col-md-4.control-label
= f.label :origin
.col-md-8
- if @zonefile_setting.persisted?
= f.text_field :origin, class: 'form-control', disabled: true
- else
= f.text_field :origin, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :ttl
.col-md-8
= f.text_field :ttl, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :refresh
.col-md-8
= f.text_field :refresh, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :retry
.col-md-8
= f.text_field :retry, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :expire
.col-md-8
= f.text_field :expire, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :minimum_ttl
.col-md-8
= f.text_field :minimum_ttl, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :email
.col-md-8
= f.text_field :email, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :master_nameserver
.col-md-8
= f.text_field :master_nameserver, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :ns_records
.col-md-8
= f.text_area :ns_records, class: 'form-control', rows: 8
.form-group
.col-md-4.control-label
= f.label :a_records
.col-md-8
= f.text_area :a_records, class: 'form-control', rows: 8
.form-group
.col-md-4.control-label
= f.label :a4_records, t(:a4_records)
.col-md-8
= f.text_area :a4_records, class: 'form-control', rows: 8
%hr
.row
.col-md-8.text-right
%button.btn.btn-primary= t(:save)

View file

@ -1,53 +1,7 @@
= render 'shared/title', name: t(:zonefile_settings) - content_for :actions do
= link_to(t(:back), admin_zonefile_settings_path, class: 'btn btn-default')
= link_to(t(:delete), admin_zonefile_setting_path(@zonefile_setting),
method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger')
= render 'shared/title', name: t(:edit_zone)
= form_for [:admin, @zonefile_setting], html: { class: 'form-horizontal' } do |f| = render 'form'
.row
.col-md-8
#domain-statuses
= render 'shared/full_errors', object: f.object
.form-group
.col-md-4.control-label
= f.label :origin
.col-md-8
= f.text_field :origin, class: 'form-control', disabled: true
.form-group
.col-md-4.control-label
= f.label :ttl
.col-md-8
= f.text_field :ttl, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :refresh
.col-md-8
= f.text_field :refresh, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :retry
.col-md-8
= f.text_field :retry, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :expire
.col-md-8
= f.text_field :expire, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :minimum_ttl
.col-md-8
= f.text_field :minimum_ttl, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :email
.col-md-8
= f.text_field :email, class: 'form-control', email: true
%hr
.row
.col-md-8.text-right
%button.btn.btn-primary= t(:save)

View file

@ -1,3 +1,5 @@
- content_for :actions do
= link_to(t(:new), new_admin_zonefile_setting_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:zonefile_settings) = render 'shared/title', name: t(:zonefile_settings)
.row .row
@ -15,6 +17,6 @@
%tr %tr
%td= link_to(x, edit_admin_zonefile_setting_path(x)) %td= link_to(x, edit_admin_zonefile_setting_path(x))
%td %td
= link_to(t(:generate_zonefile), = link_to(t(:generate_zonefile),
admin_zonefiles_path(origin: x.origin), admin_zonefiles_path(origin: x.origin),
method: 'post', class: 'btn btn-xs btn-primary') method: 'post', class: 'btn btn-xs btn-primary')

View file

@ -0,0 +1,5 @@
- content_for :actions do
= link_to(t(:back), admin_zonefile_settings_path, class: 'btn btn-default')
= render 'shared/title', name: t(:new_zone)
= render 'form'

View file

@ -56,8 +56,8 @@
%ul.dropdown-menu{role: "menu"} %ul.dropdown-menu{role: "menu"}
- ApiUser.where(identity_code: current_user.identity_code).includes(:registrar).each do |x| - ApiUser.where(identity_code: current_user.identity_code).includes(:registrar).each do |x|
%li= link_to "#{x} (#{x.roles.first}) - #{x.registrar}", "/registrar/switch_user/#{x.id}" %li= link_to "#{x} (#{x.roles.first}) - #{x.registrar}", "/registrar/switch_user/#{x.id}"
- if user_signed_in? - if user_signed_in?
%li= link_to t(:log_out_), '/registrar/logout' %li= link_to t(:log_out_), '/registrar/logout'
.container .container
= render 'shared/flash' = render 'shared/flash'

View file

@ -11,7 +11,7 @@
= Country.new(f.object.ident_country_code).try(:to_s) = Country.new(f.object.ident_country_code).try(:to_s)
= " [#{f.object.ident_country_code}]" = " [#{f.object.ident_country_code}]"
- else - else
- country_selected = @contact.persisted? ? '' : 'EE' - country_selected = @contact.persisted? ? '' : (params[:depp_contact].try(:[], :ident_country_code) || 'EE')
= f.select(:ident_country_code, SortedCountry.all_options(country_selected), {}, = f.select(:ident_country_code, SortedCountry.all_options(country_selected), {},
class: 'js-ident-country-code', required: true) class: 'js-ident-country-code', required: true)
@ -24,7 +24,7 @@
= Depp::Contact.type_string(f.object.ident_type) = Depp::Contact.type_string(f.object.ident_type)
= " [#{f.object.ident_type}]" = " [#{f.object.ident_type}]"
- else - else
- type_selected = @contact.persisted? ? '' : 'bic' - type_selected = @contact.persisted? ? '' : (params[:depp_contact].try(:[], :ident_type) || 'bic')
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES, = f.select(:ident_type, Depp::Contact::SELECTION_TYPES,
{ selected: type_selected }, { selected: type_selected },
class: 'js-ident-type', required: true) class: 'js-ident-type', required: true)
@ -33,7 +33,7 @@
.col-md-3.control-label .col-md-3.control-label
= f.label :ident, t(:ident) + '*' = f.label :ident, t(:ident) + '*'
.col-md-7 .col-md-7
- if f.object.ident.present? - if @contact.persisted? && f.object.ident.present?
.disabled-value .disabled-value
= f.object.ident = f.object.ident
- else - else

View file

@ -7,42 +7,89 @@
= render 'shared/title', name: t(:domains) = render 'shared/title', name: t(:domains)
.row .row
.col-md-12{style: 'margin-bottom: -15px;'} .col-md-12
= form_tag info_registrar_domains_path, class: 'form-horizontal', method: :get do = search_form_for [:registrar, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
.col-md-11 .row
.form-group .col-md-3
= text_field_tag :domain_name, params[:domain_name], class: 'form-control', placeholder: t(:domain_name), autocomplete: 'off', autofocus: true .form-group
.col-md-1.text-right.text-center-xs = f.label :name
.form-group = f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
%button.btn.btn-default .col-md-3
.form-group
= f.label t(:registrant_ident)
= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident)
.col-md-3
.form-group
= f.label t(:contact_ident)
= f.search_field :contacts_ident_eq, class: 'form-control', placeholder: t(:contact_ident)
.col-md-3
.form-group
= f.label t(:nameserver_hostname)
= f.search_field :nameservers_hostname_eq, class: 'form-control', placeholder: t(:nameserver_hostname)
.row
.col-md-6
.form-group
= label_tag t(:status)
= select_tag :statuses_contains, options_for_select(DomainStatus::STATUSES, params[:statuses_contains]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
.col-md-3
.form-group
= f.label t(:valid_to_from)
= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control datepicker', placeholder: t(:valid_to_from)
.col-md-3
.form-group
= f.label t(:valid_to_until)
= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control datepicker', placeholder: t(:valid_to_until)
.row
.col-md-6
.col-md-3
.form-group
= label_tag t(:results_per_page)
= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
.col-md-3{style: 'padding-top: 25px;'}
%button.btn.btn-primary.search
&nbsp; &nbsp;
%span.glyphicon.glyphicon-search %span.glyphicon.glyphicon-search
&nbsp; &nbsp;
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
%hr %hr
- if @response .row
.table-responsive .col-md-12
%table.table.table-hover.table-condensed .table-responsive
%thead %table.table.table-hover.table-bordered.table-condensed
%tr %thead
%th{class: 'col-xs-3'}= t(:name)
%th{class: 'col-xs-6'}= t(:valid)
%th{class: 'col-xs-3'}= t(:actions)
%tbody
- @response['domains'].each do |x|
%tr %tr
%td= link_to(x['name'], info_registrar_domains_path(domain_name: x['name'])) %th{class: 'col-xs-2'}
%td = sort_link(@q, 'name')
= Time.zone.parse(x['valid_from']).try(:to_date) %th{class: 'col-xs-2'}
\- = sort_link(@q, 'registrant_name', t(:registrant))
= Time.zone.parse(x['valid_to']).try(:to_date) %th{class: 'col-xs-2'}
%td = sort_link(@q, 'valid_to', t(:valid_to))
= link_to(t(:edit), edit_registrar_domains_path(domain_name: x['name']), %th{class: 'col-xs-2'}= t('actions')
class: 'btn btn-primary btn-xs') %tbody
= link_to(t(:renew), renew_registrar_domains_path(domain_name: x['name']), - @domains.each do |x|
class: 'btn btn-default btn-xs') %tr
= link_to(t(:delete), delete_registrar_domains_path(domain_name: x['name']), %td= link_to(truncate(x.name), info_registrar_domains_path(domain_name: x.name))
%td
- if x.registrant
= link_to(x.registrant, registrar_contact_path(id: x.registrant.code))
%td= l(x.valid_to, format: :date_long)
%td
= link_to(t(:edit), edit_registrar_domains_path(domain_name: x.name),
class: 'btn btn-primary btn-xs')
= link_to(t(:renew), renew_registrar_domains_path(domain_name: x.name),
class: 'btn btn-default btn-xs') class: 'btn btn-default btn-xs')
= link_to(t(:delete), delete_registrar_domains_path(domain_name: x.name),
class: 'btn btn-default btn-xs')
.row
.col-md-6
= paginate @domains
.col-md-6.text-right
.pagination
= t(:result_count, count: @domains.total_count)
= paginate @paginatable_array :coffee
$(".js-reset-form").on "click", (e) ->
e.preventDefault();
window.location = "#{registrar_domains_path}"

View file

@ -27,7 +27,7 @@
%dt= t(:description) %dt= t(:description)
- @invoice.description.prepend(' - ') if @invoice.description.present? - @invoice.description.prepend(' - ') if @invoice.description.present?
%dd= "#{t('invoice_no', no: @invoice.id)}#{@invoice.description}" %dd= "#{t('invoice_no', no: @invoice.number)}#{@invoice.description}"
%dt= t(:reference_no) %dt= t(:reference_no)
%dd= @invoice.reference_no %dd= @invoice.reference_no

View file

@ -14,19 +14,19 @@
%tr %tr
%td= t(x.description) %td= t(x.description)
%td= x.unit %td= x.unit
%td= x.amount %td= currency(x.amount)
%td= x.price %td= currency(x.price)
%td= x.item_sum_without_vat %td= currency(x.item_sum_without_vat)
%tfoot %tfoot
%tr %tr
%th{colspan: 3} %th{colspan: 3}
%th= t(:total_without_vat) %th= t(:total_without_vat)
%td= @invoice.sum_without_vat %td= currency(@invoice.sum_without_vat)
%tr %tr
%th.no-border{colspan: 3} %th.no-border{colspan: 3}
%th= t('vat', vat_prc: (@invoice.vat_prc * 100).round) %th= t('vat', vat_prc: (@invoice.vat_prc * 100).round)
%td= @invoice.vat %td= currency(@invoice.vat)
%tr %tr
%th.no-border{colspan: 3} %th.no-border{colspan: 3}
%th= t(:total) %th= t(:total)
%td= @invoice.sum %td= currency(@invoice.sum)

View file

@ -177,7 +177,7 @@
%dt= t(:description) %dt= t(:description)
- @invoice.description.prepend(' - ') if @invoice.description.present? - @invoice.description.prepend(' - ') if @invoice.description.present?
%dd= "#{t('invoice_no', no: @invoice.id)}#{@invoice.description}" %dd= "#{t('invoice_no', no: @invoice.number)}#{@invoice.description}"
%dt= t(:reference_no) %dt= t(:reference_no)
%dd= @invoice.reference_no %dd= @invoice.reference_no
@ -229,22 +229,22 @@
%tr %tr
%td= t(x.description) %td= t(x.description)
%td= x.unit %td= x.unit
%td= x.amount %td= currency(x.amount)
%td= x.price %td= currency(x.price)
%td= "#{x.item_sum_without_vat} #{@invoice.currency}" %td= "#{currency(x.item_sum_without_vat)} #{@invoice.currency}"
%tfoot %tfoot
%tr %tr
%th{colspan: 3} %th{colspan: 3}
%th= t(:total_without_vat) %th= t(:total_without_vat)
%td= "#{@invoice.sum_without_vat} #{@invoice.currency}" %td= "#{currency(@invoice.sum_without_vat)} #{@invoice.currency}"
%tr %tr
%th.no-border{colspan: 3} %th.no-border{colspan: 3}
%th= t('vat', vat_prc: (@invoice.vat_prc * 100).round) %th= t('vat', vat_prc: (@invoice.vat_prc * 100).round)
%td= "#{@invoice.vat} #{@invoice.currency}" %td= "#{currency(@invoice.vat)} #{@invoice.currency}"
%tr %tr
%th.no-border{colspan: 3} %th.no-border{colspan: 3}
%th= t(:total) %th= t(:total)
%td= "#{@invoice.sum} #{@invoice.currency}" %td= "#{currency(@invoice.sum)} #{@invoice.currency}"
#footer #footer
%hr %hr

View file

@ -74,3 +74,5 @@ module Registry
} }
end end
end end
require 'validates_email_format_of'

View file

@ -22,6 +22,7 @@ if con.present? && con.table_exists?('settings')
Setting.save_default(:ns_max_count, 11) Setting.save_default(:ns_max_count, 11)
Setting.save_default(:transfer_wait_time, 0) Setting.save_default(:transfer_wait_time, 0)
Setting.transfer_wait_time = 0
Setting.save_default(:request_confrimation_on_registrant_change_enabled, true) Setting.save_default(:request_confrimation_on_registrant_change_enabled, true)
Setting.save_default(:request_confirmation_on_domain_deletion_enabled, true) Setting.save_default(:request_confirmation_on_domain_deletion_enabled, true)
@ -31,6 +32,8 @@ if con.present? && con.table_exists?('settings')
Setting.save_default(:invoice_number_max, 149999) Setting.save_default(:invoice_number_max, 149999)
Setting.save_default(:days_to_keep_invoices_active, 30) Setting.save_default(:days_to_keep_invoices_active, 30)
Setting.save_default(:days_to_keep_overdue_invoices_active, 30) Setting.save_default(:days_to_keep_overdue_invoices_active, 30)
Setting.save_default(:minimum_deposit, 0.0)
Setting.save_default(:days_to_renew_domain_before_expire, 90) Setting.save_default(:days_to_renew_domain_before_expire, 90)
Setting.save_default(:expire_warning_period, 15) Setting.save_default(:expire_warning_period, 15)
Setting.save_default(:redemption_grace_period, 30) Setting.save_default(:redemption_grace_period, 30)

View file

@ -22,6 +22,7 @@ en:
longer: "%a, %e. %b %Y, %H:%M" longer: "%a, %e. %b %Y, %H:%M"
long: "%A, %e. %B %Y, %H:%M" long: "%A, %e. %B %Y, %H:%M"
short: "%d.%m.%y, %H:%M" short: "%d.%m.%y, %H:%M"
shorts: "%d.%m.%y, %H:%M:%S"
date: "%d.%m.%y" date: "%d.%m.%y"
date_long: "%d. %B %Y" date_long: "%d. %B %Y"
ydate: "%Y.%m.%d" ydate: "%Y.%m.%d"
@ -654,7 +655,10 @@ en:
general: General general: General
id_card: 'ID Card' id_card: 'ID Card'
m_id: 'M-ID' m_id: 'M-ID'
destroyed: It was successfully deleted. pending_removed: Pending was successfully removed.
pending_applied: Pending was successfully applied.
something_wrong: Not success, something went wrong!
failure: Not success
not_found: Not found not_found: Not found
no_connection_to_registry: Connection issue to the registry EPP or REPP server! Please try again later. no_connection_to_registry: Connection issue to the registry EPP or REPP server! Please try again later.
domain_not_found: 'Domain was not found' domain_not_found: 'Domain was not found'
@ -894,3 +898,15 @@ en:
nameserver_hostname: 'Nameserver hostname' nameserver_hostname: 'Nameserver hostname'
result_count: '%{count} results' result_count: '%{count} results'
failed_to_generate_invoice_invoice_number_limit_reached: 'Failed to generate invoice - invoice number limit reached' failed_to_generate_invoice_invoice_number_limit_reached: 'Failed to generate invoice - invoice number limit reached'
is_too_small_minimum_deposit_is: 'is too small. Minimum deposit is %{amount} %{currency}'
a4_records: 'AAAA records'
new_zone: 'New zone'
edit_zone: 'Edit zone'
there_are_count_domains_in_this_zone: 'There are %{count} domains in this zone'
poll_pending_update_confirmed_by_registrant: 'Registrant confirmed domain update'
poll_pending_update_rejected_by_registranti: 'Registrant rejected domain update'
poll_pending_delete_rejected_by_registrant: 'Registrant rejected domain deletion'
poll_pending_delete_confirmed_by_registrant: 'Registrant confirmed domain deletion'
manage: Manage
pending_epp: Pending epp

View file

@ -184,6 +184,8 @@ Rails.application.routes.draw do
resources :domains do resources :domains do
resources :domain_versions resources :domain_versions
resources :pending_updates
resources :pending_deletes
member do member do
post 'set_force_delete' post 'set_force_delete'
post 'unset_force_delete' post 'unset_force_delete'

View file

@ -0,0 +1,7 @@
class AddNsDataToZones < ActiveRecord::Migration
def change
add_column :zonefile_settings, :ns_records, :text
add_column :zonefile_settings, :a_records, :text
add_column :zonefile_settings, :a4_records, :text
end
end

View file

@ -0,0 +1,5 @@
class AddStatusesBackupForDomains < ActiveRecord::Migration
def change
add_column :domains, :statuses_backup, :string, array: true, default: []
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150722071128) do ActiveRecord::Schema.define(version: 20150810114746) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -216,6 +216,12 @@ ActiveRecord::Schema.define(version: 20150722071128) do
t.string "updator_str" t.string "updator_str"
end 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| create_table "delegation_signers", force: :cascade do |t|
t.integer "domain_id" t.integer "domain_id"
t.string "key_tag" t.string "key_tag"
@ -323,6 +329,7 @@ ActiveRecord::Schema.define(version: 20150722071128) do
t.string "statuses", array: true t.string "statuses", array: true
t.boolean "reserved", default: false t.boolean "reserved", default: false
t.hstore "status_notes" t.hstore "status_notes"
t.string "statuses_backup", default: [], array: true
end end
add_index "domains", ["delete_at"], name: "index_domains_on_delete_at", using: :btree add_index "domains", ["delete_at"], name: "index_domains_on_delete_at", using: :btree
@ -1026,7 +1033,7 @@ ActiveRecord::Schema.define(version: 20150722071128) do
t.text "crt" t.text "crt"
t.string "type" t.string "type"
t.string "registrant_ident" t.string "registrant_ident"
t.string "encrypted_password", default: "" t.string "encrypted_password", default: "", null: false
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.integer "failed_attempts", default: 0, null: false t.integer "failed_attempts", default: 0, null: false
t.datetime "locked_at" t.datetime "locked_at"
@ -1076,6 +1083,9 @@ ActiveRecord::Schema.define(version: 20150722071128) do
t.datetime "updated_at" t.datetime "updated_at"
t.string "creator_str" t.string "creator_str"
t.string "updator_str" t.string "updator_str"
t.text "ns_records"
t.text "a_records"
t.text "a4_records"
end end
end end

View file

@ -82,33 +82,28 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
ret = concat(tmp_var, chr(10), chr(10)); ret = concat(tmp_var, chr(10), chr(10));
-- origin ns records
SELECT ns_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10));
-- ns records -- ns records
SELECT array_to_string( SELECT array_to_string(
array( array(
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.') SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
FROM domains d FROM domains d
JOIN nameservers ns ON ns.domain_id = d.id JOIN nameservers ns ON ns.domain_id = d.id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter OR d.name = i_origin WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
AND NOT ('{serverHold,clientHold}' && d.statuses)
ORDER BY d.name ORDER BY d.name
), ),
chr(10) chr(10)
) INTO tmp_var; ) INTO tmp_var;
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10), chr(10)); ret := concat(ret, tmp_var, chr(10), chr(10));
-- a glue records for origin nameservers -- origin a glue records
SELECT array_to_string( SELECT a_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
array( ret := concat(ret, '; Zone A Records', chr(10), tmp_var, chr(10));
SELECT concat(ns.hostname, '. IN A ', ns.ipv4)
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name = i_origin
AND ns.hostname LIKE '%.' || d.name
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
), chr(10)
) INTO tmp_var;
ret := concat(ret, '; Zone A Records', chr(10), tmp_var);
-- a glue records for other nameservers -- a glue records for other nameservers
SELECT array_to_string( SELECT array_to_string(
@ -120,43 +115,15 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
AND ns.hostname LIKE '%.' || d.name AND ns.hostname LIKE '%.' || d.name
AND d.name <> i_origin AND d.name <> i_origin
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> '' AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods AND NOT ('{serverHold,clientHold}' && d.statuses)
SELECT 1 FROM nameservers nsi
JOIN domains di ON nsi.domain_id = di.id
WHERE di.name = i_origin
AND nsi.hostname = ns.hostname
)
), chr(10) ), chr(10)
) INTO tmp_var; ) INTO tmp_var;
-- TODO This is a possible subtitition to the previous query, stress testing is needed to see which is faster ret := concat(ret, tmp_var, chr(10), chr(10));
-- SELECT ns.* -- origin aaaa glue records
-- FROM nameservers ns SELECT a4_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
-- JOIN domains d ON d.id = ns.domain_id ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var, chr(10));
-- WHERE d.name LIKE '%ee' AND d.name NOT LIKE '%pri.ee'
-- AND ns.hostname LIKE '%.' || d.name
-- AND d.name <> 'ee'
-- AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
-- AND ns.hostname NOT IN (
-- SELECT ns.hostname FROM domains d JOIN nameservers ns ON d.id = ns.domain_id WHERE d.name = 'ee'
-- )
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10));
-- aaaa glue records for origin nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN AAAA ', ns.ipv6)
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name = i_origin
AND ns.hostname LIKE '%.' || d.name
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
), chr(10)
) INTO tmp_var;
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var);
-- aaaa glue records for other nameservers -- aaaa glue records for other nameservers
SELECT array_to_string( SELECT array_to_string(
@ -168,16 +135,11 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
AND ns.hostname LIKE '%.' || d.name AND ns.hostname LIKE '%.' || d.name
AND d.name <> i_origin AND d.name <> i_origin
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> '' AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods AND NOT ('{serverHold,clientHold}' && d.statuses)
SELECT 1 FROM nameservers nsi
JOIN domains di ON nsi.domain_id = di.id
WHERE di.name = i_origin
AND nsi.hostname = ns.hostname
)
), chr(10) ), chr(10)
) INTO tmp_var; ) INTO tmp_var;
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10)); ret := concat(ret, tmp_var, chr(10), chr(10));
-- ds records -- ds records
SELECT array_to_string( SELECT array_to_string(
@ -189,6 +151,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
FROM domains d FROM domains d
JOIN dnskeys dk ON dk.domain_id = d.id JOIN dnskeys dk ON dk.domain_id = d.id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter AND dk.flags = 257 WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter AND dk.flags = 257
AND NOT ('{serverHold,clientHold}' && d.statuses)
), ),
chr(10) chr(10)
) INTO tmp_var; ) INTO tmp_var;
@ -690,6 +653,15 @@ CREATE SEQUENCE countries_id_seq
ALTER SEQUENCE countries_id_seq OWNED BY countries.id; ALTER SEQUENCE countries_id_seq OWNED BY countries.id;
--
-- Name: data_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE data_migrations (
version character varying NOT NULL
);
-- --
-- Name: delegation_signers; Type: TABLE; Schema: public; Owner: -; Tablespace: -- Name: delegation_signers; Type: TABLE; Schema: public; Owner: -; Tablespace:
-- --
@ -938,7 +910,8 @@ CREATE TABLE domains (
force_delete_at timestamp without time zone, force_delete_at timestamp without time zone,
statuses character varying[], statuses character varying[],
reserved boolean DEFAULT false, reserved boolean DEFAULT false,
status_notes hstore status_notes hstore,
statuses_backup character varying[] DEFAULT '{}'::character varying[]
); );
@ -2377,7 +2350,7 @@ CREATE TABLE pricelists (
id integer NOT NULL, id integer NOT NULL,
"desc" character varying, "desc" character varying,
category character varying, category character varying,
price_cents numeric(10,2) DEFAULT 0 NOT NULL, price_cents numeric(10,2) DEFAULT 0.0 NOT NULL,
price_currency character varying DEFAULT 'EUR'::character varying NOT NULL, price_currency character varying DEFAULT 'EUR'::character varying NOT NULL,
valid_from timestamp without time zone, valid_from timestamp without time zone,
valid_to timestamp without time zone, valid_to timestamp without time zone,
@ -2641,7 +2614,7 @@ CREATE TABLE users (
crt text, crt text,
type character varying, type character varying,
registrant_ident character varying, registrant_ident character varying,
encrypted_password character varying DEFAULT ''::character varying, encrypted_password character varying DEFAULT ''::character varying NOT NULL,
remember_created_at timestamp without time zone, remember_created_at timestamp without time zone,
failed_attempts integer DEFAULT 0 NOT NULL, failed_attempts integer DEFAULT 0 NOT NULL,
locked_at timestamp without time zone locked_at timestamp without time zone
@ -2784,7 +2757,10 @@ CREATE TABLE zonefile_settings (
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
creator_str character varying, creator_str character varying,
updator_str character varying updator_str character varying,
ns_records text,
a_records text,
a4_records text
); );
@ -4512,6 +4488,13 @@ CREATE INDEX index_whois_records_on_domain_id ON whois_records USING btree (doma
CREATE INDEX index_whois_records_on_registrar_id ON whois_records USING btree (registrar_id); CREATE INDEX index_whois_records_on_registrar_id ON whois_records USING btree (registrar_id);
--
-- Name: unique_data_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX unique_data_migrations ON data_migrations USING btree (version);
-- --
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
-- --
@ -4727,8 +4710,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150227092508');
INSERT INTO schema_migrations (version) VALUES ('20150227113121'); INSERT INTO schema_migrations (version) VALUES ('20150227113121');
INSERT INTO schema_migrations (version) VALUES ('20150302130224');
INSERT INTO schema_migrations (version) VALUES ('20150302161712'); INSERT INTO schema_migrations (version) VALUES ('20150302161712');
INSERT INTO schema_migrations (version) VALUES ('20150303130729'); INSERT INTO schema_migrations (version) VALUES ('20150303130729');
@ -4787,8 +4768,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150417082723');
INSERT INTO schema_migrations (version) VALUES ('20150421134820'); INSERT INTO schema_migrations (version) VALUES ('20150421134820');
INSERT INTO schema_migrations (version) VALUES ('20150422090645');
INSERT INTO schema_migrations (version) VALUES ('20150422092514'); INSERT INTO schema_migrations (version) VALUES ('20150422092514');
INSERT INTO schema_migrations (version) VALUES ('20150422132631'); INSERT INTO schema_migrations (version) VALUES ('20150422132631');
@ -4833,8 +4812,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150519115050');
INSERT INTO schema_migrations (version) VALUES ('20150519140853'); INSERT INTO schema_migrations (version) VALUES ('20150519140853');
INSERT INTO schema_migrations (version) VALUES ('20150519142542');
INSERT INTO schema_migrations (version) VALUES ('20150519144118'); INSERT INTO schema_migrations (version) VALUES ('20150519144118');
INSERT INTO schema_migrations (version) VALUES ('20150520163237'); INSERT INTO schema_migrations (version) VALUES ('20150520163237');
@ -4847,7 +4824,9 @@ INSERT INTO schema_migrations (version) VALUES ('20150522164020');
INSERT INTO schema_migrations (version) VALUES ('20150525075550'); INSERT INTO schema_migrations (version) VALUES ('20150525075550');
INSERT INTO schema_migrations (version) VALUES ('20150603141054'); INSERT INTO schema_migrations (version) VALUES ('20150601083516');
INSERT INTO schema_migrations (version) VALUES ('20150601083800');
INSERT INTO schema_migrations (version) VALUES ('20150603141549'); INSERT INTO schema_migrations (version) VALUES ('20150603141549');
@ -4855,8 +4834,12 @@ INSERT INTO schema_migrations (version) VALUES ('20150603211318');
INSERT INTO schema_migrations (version) VALUES ('20150603212659'); INSERT INTO schema_migrations (version) VALUES ('20150603212659');
INSERT INTO schema_migrations (version) VALUES ('20150609093515');
INSERT INTO schema_migrations (version) VALUES ('20150609103333'); INSERT INTO schema_migrations (version) VALUES ('20150609103333');
INSERT INTO schema_migrations (version) VALUES ('20150610111019');
INSERT INTO schema_migrations (version) VALUES ('20150610112238'); INSERT INTO schema_migrations (version) VALUES ('20150610112238');
INSERT INTO schema_migrations (version) VALUES ('20150610144547'); INSERT INTO schema_migrations (version) VALUES ('20150610144547');
@ -4865,8 +4848,12 @@ INSERT INTO schema_migrations (version) VALUES ('20150611124920');
INSERT INTO schema_migrations (version) VALUES ('20150612123111'); INSERT INTO schema_migrations (version) VALUES ('20150612123111');
INSERT INTO schema_migrations (version) VALUES ('20150612125720');
INSERT INTO schema_migrations (version) VALUES ('20150701074344'); INSERT INTO schema_migrations (version) VALUES ('20150701074344');
INSERT INTO schema_migrations (version) VALUES ('20150703084206');
INSERT INTO schema_migrations (version) VALUES ('20150703084632'); INSERT INTO schema_migrations (version) VALUES ('20150703084632');
INSERT INTO schema_migrations (version) VALUES ('20150706091724'); INSERT INTO schema_migrations (version) VALUES ('20150706091724');
@ -4883,3 +4870,7 @@ INSERT INTO schema_migrations (version) VALUES ('20150713113436');
INSERT INTO schema_migrations (version) VALUES ('20150722071128'); INSERT INTO schema_migrations (version) VALUES ('20150722071128');
INSERT INTO schema_migrations (version) VALUES ('20150803080914');
INSERT INTO schema_migrations (version) VALUES ('20150810114746');

File diff suppressed because it is too large Load diff

View file

@ -13,8 +13,10 @@ Contact Mapping protocol short version:
----------------------- ------- ----------------- ----------------------- ------- -----------------
<create> 1 <create> 1
<contact:create> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd" <contact:create> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd"
<contact:id> 0-1 Contact id, optional, string, no spaces, max 100 characters, <contact:id> 0-1 Contact id, optional,
generated automatically if missing string: ASCII letters, numbers, ':', '-' characters, no spaces,
max 100 characters,
generated automatically if missing.
<contact:postalInfo> 1 Postal information container <contact:postalInfo> 1 Postal information container
<contact:name> 1 Full name of the contact <contact:name> 1 Full name of the contact
<contact:org> 0 Org is not supported and must be blank or missing <contact:org> 0 Org is not supported and must be blank or missing

View file

@ -70,6 +70,9 @@
<enumeration value="gz"/> <enumeration value="gz"/>
<enumeration value="tar"/> <enumeration value="tar"/>
<enumeration value="7z"/> <enumeration value="7z"/>
<enumeration value="odt"/>
<enumeration value="doc"/>
<enumeration value="docx"/>
</restriction> </restriction>
</simpleType> </simpleType>

View file

@ -70,6 +70,9 @@
<enumeration value="gz"/> <enumeration value="gz"/>
<enumeration value="tar"/> <enumeration value="tar"/>
<enumeration value="7z"/> <enumeration value="7z"/>
<enumeration value="odt"/>
<enumeration value="doc"/>
<enumeration value="docx"/>
</restriction> </restriction>
</simpleType> </simpleType>

View file

@ -54,7 +54,7 @@ namespace :import do
Rake::Task['import:registrars'].invoke Rake::Task['import:registrars'].invoke
Rake::Task['import:contacts'].invoke Rake::Task['import:contacts'].invoke
Rake::Task['import:domains'].invoke Rake::Task['import:domains'].invoke
Rake::Task['import:eis_domains'].invoke Rake::Task['import:zones'].invoke
end end
desc 'Import registrars' desc 'Import registrars'
@ -473,246 +473,197 @@ namespace :import do
puts "-----> Imported #{count} new domains in #{(Time.zone.now.to_f - start).round(2)} seconds" puts "-----> Imported #{count} new domains in #{(Time.zone.now.to_f - start).round(2)} seconds"
end end
desc 'Import EIS domains' desc 'Import zones'
task eis_domains: :environment do task zones: :environment do
start = Time.zone.now.to_f start = Time.zone.now.to_f
puts '-----> Importing EIS domains...' puts '-----> Importing zones...'
eis = Registrar.where( ns_records, a_records, a4_records = parse_zone_ns_data('ee', 1)
name: 'EIS',
reg_no: '90010019',
phone: '+3727271000',
country_code: 'EE',
vat_no: 'EE101286464',
email: 'info@internet.ee',
state: 'Harjumaa',
city: 'Tallinn',
street: 'Paldiski mnt 80',
zip: '10617',
url: 'www.internet.ee',
code: 'EIS'
).first_or_create!
unless eis.cash_account ZonefileSetting.create!({
eis.accounts.create(account_type: Account::CASH, currency: 'EUR') origin: 'ee',
eis.save ttl: 43200,
end refresh: 3600,
retry: 900,
c = Registrant.where( expire: 1209600,
name: 'Eesti Interneti Sihtasutus', minimum_ttl: 3600,
phone: '+372.7271000', email: 'hostmaster.eestiinternet.ee',
email: 'info@internet.ee', master_nameserver: 'ns.tld.ee',
ident: '90010019', ns_records: ns_records,
ident_type: 'passport', a_records: a_records,
city: 'Tallinn', a4_records: a4_records
country_code: 'ee', })
street: 'Paldiski mnt 80',
zip: '10617',
registrar: eis
).first_or_create!
# ee
ns_list = []
Legacy::ZoneNs.where(zone: 1).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!(
name: 'ee',
valid_to: Date.new(9999, 1, 1),
period: 1,
period_unit: 'y',
registrant: c,
nameservers: ns_list,
admin_contacts: [c],
tech_contacts: [c],
registrar: eis
)
# edu.ee # edu.ee
ns_list = [] ns_records, a_records, a4_records = parse_zone_ns_data('edu.ee', 6)
Legacy::ZoneNs.where(zone: 6).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!( ZonefileSetting.create!({
name: 'edu.ee', origin: 'edu.ee',
valid_to: Date.new(9999, 1, 1), ttl: 43200,
period: 1, refresh: 3600,
period_unit: 'y', retry: 900,
registrant: c, expire: 1209600,
nameservers: ns_list, minimum_ttl: 3600,
admin_contacts: [c], email: 'hostmaster.eestiinternet.ee',
tech_contacts: [c], master_nameserver: 'ns.tld.ee',
registrar: eis ns_records: ns_records,
) a_records: a_records,
a4_records: a4_records
})
# aip.ee # aip.ee
ns_list = [] ns_records, a_records, a4_records = parse_zone_ns_data('aip.ee', 9)
Legacy::ZoneNs.where(zone: 9).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!( ZonefileSetting.create!({
name: 'aip.ee', origin: 'aip.ee',
valid_to: Date.new(9999, 1, 1), ttl: 43200,
period: 1, refresh: 3600,
period_unit: 'y', retry: 900,
registrant: c, expire: 1209600,
nameservers: ns_list, minimum_ttl: 3600,
admin_contacts: [c], email: 'hostmaster.eestiinternet.ee',
tech_contacts: [c], master_nameserver: 'ns.tld.ee',
registrar: eis ns_records: ns_records,
) a_records: a_records,
a4_records: a4_records
})
# org.ee # org.ee
ns_list = [] ns_records, a_records, a4_records = parse_zone_ns_data('org.ee', 10)
Legacy::ZoneNs.where(zone: 10).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!( ZonefileSetting.create!({
name: 'org.ee', origin: 'org.ee',
valid_to: Date.new(9999, 1, 1), ttl: 43200,
period: 1, refresh: 3600,
period_unit: 'y', retry: 900,
registrant: c, expire: 1209600,
nameservers: ns_list, minimum_ttl: 3600,
admin_contacts: [c], email: 'hostmaster.eestiinternet.ee',
tech_contacts: [c], master_nameserver: 'ns.tld.ee',
registrar: eis ns_records: ns_records,
) a_records: a_records,
a4_records: a4_records
})
# pri.ee # pri.ee
ns_list = [] ns_records, a_records, a4_records = parse_zone_ns_data('pri.ee', 2)
Legacy::ZoneNs.where(zone: 2).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!( ZonefileSetting.create!({
name: 'pri.ee', origin: 'pri.ee',
valid_to: Date.new(9999, 1, 1), ttl: 43200,
period: 1, refresh: 3600,
period_unit: 'y', retry: 900,
registrant: c, expire: 1209600,
nameservers: ns_list, minimum_ttl: 3600,
admin_contacts: [c], email: 'hostmaster.eestiinternet.ee',
tech_contacts: [c], master_nameserver: 'ns.tld.ee',
registrar: eis ns_records: ns_records,
) a_records: a_records,
a4_records: a4_records
})
# med.ee # med.ee
ns_list = [] ns_records, a_records, a4_records = parse_zone_ns_data('med.ee', 3)
Legacy::ZoneNs.where(zone: 3).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!( ZonefileSetting.create!({
name: 'med.ee', origin: 'med.ee',
valid_to: Date.new(9999, 1, 1), ttl: 43200,
period: 1, refresh: 3600,
period_unit: 'y', retry: 900,
registrant: c, expire: 1209600,
nameservers: ns_list, minimum_ttl: 3600,
admin_contacts: [c], email: 'hostmaster.eestiinternet.ee',
tech_contacts: [c], master_nameserver: 'ns.tld.ee',
registrar: eis ns_records: ns_records,
) a_records: a_records,
a4_records: a4_records
})
# fie.ee # fie.ee
ns_list = [] ns_records, a_records, a4_records = parse_zone_ns_data('fie.ee', 4)
Legacy::ZoneNs.where(zone: 4).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!( ZonefileSetting.create!({
name: 'fie.ee', origin: 'fie.ee',
valid_to: Date.new(9999, 1, 1), ttl: 43200,
period: 1, refresh: 3600,
period_unit: 'y', retry: 900,
registrant: c, expire: 1209600,
nameservers: ns_list, minimum_ttl: 3600,
admin_contacts: [c], email: 'hostmaster.eestiinternet.ee',
tech_contacts: [c], master_nameserver: 'ns.tld.ee',
registrar: eis ns_records: ns_records,
) a_records: a_records,
a4_records: a4_records
})
# com.ee # com.ee
ns_list = [] ns_records, a_records, a4_records = parse_zone_ns_data('com.ee', 5)
Legacy::ZoneNs.where(zone: 5).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!( ZonefileSetting.create!({
name: 'com.ee', origin: 'com.ee',
valid_to: Date.new(9999, 1, 1), ttl: 43200,
period: 1, refresh: 3600,
period_unit: 'y', retry: 900,
registrant: c, expire: 1209600,
nameservers: ns_list, minimum_ttl: 3600,
admin_contacts: [c], email: 'hostmaster.eestiinternet.ee',
tech_contacts: [c], master_nameserver: 'ns.tld.ee',
registrar: eis ns_records: ns_records,
) a_records: a_records,
a4_records: a4_records
})
# gov.ee # gov.ee
ns_list = [] ns_records, a_records, a4_records = parse_zone_ns_data('gov.ee', 7)
Legacy::ZoneNs.where(zone: 7).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!( ZonefileSetting.create!({
name: 'gov.ee', origin: 'gov.ee',
valid_to: Date.new(9999, 1, 1), ttl: 43200,
period: 1, refresh: 3600,
period_unit: 'y', retry: 900,
registrant: c, expire: 1209600,
nameservers: ns_list, minimum_ttl: 3600,
admin_contacts: [c], email: 'hostmaster.eestiinternet.ee',
tech_contacts: [c], master_nameserver: 'ns.tld.ee',
registrar: eis ns_records: ns_records,
) a_records: a_records,
a4_records: a4_records
})
# riik.ee # riik.ee
ns_list = [] ns_records, a_records, a4_records = parse_zone_ns_data('riik.ee', 8)
Legacy::ZoneNs.where(zone: 8).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
end
Domain.create!( ZonefileSetting.create!({
name: 'riik.ee', origin: 'riik.ee',
valid_to: Date.new(9999, 1, 1), ttl: 43200,
period: 1, refresh: 3600,
period_unit: 'y', retry: 900,
registrant: c, expire: 1209600,
nameservers: ns_list, minimum_ttl: 3600,
admin_contacts: [c], email: 'hostmaster.eestiinternet.ee',
tech_contacts: [c], master_nameserver: 'ns.tld.ee',
registrar: eis ns_records: ns_records,
) a_records: a_records,
a4_records: a4_records
})
puts "-----> Imported EIS domains in #{(Time.zone.now.to_f - start).round(2)} seconds" puts "-----> Imported zones in #{(Time.zone.now.to_f - start).round(2)} seconds"
end end
end end
def parse_zone_ns_data(domain, zone)
ns_records = ''
a_records = ''
a4_records = ''
Legacy::ZoneNs.where(zone: zone).each do |x|
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
ns_records += "#{domain}. IN NS #{x.fqdn}.\n"
a_records += "#{x.fqdn}. IN A #{ipv4}\n" if ipv4.present?
a4_records += "#{x.fqdn}. IN AAAA #{ipv6}\n" if ipv6.present?
end
[ns_records.strip, a_records.strip, a4_records.strip]
end
# rubocop: enable Performance/Detect # rubocop: enable Performance/Detect
# rubocop: enable Style/SymbolProc # rubocop: enable Style/SymbolProc

View file

@ -40,33 +40,28 @@ namespace :zonefile do
ret = concat(tmp_var, chr(10), chr(10)); ret = concat(tmp_var, chr(10), chr(10));
-- origin ns records
SELECT ns_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10));
-- ns records -- ns records
SELECT array_to_string( SELECT array_to_string(
array( array(
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.') SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
FROM domains d FROM domains d
JOIN nameservers ns ON ns.domain_id = d.id JOIN nameservers ns ON ns.domain_id = d.id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter OR d.name = i_origin WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
AND NOT ('{serverHold,clientHold}' && d.statuses)
ORDER BY d.name ORDER BY d.name
), ),
chr(10) chr(10)
) INTO tmp_var; ) INTO tmp_var;
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10), chr(10)); ret := concat(ret, tmp_var, chr(10), chr(10));
-- a glue records for origin nameservers -- origin a glue records
SELECT array_to_string( SELECT a_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
array( ret := concat(ret, '; Zone A Records', chr(10), tmp_var, chr(10));
SELECT concat(ns.hostname, '. IN A ', ns.ipv4)
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name = i_origin
AND ns.hostname LIKE '%.' || d.name
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
), chr(10)
) INTO tmp_var;
ret := concat(ret, '; Zone A Records', chr(10), tmp_var);
-- a glue records for other nameservers -- a glue records for other nameservers
SELECT array_to_string( SELECT array_to_string(
@ -78,43 +73,15 @@ namespace :zonefile do
AND ns.hostname LIKE '%.' || d.name AND ns.hostname LIKE '%.' || d.name
AND d.name <> i_origin AND d.name <> i_origin
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> '' AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods AND NOT ('{serverHold,clientHold}' && d.statuses)
SELECT 1 FROM nameservers nsi
JOIN domains di ON nsi.domain_id = di.id
WHERE di.name = i_origin
AND nsi.hostname = ns.hostname
)
), chr(10) ), chr(10)
) INTO tmp_var; ) INTO tmp_var;
-- TODO This is a possible subtitition to the previous query, stress testing is needed to see which is faster ret := concat(ret, tmp_var, chr(10), chr(10));
-- SELECT ns.* -- origin aaaa glue records
-- FROM nameservers ns SELECT a4_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
-- JOIN domains d ON d.id = ns.domain_id ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var, chr(10));
-- WHERE d.name LIKE '%ee' AND d.name NOT LIKE '%pri.ee'
-- AND ns.hostname LIKE '%.' || d.name
-- AND d.name <> 'ee'
-- AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
-- AND ns.hostname NOT IN (
-- SELECT ns.hostname FROM domains d JOIN nameservers ns ON d.id = ns.domain_id WHERE d.name = 'ee'
-- )
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10));
-- aaaa glue records for origin nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN AAAA ', ns.ipv6)
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name = i_origin
AND ns.hostname LIKE '%.' || d.name
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
), chr(10)
) INTO tmp_var;
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var);
-- aaaa glue records for other nameservers -- aaaa glue records for other nameservers
SELECT array_to_string( SELECT array_to_string(
@ -126,16 +93,11 @@ namespace :zonefile do
AND ns.hostname LIKE '%.' || d.name AND ns.hostname LIKE '%.' || d.name
AND d.name <> i_origin AND d.name <> i_origin
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> '' AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods AND NOT ('{serverHold,clientHold}' && d.statuses)
SELECT 1 FROM nameservers nsi
JOIN domains di ON nsi.domain_id = di.id
WHERE di.name = i_origin
AND nsi.hostname = ns.hostname
)
), chr(10) ), chr(10)
) INTO tmp_var; ) INTO tmp_var;
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10)); ret := concat(ret, tmp_var, chr(10), chr(10));
-- ds records -- ds records
SELECT array_to_string( SELECT array_to_string(
@ -147,6 +109,7 @@ namespace :zonefile do
FROM domains d FROM domains d
JOIN dnskeys dk ON dk.domain_id = d.id JOIN dnskeys dk ON dk.domain_id = d.id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter AND dk.flags = 257 WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter AND dk.flags = 257
AND NOT ('{serverHold,clientHold}' && d.statuses)
), ),
chr(10) chr(10)
) INTO tmp_var; ) INTO tmp_var;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
(function(){$(document).on("page:change",function(){return $(".selectize").selectize({allowEmptyOption:!0}),$("form").each(function(){return $(this).validate()}),$(".js-contact-form").on("restoreDefault",function(t){var e;switch(e=$(t.target),e.find(".js-ident-tip").hide(),$(".js-ident-country-code option:selected").val()){case"EE":return $(".js-ident-type").find("option[value=birthday]").prop("disabled",!0);default:return $(".js-ident-type").find("option[value=birthday]").prop("disabled",!1)}}),$(".js-ident-country-code").change(function(){var t;return t=$(".js-contact-form"),t.trigger("restoreDefault")}),$(".js-ident-type").change(function(t){var e;switch(e=$(".js-contact-form"),e.trigger("restoreDefault"),t.target.value){case"birthday":return e.find(".js-ident-tip").show()}}),$(".js-contact-form").trigger("restoreDefault")})}).call(this);

View file

@ -133,6 +133,13 @@ describe 'EPP Contact', epp: true do
cr_date.text.in_time_zone.utc.should be_within(5).of(Time.zone.now) cr_date.text.in_time_zone.utc.should be_within(5).of(Time.zone.now)
end end
it 'should return email issue' do
response = create_request(email: { value: 'not@valid' })
response[:msg].should == 'Email is invalid [email]'
response[:result_code].should == '2005'
end
it 'should add registrar prefix for code when missing' do it 'should add registrar prefix for code when missing' do
response = create_request({ id: { value: 'abc12345' } }) response = create_request({ id: { value: 'abc12345' } })
response[:msg].should == 'Command completed successfully' response[:msg].should == 'Command completed successfully'
@ -397,6 +404,18 @@ describe 'EPP Contact', epp: true do
response[:results][1][:result_code].should == '2005' response[:results][1][:result_code].should == '2005'
end end
it 'should return email issue' do
response = update_request({
id: { value: 'FIRST0:SH8013' },
chg: {
email: { value: 'legacy@wrong' }
}
})
response[:msg].should == 'Email is invalid [email]'
response[:result_code].should == '2005'
end
it 'should not update code with custom string' do it 'should not update code with custom string' do
response = update_request( response = update_request(
{ {

View file

@ -907,7 +907,6 @@ describe 'EPP Domain', epp: true do
context 'with valid domain' do context 'with valid domain' do
let(:domain) { Fabricate(:domain, registrar: @registrar1, dnskeys: []) } let(:domain) { Fabricate(:domain, registrar: @registrar1, dnskeys: []) }
### TRANSFER ###
it 'transfers a domain' do it 'transfers a domain' do
domain.registrar = @registrar1 domain.registrar = @registrar1
domain.save domain.save
@ -928,6 +927,67 @@ describe 'EPP Domain', epp: true do
old_contact_codes = domain.contacts.pluck(:code).sort.uniq old_contact_codes = domain.contacts.pluck(:code).sort.uniq
old_registrant_code = domain.registrant.code old_registrant_code = domain.registrant.code
login_as :registrar2 do
response = epp_plain_request(xml)
domain.reload
dtl = domain.domain_transfers.last
trn_data = response[:parsed].css('trnData')
trn_data.css('name').text.should == domain.name
trn_data.css('trStatus').text.should == 'serverApproved'
trn_data.css('reID').text.should == 'REGDOMAIN2'
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
trn_data.css('acID').text.should == 'REGDOMAIN1'
trn_data.css('acDate').text.should == dtl.transferred_at.in_time_zone.utc.utc.iso8601
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
domain.registrar.should == @registrar2
end
response = epp_plain_request(@epp_xml.session.poll)
response[:msg].should == 'Command completed successfully; ack to dequeue'
msg_q = response[:parsed].css('msgQ')
msg_q.css('qDate').text.should_not be_blank
msg_q.css('msg').text.should == "Domain transfer was approved, associated contacts were: " \
"#{old_contact_codes} and registrant was #{old_registrant_code}"
msg_q.first['id'].should_not be_blank
msg_q.first['count'].should == '1'
xml = @epp_xml.session.poll(poll: {
value: '', attrs: { op: 'ack', msgID: msg_q.first['id'] }
})
response = epp_plain_request(xml)
response[:msg].should == 'Command completed successfully'
msg_q = response[:parsed].css('msgQ')
msg_q.first['id'].should_not be_blank
msg_q.first['count'].should == '0'
end
### TRANSFER ###
# Do not place this test to epp-examples (epp: false)
it 'transfers a domain with wait time > 0', epp: false do
domain.registrar = @registrar1
domain.save
pw = domain.auth_info
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'request', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
attrs: { type: 'pdf' }
}
]
})
old_contact_codes = domain.contacts.pluck(:code).sort.uniq
old_registrant_code = domain.registrant.code
response = login_as :registrar2 do response = login_as :registrar2 do
epp_plain_request(xml) epp_plain_request(xml)
end end
@ -1008,35 +1068,30 @@ describe 'EPP Domain', epp: true do
# should show up in other registrar's poll # should show up in other registrar's poll
response = login_as :registrar2 do login_as :registrar2 do
epp_plain_request(@epp_xml.session.poll) response = epp_plain_request(@epp_xml.session.poll)
response[:msg].should == 'Command completed successfully; ack to dequeue'
msg_q = response[:parsed].css('msgQ')
msg_q.css('qDate').text.should_not be_blank
msg_q.css('msg').text.should == 'Transfer requested.'
msg_q.first['id'].should_not be_blank
msg_q.first['count'].should == '1'
xml = @epp_xml.session.poll(poll: {
value: '', attrs: { op: 'ack', msgID: msg_q.first['id'] }
})
response = epp_plain_request(xml)
response[:msg].should == 'Command completed successfully'
msg_q = response[:parsed].css('msgQ')
msg_q.first['id'].should_not be_blank
msg_q.first['count'].should == '0'
end end
response[:msg].should == 'Command completed successfully; ack to dequeue'
msg_q = response[:parsed].css('msgQ')
msg_q.css('qDate').text.should_not be_blank
msg_q.css('msg').text.should == 'Transfer requested.'
msg_q.first['id'].should_not be_blank
msg_q.first['count'].should == '1'
xml = @epp_xml.session.poll(poll: {
value: '', attrs: { op: 'ack', msgID: msg_q.first['id'] }
})
response = login_as :registrar2 do
epp_plain_request(xml)
end
response[:msg].should == 'Command completed successfully'
msg_q = response[:parsed].css('msgQ')
msg_q.first['id'].should_not be_blank
msg_q.first['count'].should == '0'
create_settings create_settings
end end
it 'creates a domain transfer with legal document' do it 'creates a domain transfer with legal document' do
Setting.transfer_wait_time = 1
domain.legal_documents.count.should == 0 domain.legal_documents.count.should == 0
pw = domain.auth_info pw = domain.auth_info
xml = domain_transfer_xml({ xml = domain_transfer_xml({
@ -1067,14 +1122,9 @@ describe 'EPP Domain', epp: true do
log.response.should_not be_blank log.response.should_not be_blank
end end
response = login_as :registrar2 do login_as :registrar2 do
epp_plain_request(xml) epp_plain_request(xml)
end end
response[:result_code].should == '1000'
domain.legal_documents.count.should == 1 # does not add another legal documen
create_settings
end end
it 'creates transfer successfully without legal document' do it 'creates transfer successfully without legal document' do
@ -1572,7 +1622,18 @@ describe 'EPP Domain', epp: true do
response[:results][0][:result_code].should == '2303' response[:results][0][:result_code].should == '2303'
end end
it 'should allow querying domain transfer' do it 'should not cancel transfer when there are none' do
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: domain.auth_info } }
}, 'cancel')
response = epp_plain_request(xml)
response[:results][0][:msg].should == 'No transfers found'
response[:results][0][:result_code].should == '2303'
end
it 'should allow querying domain transfer', epp: false do
Setting.transfer_wait_time = 1 Setting.transfer_wait_time = 1
pw = domain.auth_info pw = domain.auth_info
xml = domain_transfer_xml({ xml = domain_transfer_xml({
@ -1855,6 +1916,29 @@ describe 'EPP Domain', epp: true do
d.pending_update?.should == true d.pending_update?.should == true
end end
it 'should not allow any update when status force delete' do
domain.set_force_delete
xml_params = {
name: { value: domain.name },
chg: [
registrant: { value: 'FIXED:CITIZEN_1234' }
]
}
response = epp_plain_request(domain_update_xml(xml_params, {}, {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
attrs: { type: 'pdf' }
}
]
}))
response[:results][0][:msg].should == 'Object status prohibits operation'
response[:results][0][:result_code].should == '2304'
end
it 'updates domain and adds objects' do it 'updates domain and adds objects' do
xml = domain_update_xml({ xml = domain_update_xml({
name: { value: domain.name }, name: { value: domain.name },

View file

@ -0,0 +1,16 @@
Fabricator(:zonefile_setting) do
origin 'ee'
ttl 43200
refresh 3600
expire 1209600
minimum_ttl 3600
email 'hostmaster.eestiinternet.ee'
master_nameserver 'ns.tld.ee'
ns_records "ee. IN NS ns.ut.ee.\nee. IN NS ns.tld.ee.\nee. IN NS sunic.sunet.se.\n" \
"ee. IN NS ee.aso.ee.\nee. IN NS b.tld.ee.\nee. IN NS ns.eenet.ee.\nee. IN NS e.tld.ee."
a_records "ns.ut.ee. IN A 193.40.5.99\nns.tld.ee. IN A 195.43.87.10\nee.aso.ee. IN A 213.184.51.122\n" \
"b.tld.ee. IN A 194.146.106.110\nns.eenet.ee. IN A 193.40.56.245\ne.tld.ee. IN A 204.61.216.36"
a4_records "ee.aso.ee. IN AAAA 2a02:88:0:21::2\nb.tld.ee. IN AAAA 2001:67c:1010:28::53\n" \
"ns.eenet.ee. IN AAAA 2001:bb8::1\ne.tld.ee. IN AAAA 2001:678:94:53::53"
after_build { |x| x.retry = 900 }
end

View file

@ -46,7 +46,7 @@ feature 'BankStatement', type: :feature do
click_link 'Back to bank statement' click_link 'Back to bank statement'
page.should have_content('120.0') page.should have_content('120,00')
page.should have_content('Test buyer') page.should have_content('Test buyer')
end end
end end

View file

@ -48,4 +48,40 @@ feature 'Domain', type: :feature do
find('.btn.btn-primary').click find('.btn.btn-primary').click
current_path.should == "/admin/domains/#{d1.id}" current_path.should == "/admin/domains/#{d1.id}"
end end
it 'should set domain to force delete' do
d = Fabricate(:domain)
sign_in @user
visit admin_domains_url
click_link d.name
click_link 'Edit statuses'
page.should have_content('ok')
click_link 'Set force delete'
page.should have_content('forceDelete')
page.should have_content('serverRenewProhibited')
page.should have_content('serverTransferProhibited')
page.should have_content('serverUpdateProhibited')
page.should have_content('serverManualInzone')
page.should have_content('pendingDelete')
click_link 'Edit statuses'
click_button 'Save'
page.should have_content('Failed to update domain')
page.should have_content('Object status prohibits operation')
click_link 'Back to domain'
click_link 'Edit statuses'
click_link 'Unset force delete'
page.should_not have_content('forceDelete')
page.should_not have_content('serverRenewProhibited')
page.should_not have_content('serverTransferProhibited')
page.should_not have_content('serverUpdateProhibited')
page.should_not have_content('serverManualInzone')
page.should_not have_content('pendingDelete')
page.should have_content('ok')
click_link 'Edit statuses'
click_button 'Save'
page.should have_content('Domain updated!')
end
end end

View file

@ -37,10 +37,31 @@ feature 'Invoice', type: :feature do
page.should have_content('Record created') page.should have_content('Record created')
page.should have_content('Invoice no.') page.should have_content('Invoice no.')
page.should have_content('Prepayment') page.should have_content('Prepayment')
page.should have_content('120.0') page.should have_content('120,00')
page.should have_content(r.name) page.should have_content(r.name)
end end
it 'should not issue and invoice with deposit amount too small' do
Setting.minimum_deposit = 0.0
r = Fabricate(:registrar)
visit admin_invoices_url
click_link('Add')
select r.name, from: 'Registrar'
fill_in 'Amount', with: '-2.11'
fill_in 'Description', with: 'test issue'
click_button 'Save'
page.should have_content('Amount is too small. Minimum deposit is 0.0 EUR')
Setting.minimum_deposit = 12.43
fill_in 'Amount', with: '12.42'
click_button 'Save'
page.should have_content('Amount is too small. Minimum deposit is 12.43 EUR')
fill_in 'Amount', with: '12.44'
click_button 'Save'
page.should have_content('Record created')
Setting.minimum_deposit = 0.0
end
it 'should forward invoice' do it 'should forward invoice' do
visit '/admin/invoices' visit '/admin/invoices'
click_link @invoice.to_s click_link @invoice.to_s
@ -86,7 +107,7 @@ feature 'Invoice', type: :feature do
page.should have_content('689') page.should have_content('689')
page.should have_content('EE557700771000598731') page.should have_content('EE557700771000598731')
page.should have_content('Not binded', count: 2) page.should have_content('Not binded', count: 2)
page.should have_content(invoice.sum.to_s) page.should have_content('240,00')
page.should have_content('EUR') page.should have_content('EUR')
click_link 'Bind invoices' click_link 'Bind invoices'
@ -99,7 +120,7 @@ feature 'Invoice', type: :feature do
page.should have_content('Binded') page.should have_content('Binded')
page.should have_content(invoice.to_s) page.should have_content(invoice.to_s)
page.should have_content(invoice.sum.to_s) page.should have_content('240,00')
page.should have_content(invoice.reference_no) page.should have_content(invoice.reference_no)
page.should have_content(I18n.l(paid_at, format: :date_long)) page.should have_content(I18n.l(paid_at, format: :date_long))

View file

@ -20,5 +20,80 @@ feature 'Zonefile settings', type: :feature do
page.should have_content('Zonefile settings') page.should have_content('Zonefile settings')
end end
it 'should create zone' do
sign_in @user
visit admin_zonefile_settings_url
page.should_not have_content('Generate zonefile')
click_link 'New'
fill_in 'Origin', with: 'ee'
fill_in 'TTL', with: '43200'
fill_in 'Refresh', with: '3600'
fill_in 'Retry', with: '900'
fill_in 'Expire', with: '1209600'
fill_in 'Minimum TTL', with: '3600'
fill_in 'E-Mail', with: 'hostmaster.eestiinternet.ee'
fill_in 'Master nameserver', with: 'ns.tld.ee'
fill_in('Ns records', with: '
ee. IN NS sunic.sunet.se.
ee. IN NS ns.eenet.ee.
ee. IN NS ns.tld.ee.
ee. IN NS ns.ut.ee.
ee. IN NS e.tld.ee.
ee. IN NS b.tld.ee.
ee. IN NS ee.aso.ee.
')
fill_in('A records', with: '
ns.ut.ee. IN A 193.40.5.99
ns.tld.ee. IN A 195.43.87.10
ee.aso.ee. IN A 213.184.51.122
b.tld.ee. IN A 194.146.106.110
ns.eenet.ee. IN A 193.40.56.245
e.tld.ee. IN A 204.61.216.36
')
fill_in('AAAA records', with: '
ee.aso.ee. IN AAAA 2A02:88:0:21::2
b.tld.ee. IN AAAA 2001:67C:1010:28::53
ns.eenet.ee. IN AAAA 2001:BB8::1
e.tld.ee. IN AAAA 2001:678:94:53::53
')
click_button 'Save'
page.should have_content('Record created')
page.should have_content('ee')
page.should have_content('Generate zonefile')
click_link 'Generate zonefile'
response_headers['Content-Type'].should == 'text/plain'
response_headers['Content-Disposition'].should == "attachment; filename=\"ee.txt\""
end
it 'does not delete zone with existin domains' do
ZonefileSetting.find_by(origin: 'ee') || Fabricate(:zonefile_setting)
Fabricate(:domain)
sign_in @user
visit admin_zonefile_settings_url
click_link 'ee'
click_link 'Delete'
page.should have_content("There are 1 domains in this zone")
page.should have_content('Failed to delete record')
end
it 'deletes a zone' do
ZonefileSetting.find_by(origin: 'ee') || Fabricate(:zonefile_setting)
Domain.destroy_all
sign_in @user
visit admin_zonefile_settings_url
click_link 'ee'
click_link 'Delete'
page.should have_content('Record deleted')
page.should_not have_content("Generate zonefile")
end
end end
end end

View file

@ -54,6 +54,47 @@ feature 'Domains', type: :feature do
page.should_not have_text(d1.name) page.should_not have_text(d1.name)
page.should have_text(d2.name) page.should have_text(d2.name)
end
it 'should search domains' do
# having shared state across tests is really annoying sometimes...
click_link "#{@user} (#{@user.roles.first}) - #{@user.registrar}"
Fabricate(:domain, name: 'abcde.ee', registrar: @user.registrar)
Fabricate(:domain, name: 'abcdee.ee', registrar: @user.registrar)
Fabricate(:domain, name: 'defgh.pri.ee', registrar: @user.registrar)
visit '/registrar/domains'
click_link 'Domains'
page.should have_content('abcde.ee')
page.should have_content('abcdee.ee')
page.should have_content('defgh.pri.ee')
fill_in 'q_name_matches', with: 'abcde.ee'
find('.btn.btn-primary.search').click
current_path.should == "/registrar/domains/info"
visit '/registrar/domains'
fill_in 'q_name_matches', with: '.ee'
find('.btn.btn-primary.search').click
current_path.should == "/registrar/domains"
page.should have_content('abcde.ee')
page.should have_content('abcdee.ee')
page.should have_content('defgh.pri.ee')
fill_in 'q_name_matches', with: 'abcd%.ee'
find('.btn.btn-primary.search').click
page.should have_content('abcde.ee')
page.should have_content('abcdee.ee')
page.should_not have_content('defgh.pri.ee')
fill_in 'q_name_matches', with: 'abcd_.ee'
find('.btn.btn-primary.search').click
current_path.should == "/registrar/domains/info"
end end
end end
end end

View file

@ -39,38 +39,42 @@ describe BankStatement do
end end
it 'should bind transactions with invoices' do it 'should bind transactions with invoices' do
r = Fabricate(:registrar_with_no_account_activities, reference_no: 'RF7086666663') # pending 'Robot fails, probably we need to reset data here or some other issue'
invoice = r.issue_prepayment_invoice(200, 'add some money') # sometimes it works, sometimes not
# r = Fabricate(:registrar_with_no_account_activities, reference_no: 'RF7086666663')
# invoice = r.issue_prepayment_invoice(200, 'add some money')
bs = Fabricate(:bank_statement, bank_transactions: [ # bs = Fabricate(:bank_statement, bank_transactions: [
Fabricate(:bank_transaction, { # Fabricate(:bank_transaction, {
sum: 240.0, # with vat # sum: 240.0, # with vat
reference_no: 'RF7086666663', # reference_no: 'RF7086666663',
description: "Invoice no. #{invoice.number}" # description: "Invoice no. #{invoice.number}"
}), # }),
Fabricate(:bank_transaction, { # Fabricate(:bank_transaction, {
sum: 240.0, # sum: 240.0,
reference_no: 'RF7086666663', # reference_no: 'RF7086666663',
description: "Invoice no. #{invoice.number}" # description: "Invoice no. #{invoice.number}"
}) # })
]) # ])
bs.bank_transactions.count.should == 2 # bs.bank_transactions.count.should == 2
AccountActivity.count.should == 0 # AccountActivity.count.should == 0
bs.bind_invoices # bs.bind_invoices
AccountActivity.count.should == 1 # AccountActivity.count.should == 1
a = AccountActivity.last # a = AccountActivity.last
a.description.should == "Invoice no. #{invoice.number}" # a.description.should == "Invoice no. #{invoice.number}"
a.sum.should == BigDecimal.new('200.0') # a.sum.should == BigDecimal.new('200.0')
a.activity_type = AccountActivity::ADD_CREDIT # a.activity_type = AccountActivity::ADD_CREDIT
r.cash_account.balance.should == 200.0 # r.reload
# r.cash_account.reload
# r.cash_account.balance.should == 200.0
bs.bank_transactions.unbinded.count.should == 1 # bs.bank_transactions.unbinded.count.should == 1
bs.partially_binded?.should == true # bs.partially_binded?.should == true
end end
it 'should not bind transactions with invalid match data' do it 'should not bind transactions with invalid match data' do

View file

@ -109,6 +109,12 @@ describe Contact do
it 'should have no related domain descriptions' do it 'should have no related domain descriptions' do
@contact.related_domain_descriptions.should == {} @contact.related_domain_descriptions.should == {}
end end
it 'should fully validate email syntax for new records' do
@contact.email = 'not@correct'
@contact.valid?
@contact.errors[:email].should == ['Email is invalid']
end
end end
context 'with valid attributes' do context 'with valid attributes' do
@ -247,6 +253,14 @@ describe Contact do
contact = @domain.contacts.first contact = @domain.contacts.first
contact.related_domain_descriptions.should == { "#{@domain.name}" => [:admin] } contact.related_domain_descriptions.should == { "#{@domain.name}" => [:admin] }
end end
it 'should fully validate email syntax for old records' do
old = @contact.email
@contact.email = 'legacy@support-not-correct'
@contact.valid?
@contact.errors[:email].should == ['Email is invalid']
@contact.email = old
end
end end
context 'as birthday' do context 'as birthday' do

View file

@ -0,0 +1,39 @@
require 'rails_helper'
describe Deposit do
context 'with invalid attribute' do
before :all do
@deposit = Deposit.new
end
it 'should not be valid' do
@deposit.valid?
@deposit.errors.full_messages.should match_array([
"Registrar is missing"
])
end
it 'should have 0 amount' do
@deposit.amount.should == 0
end
it 'should not be presisted' do
@deposit.persisted?.should == false
end
it 'should replace comma with point for 0' do
@deposit.amount = '0,0'
@deposit.amount.should == 0.0
end
it 'should replace comma with points' do
@deposit.amount = '10,11'
@deposit.amount.should == 10.11
end
it 'should work with float as well' do
@deposit.amount = 0.123
@deposit.amount.should == 0.123
end
end
end

View file

@ -212,14 +212,67 @@ describe Domain do
@domain.statuses = ['ok'] @domain.statuses = ['ok']
@domain.set_force_delete @domain.set_force_delete
@domain.statuses.count.should == 6 @domain.statuses.should match_array([
"forceDelete",
"pendingDelete",
"serverManualInzone",
"serverRenewProhibited",
"serverTransferProhibited",
"serverUpdateProhibited"
])
fda = Time.zone.now + Setting.redemption_grace_period.days fda = Time.zone.now + Setting.redemption_grace_period.days
@domain.force_delete_at.should be_within(20).of(fda) @domain.force_delete_at.should be_within(20).of(fda)
@domain.unset_force_delete @domain.unset_force_delete
@domain.statuses.count.should == 1 @domain.statuses.should == ['ok']
@domain.force_delete_at.should be_nil @domain.force_delete_at.should be_nil
@domain.statuses = [
DomainStatus::CLIENT_DELETE_PROHIBITED,
DomainStatus::SERVER_DELETE_PROHIBITED,
DomainStatus::PENDING_UPDATE,
DomainStatus::PENDING_TRANSFER,
DomainStatus::PENDING_RENEW,
DomainStatus::PENDING_CREATE,
DomainStatus::CLIENT_HOLD,
DomainStatus::EXPIRED,
DomainStatus::SERVER_HOLD,
DomainStatus::DELETE_CANDIDATE
]
@domain.save
@domain.set_force_delete
@domain.statuses.should match_array([
"clientHold",
"deleteCandidate",
"expired",
"forceDelete",
"pendingDelete",
"serverHold",
"serverManualInzone",
"serverRenewProhibited",
"serverTransferProhibited",
"serverUpdateProhibited"
])
@domain.unset_force_delete
@domain.statuses.should match_array([
"clientDeleteProhibited",
"clientHold",
"deleteCandidate",
"expired",
"pendingCreate",
"pendingRenew",
"pendingTransfer",
"pendingUpdate",
"serverDeleteProhibited",
"serverHold"
])
end end
it 'should set expired status and update outzone_at and delete_at' do it 'should set expired status and update outzone_at and delete_at' do
@ -382,6 +435,12 @@ describe Domain do
@domain.statuses = DomainStatus::OK # restore @domain.statuses = DomainStatus::OK # restore
end end
it 'should add poll message to registrar' do
domain = Fabricate(:domain, name: 'testpollmessage123.ee')
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
domain.registrar.messages.first.body.should == 'Registrant confirmed domain update: testpollmessage123.ee'
end
context 'about registrant update confirm' do context 'about registrant update confirm' do
before :all do before :all do
@domain.registrant_verification_token = 123 @domain.registrant_verification_token = 123
@ -469,35 +528,54 @@ describe Domain do
end end
end end
# it 'validates domain name', skip: true do it 'validates domain name' do
# d = Fabricate(:domain) d = Fabricate(:domain)
# expect(d.name).to_not be_nil expect(d.name).to_not be_nil
# invalid = ['a.ee', "#{'a' * 64}.ee", 'ab.eu', 'test.ab.ee', '-test.ee', '-test-.ee', 'test-.ee', 'te--st.ee', invalid = [
# 'õ.pri.ee', 'test.com', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee', 'Ž .ee', 'test.edu.ee'] 'a.ee', "#{'a' * 64}.ee", 'ab.eu', 'test.ab.ee', '-test.ee', '-test-.ee',
'test-.ee', 'te--st.ee', 'õ.pri.ee', 'test.com', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee',
'Ž .ee', 'test.edu.ee'
]
# invalid.each do |x| invalid.each do |x|
# expect(Fabricate.build(:domain, name: x).valid?).to be false expect(Fabricate.build(:domain, name: x).valid?).to be false
# end end
# valid = ['ab.ee', "#{'a' * 63}.ee", 'te-s-t.ee', 'jäääär.ee', 'päike.pri.ee', valid = [
# 'õigus.com.ee', 'õäöü.fie.ee', 'test.med.ee', 'žä.ee', ' ŽŠ.ee '] 'ab.ee', "#{'a' * 63}.ee", 'te-s-t.ee', 'jäääär.ee', 'päike.pri.ee',
'õigus.com.ee', 'õäöü.fie.ee', 'test.med.ee', 'žä.ee', ' ŽŠ.ee '
]
# valid.each do |x| valid.each do |x|
# expect(Fabricate.build(:domain, name: x).valid?).to be true expect(Fabricate.build(:domain, name: x).valid?).to be true
# end end
# invalid_punycode = ['xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-4we.pri.ee'] invalid_punycode = ['xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-4we.pri.ee']
# invalid_punycode.each do |x| invalid_punycode.each do |x|
# expect(Fabricate.build(:domain, name: x).valid?).to be false expect(Fabricate.build(:domain, name: x).valid?).to be false
# end end
# valid_punycode = ['xn--ge-uia.pri.ee', 'xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-9te.pri.ee'] valid_punycode = ['xn--ge-uia.pri.ee', 'xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-9te.pri.ee']
# valid_punycode.each do |x| valid_punycode.each do |x|
# expect(Fabricate.build(:domain, name: x).valid?).to be true expect(Fabricate.build(:domain, name: x).valid?).to be true
# end end
end
it 'should not create zone origin domain' do
zs = Fabricate(:zonefile_setting)
d = Fabricate.build(:domain, name: 'ee')
d.save.should == false
d.errors.full_messages.should match_array([
"Data management policy violation: Domain name is blocked [name]"
])
zs.destroy
d.save.should == true
end
# d = Domain.new # d = Domain.new
# expect(d.valid?).to be false # expect(d.valid?).to be false

View file

@ -2,27 +2,8 @@ require 'rails_helper'
describe ZonefileSetting do describe ZonefileSetting do
it 'generates the zonefile' do it 'generates the zonefile' do
ZonefileSetting.where({ Fabricate(:zonefile_setting)
origin: 'ee', Fabricate(:zonefile_setting, origin: 'pri.ee')
ttl: 43200,
refresh: 3600,
retry: 900,
expire: 1209600,
minimum_ttl: 3600,
email: 'hostmaster.eestiinternet.ee',
master_nameserver: 'ns.tld.ee'
}).first_or_create!
ZonefileSetting.where({
origin: 'pri.ee',
ttl: 43200,
refresh: 3600,
retry: 900,
expire: 1209600,
minimum_ttl: 3600,
email: 'hostmaster.eestiinternet.ee',
master_nameserver: 'ns.tld.ee'
}).first_or_create!
d = Fabricate(:domain_with_dnskeys, name: 'testpri.ee') d = Fabricate(:domain_with_dnskeys, name: 'testpri.ee')
d.nameservers << Nameserver.new({ d.nameservers << Nameserver.new({
@ -36,6 +17,14 @@ describe ZonefileSetting do
)[0]['generate_zonefile'] )[0]['generate_zonefile']
@zonefile.should_not be_blank @zonefile.should_not be_blank
# origin ns
@zonefile.scan(/ee. IN NS ns.ut.ee.\nee. IN NS ns.tld.ee./).count.should == 1
# origin a
@zonefile.scan(/ns.ut.ee. IN A 193.40.5.99\nns.tld.ee. IN A 195.43.87.10/).count.should == 1
# origin aaaa
@zonefile.scan(/ee.aso.ee. IN AAAA 2a02:88:0:21::2\nb.tld.ee. IN AAAA 2001:67c:1010:28::53/).count.should == 1
@zonefile.scan(/^#{d.name}/).count.should == 5 @zonefile.scan(/^#{d.name}/).count.should == 5
@zonefile.scan(/ns.#{d.name}/).count.should == 3 @zonefile.scan(/ns.#{d.name}/).count.should == 3
@zonefile.scan('123.123.123.123').count.should == 1 @zonefile.scan('123.123.123.123').count.should == 1
@ -49,4 +38,75 @@ describe ZonefileSetting do
@zonefile.scan(/^#{d.name}/).count.should == 0 @zonefile.scan(/^#{d.name}/).count.should == 0
end end
it 'should not place serverHold nor clientHold domains into zonefile' do
Fabricate(:zonefile_setting)
d = Fabricate(:domain_with_dnskeys,
name: 'testzone.ee',
statuses: ['serverHold', 'serverDeleteProhibited', 'clientHold'])
d.nameservers << Nameserver.new({
hostname: "ns.#{d.name}",
ipv4: '123.123.123.123',
ipv6: 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329'
})
@zonefile = ActiveRecord::Base.connection.execute(
"select generate_zonefile('ee')"
)[0]['generate_zonefile']
@zonefile.should_not be_blank
@zonefile.scan(/^#{d.name}/).count.should == 0
@zonefile.scan(/ns.#{d.name}/).count.should == 0
@zonefile.scan('123.123.123.123').count.should == 0
@zonefile.scan('FE80:0000:0000:0000:0202:B3FF:FE1E:8329').count.should == 0
d.statuses = ['clientHold', 'serverDeleteProhibited']
d.save
@zonefile = ActiveRecord::Base.connection.execute(
"select generate_zonefile('ee')"
)[0]['generate_zonefile']
@zonefile.should_not be_blank
@zonefile.scan(/^#{d.name}/).count.should == 0
@zonefile.scan(/ns.#{d.name}/).count.should == 0
@zonefile.scan('123.123.123.123').count.should == 0
@zonefile.scan('FE80:0000:0000:0000:0202:B3FF:FE1E:8329').count.should == 0
d.statuses = ['serverDeleteProhibited']
d.save
@zonefile = ActiveRecord::Base.connection.execute(
"select generate_zonefile('ee')"
)[0]['generate_zonefile']
@zonefile.should_not be_blank
@zonefile.scan(/^#{d.name}/).count.should == 5
@zonefile.scan(/ns.#{d.name}/).count.should == 3
@zonefile.scan('123.123.123.123').count.should == 1
@zonefile.scan('FE80:0000:0000:0000:0202:B3FF:FE1E:8329').count.should == 1
end
it 'does not create duplicate zones' do
Fabricate(:zonefile_setting)
zs = Fabricate.build(:zonefile_setting)
zs.save.should == false
zs.errors.full_messages.should match_array(["Origin has already been taken"])
end
it 'does not allow deleting zone when it has existing domains' do
zs = Fabricate(:zonefile_setting)
d = Fabricate(:domain)
zs.destroy.should == false
zs.errors.full_messages.should match_array(["There are 1 domains in this zone"])
ZonefileSetting.count.should == 1
d.destroy
zs.destroy
ZonefileSetting.count.should == 0
end
end end