mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Merge branch 'master' into alpha
This commit is contained in:
commit
18f80130cf
90 changed files with 2996 additions and 2090 deletions
6
Gemfile
6
Gemfile
|
@ -9,7 +9,7 @@ source 'https://rubygems.org'
|
|||
|
||||
# core
|
||||
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'
|
||||
|
||||
# load env
|
||||
|
@ -18,6 +18,8 @@ gem 'figaro', '~> 1.1.1'
|
|||
# model related
|
||||
gem 'pg', '~> 0.18.0'
|
||||
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
|
||||
gem 'paper_trail',
|
||||
github: 'airblade/paper_trail',
|
||||
|
@ -65,7 +67,7 @@ gem 'money-rails', '~> 1.4.1'
|
|||
# deploy
|
||||
gem 'whenever', '~> 0.9.4', require: false
|
||||
gem 'data_migrate',
|
||||
github: 'gitlabeu/data_migrate',
|
||||
github: 'internetee/data-migrate',
|
||||
ref: '35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81'
|
||||
|
||||
# monitors
|
||||
|
|
69
Gemfile.lock
69
Gemfile.lock
|
@ -9,7 +9,7 @@ GIT
|
|||
request_store (~> 1.1.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/gitlabeu/data_migrate.git
|
||||
remote: https://github.com/internetee/data-migrate.git
|
||||
revision: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
|
||||
ref: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
|
||||
specs:
|
||||
|
@ -81,15 +81,15 @@ GEM
|
|||
akami (1.3.1)
|
||||
gyoku (>= 0.4.0)
|
||||
nokogiri
|
||||
arel (6.0.0)
|
||||
ast (2.0.0)
|
||||
astrolabe (1.3.0)
|
||||
parser (>= 2.2.0.pre.3, < 3.0)
|
||||
autodoc (0.5.0)
|
||||
arel (6.0.3)
|
||||
ast (2.1.0)
|
||||
astrolabe (1.3.1)
|
||||
parser (~> 2.2)
|
||||
autodoc (0.5.1)
|
||||
actionpack
|
||||
activesupport (>= 3.0.0)
|
||||
rspec
|
||||
autoprefixer-rails (5.2.1)
|
||||
autoprefixer-rails (5.2.1.1)
|
||||
execjs
|
||||
json
|
||||
axiom-types (0.1.1)
|
||||
|
@ -129,8 +129,6 @@ GEM
|
|||
rack (>= 1.0.0)
|
||||
rack-test (>= 0.5.4)
|
||||
xpath (~> 2.0)
|
||||
celluloid (0.16.0)
|
||||
timers (~> 4.0.0)
|
||||
chronic (0.10.2)
|
||||
cliver (0.3.2)
|
||||
coderay (1.1.0)
|
||||
|
@ -146,7 +144,7 @@ GEM
|
|||
concord (0.1.5)
|
||||
adamantium (~> 0.2.0)
|
||||
equalizer (~> 0.0.9)
|
||||
countries (0.11.4)
|
||||
countries (0.11.5)
|
||||
currencies (~> 0.4.2)
|
||||
i18n_data (~> 0.7.0)
|
||||
crack (0.4.2)
|
||||
|
@ -187,7 +185,7 @@ GEM
|
|||
faker (1.4.3)
|
||||
i18n (~> 0.5)
|
||||
fastercsv (1.5.5)
|
||||
ffi (1.9.9)
|
||||
ffi (1.9.10)
|
||||
figaro (1.1.1)
|
||||
thor (~> 0.14)
|
||||
flay (2.4.0)
|
||||
|
@ -197,7 +195,7 @@ GEM
|
|||
ruby_parser (~> 3.1, > 3.1.0)
|
||||
sexp_processor (~> 4.4)
|
||||
formatador (0.2.5)
|
||||
globalid (0.3.5)
|
||||
globalid (0.3.6)
|
||||
activesupport (>= 4.1.0)
|
||||
grape (0.12.0)
|
||||
activesupport
|
||||
|
@ -209,7 +207,7 @@ GEM
|
|||
rack-accept
|
||||
rack-mount
|
||||
virtus (>= 1.0.0)
|
||||
guard (2.12.7)
|
||||
guard (2.12.9)
|
||||
formatador (>= 0.2.4)
|
||||
listen (>= 2.7, <= 4.0)
|
||||
lumberjack (~> 1.0)
|
||||
|
@ -243,14 +241,13 @@ GEM
|
|||
hashie-forbidden_attributes (0.1.1)
|
||||
hashie (>= 3.0)
|
||||
highline (1.6.21)
|
||||
hitimes (1.2.2)
|
||||
hpricot (0.8.6)
|
||||
html2haml (2.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
haml (~> 4.0.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
ruby_parser (~> 3.5)
|
||||
html5_validators (1.2.1)
|
||||
html5_validators (1.2.2)
|
||||
httpclient (2.6.0.1)
|
||||
httpi (2.4.1)
|
||||
rack
|
||||
|
@ -278,10 +275,9 @@ GEM
|
|||
kgio (2.9.3)
|
||||
launchy (2.4.3)
|
||||
addressable (~> 2.3)
|
||||
libv8 (3.16.14.8)
|
||||
libv8 (3.16.14.11)
|
||||
libxml-ruby (2.8.0)
|
||||
listen (2.10.1)
|
||||
celluloid (~> 0.16.0)
|
||||
listen (3.0.3)
|
||||
rb-fsevent (>= 0.9.3)
|
||||
rb-inotify (>= 0.9)
|
||||
loofah (2.0.2)
|
||||
|
@ -293,11 +289,11 @@ GEM
|
|||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
method_source (0.8.2)
|
||||
mime-types (2.6.1)
|
||||
mina (0.3.4)
|
||||
mina (0.3.7)
|
||||
open4 (~> 1.3.4)
|
||||
rake
|
||||
mini_portile (0.6.2)
|
||||
minitest (5.7.0)
|
||||
minitest (5.8.0)
|
||||
monetize (1.1.0)
|
||||
money (~> 6.5.0)
|
||||
money (6.5.1)
|
||||
|
@ -307,20 +303,20 @@ GEM
|
|||
monetize (~> 1.1.0)
|
||||
money (~> 6.5.0)
|
||||
railties (>= 3.0)
|
||||
multi_json (1.11.1)
|
||||
multi_json (1.11.2)
|
||||
multi_xml (0.5.5)
|
||||
nenv (0.2.0)
|
||||
newrelic_rpm (3.12.0.288)
|
||||
nokogiri (1.6.6.2)
|
||||
mini_portile (~> 0.6.0)
|
||||
nori (2.6.0)
|
||||
notiffany (0.0.6)
|
||||
notiffany (0.0.7)
|
||||
nenv (~> 0.1)
|
||||
shellany (~> 0.0)
|
||||
nprogress-rails (0.1.6.7)
|
||||
open4 (1.3.4)
|
||||
orm_adapter (0.5.0)
|
||||
parser (2.2.2.5)
|
||||
parser (2.2.2.6)
|
||||
ast (>= 1.1, < 3.0)
|
||||
pdfkit (0.6.2)
|
||||
pg (0.18.2)
|
||||
|
@ -354,7 +350,7 @@ GEM
|
|||
rack
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
railroady (1.3.0)
|
||||
railroady (1.3.1)
|
||||
rails (4.2.3)
|
||||
actionmailer (= 4.2.3)
|
||||
actionpack (= 4.2.3)
|
||||
|
@ -382,7 +378,7 @@ GEM
|
|||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (2.0.0)
|
||||
raindrops (0.14.0)
|
||||
raindrops (0.15.0)
|
||||
rake (10.4.2)
|
||||
ransack (1.5.1)
|
||||
actionpack (>= 3.0)
|
||||
|
@ -398,7 +394,7 @@ GEM
|
|||
parser (~> 2.2.0.pre.7)
|
||||
rainbow (>= 1.99, < 3.0)
|
||||
unparser (~> 0.2.2)
|
||||
ref (1.0.5)
|
||||
ref (2.0.0)
|
||||
request_store (1.1.0)
|
||||
responders (2.1.0)
|
||||
railties (>= 4.2.0, < 5)
|
||||
|
@ -406,15 +402,15 @@ GEM
|
|||
rspec-core (~> 3.3.0)
|
||||
rspec-expectations (~> 3.3.0)
|
||||
rspec-mocks (~> 3.3.0)
|
||||
rspec-core (3.3.1)
|
||||
rspec-core (3.3.2)
|
||||
rspec-support (~> 3.3.0)
|
||||
rspec-expectations (3.3.0)
|
||||
rspec-expectations (3.3.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.3.0)
|
||||
rspec-mocks (3.3.1)
|
||||
rspec-mocks (3.3.2)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.3.0)
|
||||
rspec-rails (3.3.2)
|
||||
rspec-rails (3.3.3)
|
||||
actionpack (>= 3.0, < 4.3)
|
||||
activesupport (>= 3.0, < 4.3)
|
||||
railties (>= 3.0, < 4.3)
|
||||
|
@ -433,7 +429,7 @@ GEM
|
|||
ruby2ruby (2.1.4)
|
||||
ruby_parser (~> 3.1)
|
||||
sexp_processor (~> 4.0)
|
||||
ruby_parser (3.7.0)
|
||||
ruby_parser (3.7.1)
|
||||
sexp_processor (~> 4.1)
|
||||
rubycritic (1.4.0)
|
||||
flay (= 2.4.0)
|
||||
|
@ -442,7 +438,7 @@ GEM
|
|||
reek (= 1.6.5)
|
||||
virtus (~> 1.0)
|
||||
safe_yaml (1.0.4)
|
||||
sass (3.4.15)
|
||||
sass (3.4.16)
|
||||
sass-rails (5.0.3)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass (~> 3.1)
|
||||
|
@ -496,8 +492,6 @@ GEM
|
|||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tilt (1.4.1)
|
||||
timers (4.0.1)
|
||||
hitimes
|
||||
traceroute (0.5.0)
|
||||
rails (>= 3.0.0)
|
||||
turbolinks (2.5.3)
|
||||
|
@ -521,6 +515,8 @@ GEM
|
|||
parser (~> 2.2.2)
|
||||
procto (~> 0.0.2)
|
||||
uuidtools (2.1.5)
|
||||
validates_email_format_of (1.6.3)
|
||||
i18n
|
||||
virtus (1.0.5)
|
||||
axiom-types (~> 0.1)
|
||||
coercible (~> 1.0)
|
||||
|
@ -531,7 +527,7 @@ GEM
|
|||
wasabi (3.5.0)
|
||||
httpi (~> 2.0)
|
||||
nokogiri (>= 1.4.2)
|
||||
websocket-driver (0.5.4)
|
||||
websocket-driver (0.6.2)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.2)
|
||||
whenever (0.9.4)
|
||||
|
@ -578,7 +574,7 @@ DEPENDENCIES
|
|||
html2haml (~> 2.0.0)
|
||||
html5_validators (~> 1.2.0)
|
||||
isikukood
|
||||
iso8601 (~> 0.8.2)
|
||||
iso8601 (~> 0.8.6)
|
||||
jbuilder (~> 2.2.6)
|
||||
jquery-rails (~> 4.0.3)
|
||||
jquery-ui-rails (~> 5.0.3)
|
||||
|
@ -622,4 +618,5 @@ DEPENDENCIES
|
|||
uglifier (~> 2.7.1)
|
||||
unicorn
|
||||
uuidtools (~> 2.1.4)
|
||||
validates_email_format_of (~> 1.6.3)
|
||||
whenever (~> 0.9.4)
|
||||
|
|
|
@ -7,6 +7,7 @@ class Admin::BankTransactionsController < AdminController
|
|||
end
|
||||
|
||||
def create
|
||||
comma_support_for(:bank_transaction, :sum)
|
||||
@bank_transaction = BankTransaction.new(
|
||||
bank_transaction_params.merge(bank_statement_id: params[:bank_statement_id])
|
||||
)
|
||||
|
@ -21,6 +22,7 @@ class Admin::BankTransactionsController < AdminController
|
|||
end
|
||||
|
||||
def update
|
||||
comma_support_for(:bank_transaction, :sum)
|
||||
if @bank_transaction.update(bank_transaction_params)
|
||||
flash[:notice] = I18n.t('record_updated')
|
||||
redirect_to [:admin, @bank_transaction]
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
class Admin::DomainVersionsController < AdminController
|
||||
load_and_authorize_resource
|
||||
|
||||
# rubocop:disable Style/GuardClause
|
||||
def index
|
||||
@domain = Domain.find(params[:domain_id])
|
||||
@domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first
|
||||
@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
|
||||
|
||||
# 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
|
||||
# rubocop:enable Style/GuardClause
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ class Admin::DomainsController < AdminController
|
|||
normalize_search_parameters do
|
||||
@q = domains.search(params[:q])
|
||||
@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
|
||||
elsif @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/
|
||||
# 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
|
||||
if params[:domain]
|
||||
params.require(:domain).permit({ statuses: [] })
|
||||
params.require(:domain).permit({ statuses: [], status_notes_array: [] })
|
||||
else
|
||||
{ statuses: [] }
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ class Admin::InvoicesController < AdminController
|
|||
flash[:notice] = t(:record_created)
|
||||
redirect_to [:admin, @invoice]
|
||||
else
|
||||
flash[:alert] = t(:failed_to_create_record)
|
||||
flash.now[:alert] = t(:failed_to_create_record)
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
|
35
app/controllers/admin/pending_deletes_controller.rb
Normal file
35
app/controllers/admin/pending_deletes_controller.rb
Normal 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
|
35
app/controllers/admin/pending_updates_controller.rb
Normal file
35
app/controllers/admin/pending_updates_controller.rb
Normal 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
|
|
@ -17,6 +17,7 @@ class Admin::PricelistsController < AdminController
|
|||
end
|
||||
|
||||
def create
|
||||
comma_support_for(:pricelist, :price)
|
||||
@pricelist = Pricelist.new(pricelist_params)
|
||||
|
||||
if @pricelist.save
|
||||
|
@ -27,6 +28,7 @@ class Admin::PricelistsController < AdminController
|
|||
end
|
||||
|
||||
def update
|
||||
comma_support_for(:pricelist, :price)
|
||||
if @pricelist.update_attributes(pricelist_params)
|
||||
redirect_to admin_pricelists_url
|
||||
else
|
||||
|
|
|
@ -61,7 +61,7 @@ class Admin::SettingsController < AdminController
|
|||
:expire_pending_confirmation
|
||||
]
|
||||
|
||||
floats = [:registry_vat_prc]
|
||||
floats = [:registry_vat_prc, :minimum_deposit]
|
||||
|
||||
booleans = [
|
||||
:ds_data_allowed,
|
||||
|
|
|
@ -5,6 +5,22 @@ class Admin::ZonefileSettingsController < AdminController
|
|||
@zonefile_settings = ZonefileSetting.all
|
||||
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
|
||||
@zonefile_setting = ZonefileSetting.find(params[:id])
|
||||
end
|
||||
|
@ -19,6 +35,16 @@ class Admin::ZonefileSettingsController < AdminController
|
|||
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
|
||||
|
||||
def set_zonefile_setting
|
||||
|
@ -26,6 +52,9 @@ class Admin::ZonefileSettingsController < AdminController
|
|||
end
|
||||
|
||||
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
|
||||
|
|
|
@ -70,4 +70,10 @@ class ApplicationController < ActionController::Base
|
|||
return 'public' if user.nil?
|
||||
"#{user.id}-#{user.class}: #{user.username}"
|
||||
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
|
||||
|
|
|
@ -13,7 +13,7 @@ class Registrar::DepositsController < RegistrarController
|
|||
flash[:notice] = t(:please_pay_the_following_invoice)
|
||||
redirect_to [:registrar, @invoice]
|
||||
else
|
||||
flash[:alert] = t(:failed_to_create_record)
|
||||
flash.now[:alert] = t(:failed_to_create_record)
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,21 +2,41 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller
|
|||
before_action :init_domain, except: :new
|
||||
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
|
||||
authorize! :view, Depp::Domain
|
||||
limit, offset = pagination_details
|
||||
|
||||
res = depp_current_user.repp_request('domains', { details: true, limit: limit, offset: offset })
|
||||
if res.code == '200'
|
||||
@response = res.parsed_body.with_indifferent_access
|
||||
@contacts = @response ? @response[:contacts] : []
|
||||
|
||||
@paginatable_array = Kaminari.paginate_array(
|
||||
[], total_count: @response[:total_number_of_records]
|
||||
).page(params[:page]).per(limit)
|
||||
params[:q] ||= {}
|
||||
if params[:statuses_contains]
|
||||
domains = current_user.registrar.domains.includes(:registrar, :registrant).where(
|
||||
"statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||
)
|
||||
else
|
||||
domains = current_user.registrar.domains.includes(:registrar, :registrant)
|
||||
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
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
# rubocop: enable Metrics/AbcSize
|
||||
|
||||
def info
|
||||
authorize! :view, Depp::Domain
|
||||
|
@ -123,4 +143,18 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller
|
|||
# @priv_contacts_autocomplete_map ||=
|
||||
# current_user.registrar.priv_contacts.pluck(:name, :code).map { |c| ["#{c.second} #{c.first}", c.second] }
|
||||
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
|
||||
|
|
|
@ -45,4 +45,14 @@ module ApplicationHelper
|
|||
# can be api user or some other user
|
||||
link_to(model.updator, ['admin', model.updator])
|
||||
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
|
||||
|
|
|
@ -5,10 +5,12 @@ class DomainDeleteConfirmJob < Que::Job
|
|||
domain = Epp::Domain.find(domain_id)
|
||||
case action
|
||||
when RegistrantVerification::CONFIRMED
|
||||
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
||||
domain.apply_pending_delete!
|
||||
domain.clean_pendings!
|
||||
when RegistrantVerification::REJECTED
|
||||
DomainMailer.pending_delete_rejected_notification(domain).deliver_now
|
||||
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
||||
domain.clean_pendings!
|
||||
end
|
||||
destroy # it's best to destroy the job in the same transaction
|
||||
|
|
|
@ -5,10 +5,12 @@ class DomainUpdateConfirmJob < Que::Job
|
|||
domain = Epp::Domain.find(domain_id)
|
||||
case action
|
||||
when RegistrantVerification::CONFIRMED
|
||||
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
|
||||
domain.apply_pending_update!
|
||||
domain.clean_pendings!
|
||||
when RegistrantVerification::REJECTED
|
||||
DomainMailer.pending_update_rejected_notification_for_new_registrant(domain).deliver_now
|
||||
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
||||
domain.clean_pendings!
|
||||
end
|
||||
destroy # it's best to destroy the job in the same transaction
|
||||
|
|
|
@ -123,7 +123,8 @@ class Ability
|
|||
can :manage, WhiteIp
|
||||
can :read, ApiLog::EppLog
|
||||
can :read, ApiLog::ReppLog
|
||||
# can :index, :delayed_job
|
||||
can :update, :pending
|
||||
can :destroy, :pending
|
||||
can :create, :zonefile
|
||||
can :access, :settings_menu
|
||||
end
|
||||
|
|
7
app/models/concerns/statuses.rb
Normal file
7
app/models/concerns/statuses.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
module Statuses
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def force_delete?
|
||||
statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
end
|
||||
end
|
|
@ -19,6 +19,7 @@ class Contact < ActiveRecord::Base
|
|||
# Phone nr validation is very minimam in order to support legacy requirements
|
||||
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/
|
||||
validates :email, format: /@/
|
||||
validates :email, email_format: { message: :invalid }, if: proc { |c| c.email_changed? }
|
||||
validates :ident,
|
||||
format: { with: /\d{4}-\d{2}-\d{2}/, message: :invalid_birthday_format },
|
||||
if: proc { |c| c.ident_type == 'birthday' }
|
||||
|
|
|
@ -7,6 +7,11 @@ class Deposit
|
|||
attr_accessor :amount, :description, :registrar, :registrar_id
|
||||
|
||||
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 = {})
|
||||
attributes.each do |name, value|
|
||||
|
@ -18,6 +23,10 @@ class Deposit
|
|||
false
|
||||
end
|
||||
|
||||
def amount
|
||||
BigDecimal.new(@amount.to_s.sub(/,/, '.'))
|
||||
end
|
||||
|
||||
def issue_prepayment_invoice
|
||||
valid? && registrar.issue_prepayment_invoice(amount, description)
|
||||
end
|
||||
|
|
|
@ -71,6 +71,7 @@ module Depp
|
|||
|
||||
private
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def validate_existance_in_server
|
||||
return if errors.any?
|
||||
res = server.open_connection
|
||||
|
@ -92,7 +93,10 @@ module Depp
|
|||
|
||||
rescue OpenSSL::SSL::SSLError => 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)
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# rubocop: disable Metrics/ClassLength
|
||||
class Domain < ActiveRecord::Base
|
||||
include Versions # version/domain_version.rb
|
||||
include Statuses
|
||||
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
|
||||
|
@ -105,6 +106,13 @@ class Domain < ActiveRecord::Base
|
|||
errors.add(:base, :invalid_auth_information_reserved)
|
||||
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: {
|
||||
min: -> { Setting.ns_min_count },
|
||||
max: -> { Setting.ns_max_count }
|
||||
|
@ -341,6 +349,14 @@ class Domain < ActiveRecord::Base
|
|||
true
|
||||
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
|
||||
self.registrant_verification_token = nil
|
||||
self.registrant_verification_asked_at = nil
|
||||
|
@ -351,6 +367,8 @@ class Domain < ActiveRecord::Base
|
|||
self.pending_json = {}
|
||||
statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||
statuses.delete(DomainStatus::PENDING_DELETE)
|
||||
status_notes[DomainStatus::PENDING_UPDATE] = ''
|
||||
status_notes[DomainStatus::PENDING_DELETE] = ''
|
||||
save
|
||||
end
|
||||
|
||||
|
@ -530,21 +548,16 @@ class Domain < ActiveRecord::Base
|
|||
self.delete_at = outzone_at + Setting.redemption_grace_period.days
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def set_force_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.statuses_backup = statuses
|
||||
statuses.delete(DomainStatus::CLIENT_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::SERVER_RENEW_PROHIBITED)
|
||||
statuses.delete(DomainStatus::SERVER_TRANSFER_PROHIBITED)
|
||||
|
@ -552,7 +565,28 @@ class Domain < ActiveRecord::Base
|
|||
statuses.delete(DomainStatus::SERVER_MANUAL_INZONE)
|
||||
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.statuses_backup = []
|
||||
save(validate: false)
|
||||
end
|
||||
|
||||
|
@ -570,13 +604,19 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def pending_update?
|
||||
statuses.include?(DomainStatus::PENDING_UPDATE)
|
||||
statuses.include?(DomainStatus::PENDING_UPDATE) && !statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
end
|
||||
|
||||
# public api
|
||||
def update_prohibited?
|
||||
pending_update_prohibited? && pending_delete_prohibited?
|
||||
end
|
||||
|
||||
# public api
|
||||
def delete_prohibited?
|
||||
statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
end
|
||||
|
||||
# TODO: Review the list and disallow epp calls
|
||||
def pending_update_prohibited?
|
||||
(statuses & [
|
||||
|
@ -599,7 +639,7 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def pending_delete?
|
||||
statuses.include?(DomainStatus::PENDING_DELETE)
|
||||
statuses.include?(DomainStatus::PENDING_DELETE) && !statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
end
|
||||
|
||||
# TODO: Review the list and disallow epp calls
|
||||
|
@ -645,5 +685,13 @@ class Domain < ActiveRecord::Base
|
|||
def update_whois_record
|
||||
whois_record.blank? ? create_whois_record : whois_record.save
|
||||
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
|
||||
# rubocop: enable Metrics/ClassLength
|
||||
|
|
|
@ -120,12 +120,49 @@ class DomainStatus < ActiveRecord::Base
|
|||
end
|
||||
|
||||
class << self
|
||||
def statuses_for_client
|
||||
CLIENT_STATUSES.map { |x| x.sub('client', '') }
|
||||
def admin_statuses
|
||||
[
|
||||
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
|
||||
|
||||
def statuses_for_admin
|
||||
SERVER_STATUSES.map { |x| [x.sub('server', ''), x] }
|
||||
def admin_statuses_map
|
||||
[
|
||||
['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
|
||||
|
|
|
@ -4,7 +4,7 @@ class Epp::Domain < Domain
|
|||
|
||||
before_validation :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))
|
||||
false
|
||||
end
|
||||
|
@ -433,9 +433,10 @@ class Epp::Domain < Domain
|
|||
|
||||
return unless update(frame, user, false)
|
||||
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
|
||||
old_registrant_email.deliver_now
|
||||
true
|
||||
end
|
||||
|
||||
def apply_pending_delete!
|
||||
|
@ -446,6 +447,7 @@ class Epp::Domain < Domain
|
|||
DomainMailer.delete_confirmation(self).deliver_now
|
||||
|
||||
clean_pendings! if epp_destroy(frame, user, false)
|
||||
true
|
||||
end
|
||||
|
||||
def attach_legal_document(legal_document_data)
|
||||
|
@ -579,7 +581,14 @@ class Epp::Domain < Domain
|
|||
# rubocop: disable Metrics/MethodLength
|
||||
# rubocop: disable Metrics/AbcSize
|
||||
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, {
|
||||
code: '2002',
|
||||
msg: I18n.t(:domain_already_belongs_to_the_querying_registrar)
|
||||
|
@ -737,8 +746,15 @@ class Epp::Domain < Domain
|
|||
true
|
||||
end
|
||||
|
||||
def can_be_transferred_to?(new_registrar)
|
||||
new_registrar != registrar
|
||||
def transferrable?
|
||||
(statuses & [
|
||||
DomainStatus::PENDING_CREATE,
|
||||
DomainStatus::PENDING_UPDATE,
|
||||
DomainStatus::PENDING_DELETE,
|
||||
DomainStatus::PENDING_RENEW,
|
||||
DomainStatus::PENDING_TRANSFER,
|
||||
DomainStatus::FORCE_DELETE
|
||||
]).empty?
|
||||
end
|
||||
|
||||
## SHARED
|
||||
|
|
|
@ -12,7 +12,7 @@ class Invoice < ActiveRecord::Base
|
|||
}
|
||||
|
||||
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,
|
||||
:seller_iban, :buyer_name, :invoice_items, :vat_prc, presence: true
|
||||
|
|
|
@ -45,7 +45,9 @@ class Registrar < ActiveRecord::Base
|
|||
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)
|
||||
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
class ZonefileSetting < ActiveRecord::Base
|
||||
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 :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
|
||||
pluck(:origin).each do |origin|
|
||||
|
|
|
@ -33,7 +33,8 @@ class DomainNameValidator < ActiveModel::EachValidator
|
|||
|
||||
def validate_blocked(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
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
%tr
|
||||
%td= link_to(l(x.paid_at, format: :date_long), [:admin, x])
|
||||
%td= x.buyer_name
|
||||
%td= x.sum
|
||||
%td= currency(x.sum)
|
||||
%td= x.currency
|
||||
- c = x.binded? ? 'text-success' : 'text-danger'
|
||||
%td{class: c}= x.binded? ? t(:binded) : t(:not_binded)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
.form-group
|
||||
= f.label :sum, class: 'col-md-4 control-label required'
|
||||
.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
|
||||
= f.label :reference_no, class: 'col-md-4 control-label required'
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
%dd= @bank_transaction.description
|
||||
|
||||
%dt= t(:sum)
|
||||
%dd= @bank_transaction.sum
|
||||
%dd= currency(@bank_transaction.sum)
|
||||
|
||||
%dt= t(:currency)
|
||||
%dd= @bank_transaction.currency
|
||||
|
|
|
@ -5,7 +5,12 @@
|
|||
.col-md-8
|
||||
.tab-content{style:'margin-top: 20px;'}
|
||||
#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
|
||||
.col-md-8.text-right
|
||||
= button_tag(t(:save), class: 'btn btn-primary')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- 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')
|
||||
= render 'shared/title', name: "#{t(:edit)}: #{@contact.name}"
|
||||
|
||||
|
|
|
@ -1,32 +1,65 @@
|
|||
- if version.present? && domain.present?
|
||||
- children = HashWithIndifferentAccess.new(version.children)
|
||||
- nameservers = children[:nameservers] || []
|
||||
- tech_contacts = children[:tech_contacts] || []
|
||||
- admin_contacts = children[:admin_contacts] || []
|
||||
- registrant = children[:registrant] || []
|
||||
- statuses_link ||= false
|
||||
- version ||= false
|
||||
- domain ||= false
|
||||
- pending_user ||= false
|
||||
|
||||
- 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
|
||||
%p.nowrap
|
||||
= l(domain.updated_at, format: :short)
|
||||
= version.event
|
||||
= l(domain.updated_at, format: :shorts)
|
||||
- if statuses_link
|
||||
%br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id])
|
||||
|
||||
%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
|
||||
%p
|
||||
= "#{domain.period}#{domain.period_unit}"
|
||||
= "#{l(domain.valid_from, format: :date)} - #{l(domain.valid_to, format: :date)}"
|
||||
%p
|
||||
= domain.status
|
||||
%br
|
||||
= "#{l(domain.valid_from, format: :date)}"
|
||||
%br
|
||||
= "#{l(domain.valid_to, format: :date)}"
|
||||
|
||||
%td
|
||||
- registrant.each do |oc|
|
||||
- registrant.each do |r|
|
||||
%p
|
||||
= oc[:name]
|
||||
= oc[:phone]
|
||||
= oc[:email]
|
||||
= r[:name]
|
||||
= r[:phone]
|
||||
= r[:email]
|
||||
%p
|
||||
= oc[:code]
|
||||
= r[:code]
|
||||
|
||||
%td
|
||||
- admin_contacts.each do |ac|
|
||||
|
@ -47,8 +80,8 @@
|
|||
= tc[:code]
|
||||
|
||||
%td
|
||||
- nameservers.each do |ns|
|
||||
%p
|
||||
%p
|
||||
- nameservers.each do |ns|
|
||||
= ns[:hostname]
|
||||
%br
|
||||
= ns[:ipv4]
|
||||
|
@ -58,69 +91,13 @@
|
|||
%p
|
||||
= domain.registrar.name
|
||||
|
||||
-# %td
|
||||
-# = version.children.inspect
|
||||
|
||||
-# %td{ class: changes.include?(:domain) ? 'edit-highlight' : 'no-highlight' }
|
||||
-# - if children[:domain]
|
||||
-# %p{:style => "font-size:x-small;"}
|
||||
-# = children[:domain][:period]
|
||||
-# = children[:domain][:period_unit] if children[:domain][:period]
|
||||
-# - if children[:domain][:valid_to] && children[:domain][:valid_from]
|
||||
-# = ","
|
||||
-# = 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
|
||||
- if domain.pending_json.present?
|
||||
%tr.js-pending{ style: 'display: none;' }
|
||||
%td{colspan: 8}
|
||||
= preserve do
|
||||
%pre
|
||||
- formatted_req = Nokogiri::XML(domain.pending_json['frame'])
|
||||
- if formatted_req.errors.none?
|
||||
= formatted_req
|
||||
- else
|
||||
= domain.pending_json['frame']
|
||||
|
|
|
@ -9,20 +9,36 @@
|
|||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-1'}= t(:timestap)
|
||||
%th{class: 'col-xs-2'}= t(:period)
|
||||
%th{class: 'col-xs-2'}= t(:owner)
|
||||
%th{class: 'col-xs-2'}= t(:statuses)
|
||||
%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(:tech)
|
||||
%th{class: 'col-xs-2'}= t(:nameservers)
|
||||
%th{class: 'col-xs-2'}= t(:registrar)
|
||||
|
||||
%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?
|
||||
%tr.small
|
||||
= render 'admin/domain_versions/version',
|
||||
domain: @domain, version: @domain.versions.last
|
||||
|
||||
-# all other older versions
|
||||
- @domain.versions.not_creates.reverse.each do |version|
|
||||
%tr.small
|
||||
= render 'admin/domain_versions/version',
|
||||
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()
|
||||
|
|
|
@ -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
|
|
@ -6,7 +6,12 @@
|
|||
.col-md-8
|
||||
.tab-content{style:'margin-top: 20px;'}
|
||||
#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
|
||||
.col-md-8.text-right
|
||||
= button_tag(t(:save), class: 'btn btn-primary')
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
- 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')
|
||||
|
||||
= render 'shared/title', name: "#{t(:edit)}: #{@domain.name}"
|
||||
|
||||
= render 'form'
|
||||
|
|
8
app/views/admin/domains/form/_pending_delete.haml
Normal file
8
app/views/admin/domains/form/_pending_delete.haml
Normal 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')
|
8
app/views/admin/domains/form/_pending_update.haml
Normal file
8
app/views/admin/domains/form/_pending_update.haml
Normal 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')
|
|
@ -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('')
|
|
@ -6,9 +6,13 @@
|
|||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-6'}= t(:status)
|
||||
%th{class: 'col-xs-6'}= t(:description)
|
||||
%th{class: 'col-xs-6'}= t(:notes)
|
||||
%tbody
|
||||
- @domain.statuses.each do |x|
|
||||
- @domain.statuses.each do |status|
|
||||
%tr
|
||||
%td= x
|
||||
%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]
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
- content_for :actions do
|
||||
= 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')
|
||||
- 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
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
.form-group
|
||||
= f.label :price
|
||||
.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
|
||||
.form-group.input-daterange
|
||||
= f.label :valid_from, t(:valid)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
%td= pricelist.category
|
||||
%td= pricelist.duration
|
||||
%td= pricelist.operation_category
|
||||
%td= pricelist.price
|
||||
%td= currency(pricelist.price)
|
||||
%td= l(pricelist.valid_from, 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')
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
%th{class: 'col-xs-6'}= t(:setting)
|
||||
%th{class: 'col-xs-6'}= t(:value)
|
||||
%tbody
|
||||
= render 'setting_row', var: :transfer_wait_time
|
||||
/= render 'setting_row', var: :transfer_wait_time
|
||||
= render 'setting_row', var: :ds_algorithm
|
||||
= render 'setting_row', var: :client_side_status_editing_enabled
|
||||
= render 'setting_row', var: :api_ip_whitelist_enabled
|
||||
|
@ -69,6 +69,7 @@
|
|||
= render 'setting_row', var: :invoice_number_max
|
||||
= render 'setting_row', var: :days_to_keep_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_invoice_contact
|
||||
= render 'setting_row', var: :registry_vat_no
|
||||
|
|
|
@ -1,35 +1,38 @@
|
|||
#js-contact-statuses
|
||||
#js-statuses
|
||||
- f.object.statuses.each do |s|
|
||||
- disabled = !Contact.admin_statuses.include?(s)
|
||||
- disabled = disabled_statuses.include?(s)
|
||||
- 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-heading.clearfix
|
||||
.pull-left= t(:status)
|
||||
.pull-right
|
||||
- if model == 'domain'
|
||||
= render 'admin/domains/form/pending_update', f: f, status: s
|
||||
= render 'admin/domains/form/pending_delete', f: f, status: s
|
||||
= link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style)
|
||||
.panel-body
|
||||
.form-group
|
||||
= f.label 'status', class: 'col-md-2 control-label'
|
||||
.col-md-10
|
||||
.js-select{style: disabled_style}
|
||||
= select_tag 'contact[statuses][]',
|
||||
options_for_select(Contact::admin_statuses_map, s),
|
||||
= select_tag "#{model}[statuses][]",
|
||||
options_for_select(admin_statuses_map, s),
|
||||
include_blank: true, class: "form-control"
|
||||
- if disabled
|
||||
.disabled-value.js-disabled-value
|
||||
= s
|
||||
= hidden_field_tag 'contact[statuses][]', s, readonly: true
|
||||
= hidden_field_tag "#{model}[statuses][]", s, readonly: true
|
||||
.form-group
|
||||
= label_tag t(:notes), nil, class: 'col-md-2 control-label'
|
||||
.col-md-10
|
||||
- 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
|
||||
$("#js-contact-statuses").nestedAttributes
|
||||
bindAddTo: $(".js-add-contact-status")
|
||||
$("#js-statuses").nestedAttributes
|
||||
bindAddTo: $(".js-add-status")
|
||||
afterAdd: (el) ->
|
||||
if el.find('.js-disabled-value')
|
||||
el.find('.js-disabled-value').remove()
|
80
app/views/admin/zonefile_settings/_form.haml
Normal file
80
app/views/admin/zonefile_settings/_form.haml
Normal 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)
|
|
@ -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|
|
||||
.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)
|
||||
= render 'form'
|
||||
|
|
|
@ -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)
|
||||
|
||||
.row
|
||||
|
|
5
app/views/admin/zonefile_settings/new.haml
Normal file
5
app/views/admin/zonefile_settings/new.haml
Normal 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'
|
|
@ -56,8 +56,8 @@
|
|||
%ul.dropdown-menu{role: "menu"}
|
||||
- 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}"
|
||||
- if user_signed_in?
|
||||
%li= link_to t(:log_out_), '/registrar/logout'
|
||||
- if user_signed_in?
|
||||
%li= link_to t(:log_out_), '/registrar/logout'
|
||||
|
||||
.container
|
||||
= render 'shared/flash'
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
= Country.new(f.object.ident_country_code).try(:to_s)
|
||||
= " [#{f.object.ident_country_code}]"
|
||||
- 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), {},
|
||||
class: 'js-ident-country-code', required: true)
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
= Depp::Contact.type_string(f.object.ident_type)
|
||||
= " [#{f.object.ident_type}]"
|
||||
- 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,
|
||||
{ selected: type_selected },
|
||||
class: 'js-ident-type', required: true)
|
||||
|
@ -33,7 +33,7 @@
|
|||
.col-md-3.control-label
|
||||
= f.label :ident, t(:ident) + '*'
|
||||
.col-md-7
|
||||
- if f.object.ident.present?
|
||||
- if @contact.persisted? && f.object.ident.present?
|
||||
.disabled-value
|
||||
= f.object.ident
|
||||
- else
|
||||
|
|
|
@ -7,42 +7,89 @@
|
|||
= render 'shared/title', name: t(:domains)
|
||||
|
||||
.row
|
||||
.col-md-12{style: 'margin-bottom: -15px;'}
|
||||
= form_tag info_registrar_domains_path, class: 'form-horizontal', method: :get do
|
||||
.col-md-11
|
||||
.form-group
|
||||
= text_field_tag :domain_name, params[:domain_name], class: 'form-control', placeholder: t(:domain_name), autocomplete: 'off', autofocus: true
|
||||
.col-md-1.text-right.text-center-xs
|
||||
.form-group
|
||||
%button.btn.btn-default
|
||||
.col-md-12
|
||||
= search_form_for [:registrar, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
|
||||
.row
|
||||
.col-md-3
|
||||
.form-group
|
||||
= f.label :name
|
||||
= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
|
||||
.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
|
||||
|
||||
%span.glyphicon.glyphicon-search
|
||||
|
||||
|
||||
%button.btn.btn-default.js-reset-form
|
||||
= t(:clear_fields)
|
||||
%hr
|
||||
|
||||
- if @response
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%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|
|
||||
.row
|
||||
.col-md-12
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-bordered.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%td= link_to(x['name'], info_registrar_domains_path(domain_name: x['name']))
|
||||
%td
|
||||
= Time.zone.parse(x['valid_from']).try(:to_date)
|
||||
\-
|
||||
= Time.zone.parse(x['valid_to']).try(:to_date)
|
||||
%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')
|
||||
= link_to(t(:delete), delete_registrar_domains_path(domain_name: x['name']),
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'name')
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'registrant_name', t(:registrant))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'valid_to', t(:valid_to))
|
||||
%th{class: 'col-xs-2'}= t('actions')
|
||||
%tbody
|
||||
- @domains.each do |x|
|
||||
%tr
|
||||
%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')
|
||||
= 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}"
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
%dt= t(:description)
|
||||
- @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)
|
||||
%dd= @invoice.reference_no
|
||||
|
|
|
@ -14,19 +14,19 @@
|
|||
%tr
|
||||
%td= t(x.description)
|
||||
%td= x.unit
|
||||
%td= x.amount
|
||||
%td= x.price
|
||||
%td= x.item_sum_without_vat
|
||||
%td= currency(x.amount)
|
||||
%td= currency(x.price)
|
||||
%td= currency(x.item_sum_without_vat)
|
||||
%tfoot
|
||||
%tr
|
||||
%th{colspan: 3}
|
||||
%th= t(:total_without_vat)
|
||||
%td= @invoice.sum_without_vat
|
||||
%td= currency(@invoice.sum_without_vat)
|
||||
%tr
|
||||
%th.no-border{colspan: 3}
|
||||
%th= t('vat', vat_prc: (@invoice.vat_prc * 100).round)
|
||||
%td= @invoice.vat
|
||||
%td= currency(@invoice.vat)
|
||||
%tr
|
||||
%th.no-border{colspan: 3}
|
||||
%th= t(:total)
|
||||
%td= @invoice.sum
|
||||
%td= currency(@invoice.sum)
|
||||
|
|
|
@ -177,7 +177,7 @@
|
|||
|
||||
%dt= t(:description)
|
||||
- @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)
|
||||
%dd= @invoice.reference_no
|
||||
|
@ -229,22 +229,22 @@
|
|||
%tr
|
||||
%td= t(x.description)
|
||||
%td= x.unit
|
||||
%td= x.amount
|
||||
%td= x.price
|
||||
%td= "#{x.item_sum_without_vat} #{@invoice.currency}"
|
||||
%td= currency(x.amount)
|
||||
%td= currency(x.price)
|
||||
%td= "#{currency(x.item_sum_without_vat)} #{@invoice.currency}"
|
||||
%tfoot
|
||||
%tr
|
||||
%th{colspan: 3}
|
||||
%th= t(:total_without_vat)
|
||||
%td= "#{@invoice.sum_without_vat} #{@invoice.currency}"
|
||||
%td= "#{currency(@invoice.sum_without_vat)} #{@invoice.currency}"
|
||||
%tr
|
||||
%th.no-border{colspan: 3}
|
||||
%th= t('vat', vat_prc: (@invoice.vat_prc * 100).round)
|
||||
%td= "#{@invoice.vat} #{@invoice.currency}"
|
||||
%td= "#{currency(@invoice.vat)} #{@invoice.currency}"
|
||||
%tr
|
||||
%th.no-border{colspan: 3}
|
||||
%th= t(:total)
|
||||
%td= "#{@invoice.sum} #{@invoice.currency}"
|
||||
%td= "#{currency(@invoice.sum)} #{@invoice.currency}"
|
||||
|
||||
#footer
|
||||
%hr
|
||||
|
|
|
@ -74,3 +74,5 @@ module Registry
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
require 'validates_email_format_of'
|
||||
|
|
|
@ -22,6 +22,7 @@ if con.present? && con.table_exists?('settings')
|
|||
Setting.save_default(:ns_max_count, 11)
|
||||
|
||||
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_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(:days_to_keep_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(:expire_warning_period, 15)
|
||||
Setting.save_default(:redemption_grace_period, 30)
|
||||
|
|
|
@ -22,6 +22,7 @@ en:
|
|||
longer: "%a, %e. %b %Y, %H:%M"
|
||||
long: "%A, %e. %B %Y, %H:%M"
|
||||
short: "%d.%m.%y, %H:%M"
|
||||
shorts: "%d.%m.%y, %H:%M:%S"
|
||||
date: "%d.%m.%y"
|
||||
date_long: "%d. %B %Y"
|
||||
ydate: "%Y.%m.%d"
|
||||
|
@ -654,7 +655,10 @@ en:
|
|||
general: General
|
||||
id_card: 'ID Card'
|
||||
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
|
||||
no_connection_to_registry: Connection issue to the registry EPP or REPP server! Please try again later.
|
||||
domain_not_found: 'Domain was not found'
|
||||
|
@ -894,3 +898,15 @@ en:
|
|||
nameserver_hostname: 'Nameserver hostname'
|
||||
result_count: '%{count} results'
|
||||
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
|
||||
|
||||
|
|
|
@ -184,6 +184,8 @@ Rails.application.routes.draw do
|
|||
|
||||
resources :domains do
|
||||
resources :domain_versions
|
||||
resources :pending_updates
|
||||
resources :pending_deletes
|
||||
member do
|
||||
post 'set_force_delete'
|
||||
post 'unset_force_delete'
|
||||
|
|
7
db/migrate/20150803080914_add_ns_data_to_zones.rb
Normal file
7
db/migrate/20150803080914_add_ns_data_to_zones.rb
Normal 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
|
|
@ -0,0 +1,5 @@
|
|||
class AddStatusesBackupForDomains < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :domains, :statuses_backup, :string, array: true, default: []
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# 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
|
||||
enable_extension "plpgsql"
|
||||
|
@ -216,6 +216,12 @@ ActiveRecord::Schema.define(version: 20150722071128) do
|
|||
t.string "updator_str"
|
||||
end
|
||||
|
||||
create_table "data_migrations", id: false, force: :cascade do |t|
|
||||
t.string "version", null: false
|
||||
end
|
||||
|
||||
add_index "data_migrations", ["version"], name: "unique_data_migrations", unique: true, using: :btree
|
||||
|
||||
create_table "delegation_signers", force: :cascade do |t|
|
||||
t.integer "domain_id"
|
||||
t.string "key_tag"
|
||||
|
@ -323,6 +329,7 @@ ActiveRecord::Schema.define(version: 20150722071128) do
|
|||
t.string "statuses", array: true
|
||||
t.boolean "reserved", default: false
|
||||
t.hstore "status_notes"
|
||||
t.string "statuses_backup", default: [], array: true
|
||||
end
|
||||
|
||||
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.string "type"
|
||||
t.string "registrant_ident"
|
||||
t.string "encrypted_password", default: ""
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "failed_attempts", default: 0, null: false
|
||||
t.datetime "locked_at"
|
||||
|
@ -1076,6 +1083,9 @@ ActiveRecord::Schema.define(version: 20150722071128) do
|
|||
t.datetime "updated_at"
|
||||
t.string "creator_str"
|
||||
t.string "updator_str"
|
||||
t.text "ns_records"
|
||||
t.text "a_records"
|
||||
t.text "a4_records"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
123
db/structure.sql
123
db/structure.sql
|
@ -82,33 +82,28 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
|||
|
||||
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
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
|
||||
FROM domains d
|
||||
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
|
||||
),
|
||||
chr(10)
|
||||
) 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
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
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);
|
||||
-- origin a glue records
|
||||
SELECT a_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone A Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- a glue records for other nameservers
|
||||
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 d.name <> i_origin
|
||||
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
|
||||
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods
|
||||
SELECT 1 FROM nameservers nsi
|
||||
JOIN domains di ON nsi.domain_id = di.id
|
||||
WHERE di.name = i_origin
|
||||
AND nsi.hostname = ns.hostname
|
||||
)
|
||||
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||
), chr(10)
|
||||
) 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.*
|
||||
-- FROM nameservers ns
|
||||
-- JOIN domains d ON d.id = ns.domain_id
|
||||
-- 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);
|
||||
-- origin aaaa glue records
|
||||
SELECT a4_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- aaaa glue records for other nameservers
|
||||
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 d.name <> i_origin
|
||||
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
|
||||
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods
|
||||
SELECT 1 FROM nameservers nsi
|
||||
JOIN domains di ON nsi.domain_id = di.id
|
||||
WHERE di.name = i_origin
|
||||
AND nsi.hostname = ns.hostname
|
||||
)
|
||||
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||
), chr(10)
|
||||
) 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
|
||||
SELECT array_to_string(
|
||||
|
@ -189,6 +151,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
|||
FROM domains d
|
||||
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
|
||||
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||
),
|
||||
chr(10)
|
||||
) INTO tmp_var;
|
||||
|
@ -690,6 +653,15 @@ CREATE SEQUENCE countries_id_seq
|
|||
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:
|
||||
--
|
||||
|
@ -938,7 +910,8 @@ CREATE TABLE domains (
|
|||
force_delete_at timestamp without time zone,
|
||||
statuses character varying[],
|
||||
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,
|
||||
"desc" 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,
|
||||
valid_from timestamp without time zone,
|
||||
valid_to timestamp without time zone,
|
||||
|
@ -2641,7 +2614,7 @@ CREATE TABLE users (
|
|||
crt text,
|
||||
type 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,
|
||||
failed_attempts integer DEFAULT 0 NOT NULL,
|
||||
locked_at timestamp without time zone
|
||||
|
@ -2784,7 +2757,10 @@ CREATE TABLE zonefile_settings (
|
|||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
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);
|
||||
|
||||
|
||||
--
|
||||
-- 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:
|
||||
--
|
||||
|
@ -4727,8 +4710,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150227092508');
|
|||
|
||||
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 ('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 ('20150422090645');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150422092514');
|
||||
|
||||
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 ('20150519142542');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150519144118');
|
||||
|
||||
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 ('20150603141054');
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150601083516');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150601083800');
|
||||
|
||||
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 ('20150609093515');
|
||||
|
||||
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 ('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 ('20150612125720');
|
||||
|
||||
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 ('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 ('20150803080914');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150810114746');
|
||||
|
||||
|
|
2121
doc/epp-examples.md
2121
doc/epp-examples.md
File diff suppressed because it is too large
Load diff
|
@ -13,8 +13,10 @@ Contact Mapping protocol short version:
|
|||
----------------------- ------- -----------------
|
||||
<create> 1
|
||||
<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,
|
||||
generated automatically if missing
|
||||
<contact:id> 0-1 Contact id, optional,
|
||||
string: ASCII letters, numbers, ':', '-' characters, no spaces,
|
||||
max 100 characters,
|
||||
generated automatically if missing.
|
||||
<contact:postalInfo> 1 Postal information container
|
||||
<contact:name> 1 Full name of the contact
|
||||
<contact:org> 0 Org is not supported and must be blank or missing
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
<enumeration value="gz"/>
|
||||
<enumeration value="tar"/>
|
||||
<enumeration value="7z"/>
|
||||
<enumeration value="odt"/>
|
||||
<enumeration value="doc"/>
|
||||
<enumeration value="docx"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
<enumeration value="gz"/>
|
||||
<enumeration value="tar"/>
|
||||
<enumeration value="7z"/>
|
||||
<enumeration value="odt"/>
|
||||
<enumeration value="doc"/>
|
||||
<enumeration value="docx"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace :import do
|
|||
Rake::Task['import:registrars'].invoke
|
||||
Rake::Task['import:contacts'].invoke
|
||||
Rake::Task['import:domains'].invoke
|
||||
Rake::Task['import:eis_domains'].invoke
|
||||
Rake::Task['import:zones'].invoke
|
||||
end
|
||||
|
||||
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"
|
||||
end
|
||||
|
||||
desc 'Import EIS domains'
|
||||
task eis_domains: :environment do
|
||||
desc 'Import zones'
|
||||
task zones: :environment do
|
||||
start = Time.zone.now.to_f
|
||||
puts '-----> Importing EIS domains...'
|
||||
puts '-----> Importing zones...'
|
||||
|
||||
eis = Registrar.where(
|
||||
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!
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('ee', 1)
|
||||
|
||||
unless eis.cash_account
|
||||
eis.accounts.create(account_type: Account::CASH, currency: 'EUR')
|
||||
eis.save
|
||||
end
|
||||
|
||||
c = Registrant.where(
|
||||
name: 'Eesti Interneti Sihtasutus',
|
||||
phone: '+372.7271000',
|
||||
email: 'info@internet.ee',
|
||||
ident: '90010019',
|
||||
ident_type: 'passport',
|
||||
city: 'Tallinn',
|
||||
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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
ns_records: ns_records,
|
||||
a_records: a_records,
|
||||
a4_records: a4_records
|
||||
})
|
||||
|
||||
# edu.ee
|
||||
ns_list = []
|
||||
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
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('edu.ee', 6)
|
||||
|
||||
Domain.create!(
|
||||
name: 'edu.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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'edu.ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
ns_records: ns_records,
|
||||
a_records: a_records,
|
||||
a4_records: a4_records
|
||||
})
|
||||
|
||||
# aip.ee
|
||||
ns_list = []
|
||||
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
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('aip.ee', 9)
|
||||
|
||||
Domain.create!(
|
||||
name: 'aip.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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'aip.ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
ns_records: ns_records,
|
||||
a_records: a_records,
|
||||
a4_records: a4_records
|
||||
})
|
||||
|
||||
# org.ee
|
||||
ns_list = []
|
||||
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
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('org.ee', 10)
|
||||
|
||||
Domain.create!(
|
||||
name: 'org.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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'org.ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
ns_records: ns_records,
|
||||
a_records: a_records,
|
||||
a4_records: a4_records
|
||||
})
|
||||
|
||||
# pri.ee
|
||||
ns_list = []
|
||||
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
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('pri.ee', 2)
|
||||
|
||||
Domain.create!(
|
||||
name: 'pri.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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'pri.ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
ns_records: ns_records,
|
||||
a_records: a_records,
|
||||
a4_records: a4_records
|
||||
})
|
||||
|
||||
# med.ee
|
||||
ns_list = []
|
||||
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
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('med.ee', 3)
|
||||
|
||||
Domain.create!(
|
||||
name: 'med.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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'med.ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
ns_records: ns_records,
|
||||
a_records: a_records,
|
||||
a4_records: a4_records
|
||||
})
|
||||
|
||||
# fie.ee
|
||||
ns_list = []
|
||||
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
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('fie.ee', 4)
|
||||
|
||||
Domain.create!(
|
||||
name: 'fie.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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'fie.ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
ns_records: ns_records,
|
||||
a_records: a_records,
|
||||
a4_records: a4_records
|
||||
})
|
||||
|
||||
# com.ee
|
||||
ns_list = []
|
||||
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
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('com.ee', 5)
|
||||
|
||||
Domain.create!(
|
||||
name: 'com.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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'com.ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
ns_records: ns_records,
|
||||
a_records: a_records,
|
||||
a4_records: a4_records
|
||||
})
|
||||
|
||||
# gov.ee
|
||||
ns_list = []
|
||||
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
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('gov.ee', 7)
|
||||
|
||||
Domain.create!(
|
||||
name: 'gov.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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'gov.ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
ns_records: ns_records,
|
||||
a_records: a_records,
|
||||
a4_records: a4_records
|
||||
})
|
||||
|
||||
# riik.ee
|
||||
ns_list = []
|
||||
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
|
||||
ns_records, a_records, a4_records = parse_zone_ns_data('riik.ee', 8)
|
||||
|
||||
Domain.create!(
|
||||
name: 'riik.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
|
||||
)
|
||||
ZonefileSetting.create!({
|
||||
origin: 'riik.ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee',
|
||||
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
|
||||
|
||||
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 Style/SymbolProc
|
||||
|
|
|
@ -40,33 +40,28 @@ namespace :zonefile do
|
|||
|
||||
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
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
|
||||
FROM domains d
|
||||
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
|
||||
),
|
||||
chr(10)
|
||||
) 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
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
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);
|
||||
-- origin a glue records
|
||||
SELECT a_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone A Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- a glue records for other nameservers
|
||||
SELECT array_to_string(
|
||||
|
@ -78,43 +73,15 @@ namespace :zonefile do
|
|||
AND ns.hostname LIKE '%.' || d.name
|
||||
AND d.name <> i_origin
|
||||
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
|
||||
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods
|
||||
SELECT 1 FROM nameservers nsi
|
||||
JOIN domains di ON nsi.domain_id = di.id
|
||||
WHERE di.name = i_origin
|
||||
AND nsi.hostname = ns.hostname
|
||||
)
|
||||
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||
), chr(10)
|
||||
) 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.*
|
||||
-- FROM nameservers ns
|
||||
-- JOIN domains d ON d.id = ns.domain_id
|
||||
-- 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);
|
||||
-- origin aaaa glue records
|
||||
SELECT a4_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- aaaa glue records for other nameservers
|
||||
SELECT array_to_string(
|
||||
|
@ -126,16 +93,11 @@ namespace :zonefile do
|
|||
AND ns.hostname LIKE '%.' || d.name
|
||||
AND d.name <> i_origin
|
||||
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
|
||||
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods
|
||||
SELECT 1 FROM nameservers nsi
|
||||
JOIN domains di ON nsi.domain_id = di.id
|
||||
WHERE di.name = i_origin
|
||||
AND nsi.hostname = ns.hostname
|
||||
)
|
||||
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||
), chr(10)
|
||||
) 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
|
||||
SELECT array_to_string(
|
||||
|
@ -147,6 +109,7 @@ namespace :zonefile do
|
|||
FROM domains d
|
||||
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
|
||||
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||
),
|
||||
chr(10)
|
||||
) 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
|
@ -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);
|
|
@ -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)
|
||||
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
|
||||
response = create_request({ id: { value: 'abc12345' } })
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
|
@ -397,6 +404,18 @@ describe 'EPP Contact', epp: true do
|
|||
response[:results][1][:result_code].should == '2005'
|
||||
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
|
||||
response = update_request(
|
||||
{
|
||||
|
|
|
@ -907,7 +907,6 @@ describe 'EPP Domain', epp: true do
|
|||
context 'with valid domain' do
|
||||
let(:domain) { Fabricate(:domain, registrar: @registrar1, dnskeys: []) }
|
||||
|
||||
### TRANSFER ###
|
||||
it 'transfers a domain' do
|
||||
domain.registrar = @registrar1
|
||||
domain.save
|
||||
|
@ -928,6 +927,67 @@ describe 'EPP Domain', epp: true do
|
|||
old_contact_codes = domain.contacts.pluck(:code).sort.uniq
|
||||
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
|
||||
epp_plain_request(xml)
|
||||
end
|
||||
|
@ -1008,35 +1068,30 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
# should show up in other registrar's poll
|
||||
|
||||
response = login_as :registrar2 do
|
||||
epp_plain_request(@epp_xml.session.poll)
|
||||
login_as :registrar2 do
|
||||
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
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
it 'creates a domain transfer with legal document' do
|
||||
Setting.transfer_wait_time = 1
|
||||
domain.legal_documents.count.should == 0
|
||||
pw = domain.auth_info
|
||||
xml = domain_transfer_xml({
|
||||
|
@ -1067,14 +1122,9 @@ describe 'EPP Domain', epp: true do
|
|||
log.response.should_not be_blank
|
||||
end
|
||||
|
||||
response = login_as :registrar2 do
|
||||
login_as :registrar2 do
|
||||
epp_plain_request(xml)
|
||||
end
|
||||
|
||||
response[:result_code].should == '1000'
|
||||
domain.legal_documents.count.should == 1 # does not add another legal documen
|
||||
|
||||
create_settings
|
||||
end
|
||||
|
||||
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'
|
||||
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
|
||||
pw = domain.auth_info
|
||||
xml = domain_transfer_xml({
|
||||
|
@ -1855,6 +1916,29 @@ describe 'EPP Domain', epp: true do
|
|||
d.pending_update?.should == true
|
||||
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
|
||||
xml = domain_update_xml({
|
||||
name: { value: domain.name },
|
||||
|
|
16
spec/fabricators/zonefile_setting_fabricator.rb
Normal file
16
spec/fabricators/zonefile_setting_fabricator.rb
Normal 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
|
|
@ -46,7 +46,7 @@ feature 'BankStatement', type: :feature do
|
|||
|
||||
click_link 'Back to bank statement'
|
||||
|
||||
page.should have_content('120.0')
|
||||
page.should have_content('120,00')
|
||||
page.should have_content('Test buyer')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,4 +48,40 @@ feature 'Domain', type: :feature do
|
|||
find('.btn.btn-primary').click
|
||||
current_path.should == "/admin/domains/#{d1.id}"
|
||||
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
|
||||
|
|
|
@ -37,10 +37,31 @@ feature 'Invoice', type: :feature do
|
|||
page.should have_content('Record created')
|
||||
page.should have_content('Invoice no.')
|
||||
page.should have_content('Prepayment')
|
||||
page.should have_content('120.0')
|
||||
page.should have_content('120,00')
|
||||
page.should have_content(r.name)
|
||||
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
|
||||
visit '/admin/invoices'
|
||||
click_link @invoice.to_s
|
||||
|
@ -86,7 +107,7 @@ feature 'Invoice', type: :feature do
|
|||
page.should have_content('689')
|
||||
page.should have_content('EE557700771000598731')
|
||||
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')
|
||||
|
||||
click_link 'Bind invoices'
|
||||
|
@ -99,7 +120,7 @@ feature 'Invoice', type: :feature do
|
|||
|
||||
page.should have_content('Binded')
|
||||
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(I18n.l(paid_at, format: :date_long))
|
||||
|
||||
|
|
|
@ -20,5 +20,80 @@ feature 'Zonefile settings', type: :feature do
|
|||
|
||||
page.should have_content('Zonefile settings')
|
||||
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
|
||||
|
|
|
@ -54,6 +54,47 @@ feature 'Domains', type: :feature do
|
|||
|
||||
page.should_not have_text(d1.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
|
||||
|
|
|
@ -39,38 +39,42 @@ describe BankStatement do
|
|||
end
|
||||
|
||||
it 'should bind transactions with invoices' do
|
||||
r = Fabricate(:registrar_with_no_account_activities, reference_no: 'RF7086666663')
|
||||
invoice = r.issue_prepayment_invoice(200, 'add some money')
|
||||
# pending 'Robot fails, probably we need to reset data here or some other issue'
|
||||
# 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: [
|
||||
Fabricate(:bank_transaction, {
|
||||
sum: 240.0, # with vat
|
||||
reference_no: 'RF7086666663',
|
||||
description: "Invoice no. #{invoice.number}"
|
||||
}),
|
||||
Fabricate(:bank_transaction, {
|
||||
sum: 240.0,
|
||||
reference_no: 'RF7086666663',
|
||||
description: "Invoice no. #{invoice.number}"
|
||||
})
|
||||
])
|
||||
# bs = Fabricate(:bank_statement, bank_transactions: [
|
||||
# Fabricate(:bank_transaction, {
|
||||
# sum: 240.0, # with vat
|
||||
# reference_no: 'RF7086666663',
|
||||
# description: "Invoice no. #{invoice.number}"
|
||||
# }),
|
||||
# Fabricate(:bank_transaction, {
|
||||
# sum: 240.0,
|
||||
# reference_no: 'RF7086666663',
|
||||
# description: "Invoice no. #{invoice.number}"
|
||||
# })
|
||||
# ])
|
||||
|
||||
bs.bank_transactions.count.should == 2
|
||||
# bs.bank_transactions.count.should == 2
|
||||
|
||||
AccountActivity.count.should == 0
|
||||
bs.bind_invoices
|
||||
# AccountActivity.count.should == 0
|
||||
# bs.bind_invoices
|
||||
|
||||
AccountActivity.count.should == 1
|
||||
# AccountActivity.count.should == 1
|
||||
|
||||
a = AccountActivity.last
|
||||
a.description.should == "Invoice no. #{invoice.number}"
|
||||
a.sum.should == BigDecimal.new('200.0')
|
||||
a.activity_type = AccountActivity::ADD_CREDIT
|
||||
# a = AccountActivity.last
|
||||
# a.description.should == "Invoice no. #{invoice.number}"
|
||||
# a.sum.should == BigDecimal.new('200.0')
|
||||
# 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.partially_binded?.should == true
|
||||
# bs.bank_transactions.unbinded.count.should == 1
|
||||
# bs.partially_binded?.should == true
|
||||
end
|
||||
|
||||
it 'should not bind transactions with invalid match data' do
|
||||
|
|
|
@ -109,6 +109,12 @@ describe Contact do
|
|||
it 'should have no related domain descriptions' do
|
||||
@contact.related_domain_descriptions.should == {}
|
||||
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
|
||||
|
||||
context 'with valid attributes' do
|
||||
|
@ -247,6 +253,14 @@ describe Contact do
|
|||
contact = @domain.contacts.first
|
||||
contact.related_domain_descriptions.should == { "#{@domain.name}" => [:admin] }
|
||||
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
|
||||
|
||||
context 'as birthday' do
|
||||
|
|
39
spec/models/deposit_spec.rb
Normal file
39
spec/models/deposit_spec.rb
Normal 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
|
|
@ -212,14 +212,67 @@ describe Domain do
|
|||
@domain.statuses = ['ok']
|
||||
@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
|
||||
@domain.force_delete_at.should be_within(20).of(fda)
|
||||
|
||||
@domain.unset_force_delete
|
||||
|
||||
@domain.statuses.count.should == 1
|
||||
@domain.statuses.should == ['ok']
|
||||
@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
|
||||
|
||||
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
|
||||
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
|
||||
before :all do
|
||||
@domain.registrant_verification_token = 123
|
||||
|
@ -469,35 +528,54 @@ describe Domain do
|
|||
end
|
||||
end
|
||||
|
||||
# it 'validates domain name', skip: true do
|
||||
# d = Fabricate(:domain)
|
||||
# expect(d.name).to_not be_nil
|
||||
it 'validates domain name' do
|
||||
d = Fabricate(:domain)
|
||||
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',
|
||||
# 'õ.pri.ee', 'test.com', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee', 'Ž .ee', 'test.edu.ee']
|
||||
invalid = [
|
||||
'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|
|
||||
# expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||
# end
|
||||
invalid.each do |x|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||
end
|
||||
|
||||
# valid = ['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 = [
|
||||
'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|
|
||||
# expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||
# end
|
||||
valid.each do |x|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||
end
|
||||
|
||||
# invalid_punycode = ['xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-4we.pri.ee']
|
||||
invalid_punycode = ['xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-4we.pri.ee']
|
||||
|
||||
# invalid_punycode.each do |x|
|
||||
# expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||
# end
|
||||
invalid_punycode.each do |x|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||
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|
|
||||
# expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||
# end
|
||||
valid_punycode.each do |x|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||
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
|
||||
# expect(d.valid?).to be false
|
||||
|
|
|
@ -2,27 +2,8 @@ require 'rails_helper'
|
|||
|
||||
describe ZonefileSetting do
|
||||
it 'generates the zonefile' do
|
||||
ZonefileSetting.where({
|
||||
origin: '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!
|
||||
Fabricate(:zonefile_setting)
|
||||
Fabricate(:zonefile_setting, origin: 'pri.ee')
|
||||
|
||||
d = Fabricate(:domain_with_dnskeys, name: 'testpri.ee')
|
||||
d.nameservers << Nameserver.new({
|
||||
|
@ -36,6 +17,14 @@ describe ZonefileSetting do
|
|||
)[0]['generate_zonefile']
|
||||
|
||||
@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(/ns.#{d.name}/).count.should == 3
|
||||
@zonefile.scan('123.123.123.123').count.should == 1
|
||||
|
@ -49,4 +38,75 @@ describe ZonefileSetting do
|
|||
|
||||
@zonefile.scan(/^#{d.name}/).count.should == 0
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue