mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Merge branch 'master' into 2143-add-an-exception-for-DNSSEC-in-the-registry-lock
This commit is contained in:
commit
4b80ed5699
149 changed files with 550 additions and 593 deletions
|
@ -31,7 +31,7 @@ plugins:
|
||||||
enabled: false
|
enabled: false
|
||||||
rubocop:
|
rubocop:
|
||||||
enabled: true
|
enabled: true
|
||||||
channel: rubocop-0-74
|
channel: rubocop-1-18-3
|
||||||
checks:
|
checks:
|
||||||
Rubocop/Style/ClassAndModuleChildren:
|
Rubocop/Style/ClassAndModuleChildren:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
25
.github/dependabot.yml
vendored
25
.github/dependabot.yml
vendored
|
@ -1,25 +0,0 @@
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "npm"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
labels:
|
|
||||||
- npm
|
|
||||||
- dependencies
|
|
||||||
|
|
||||||
- package-ecosystem: "bundler"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
labels:
|
|
||||||
- bundler
|
|
||||||
- dependencies
|
|
||||||
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
labels:
|
|
||||||
- github-actions
|
|
||||||
- dependencies
|
|
8
.github/workflows/ruby.yml
vendored
8
.github/workflows/ruby.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-18.04]
|
os: [ubuntu-18.04]
|
||||||
ruby: [ 2.7 ]
|
ruby: [ 2.7, 3.0 ]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -85,6 +85,10 @@ jobs:
|
||||||
path: coverage/codeclimate.${{ matrix.ruby }}.json
|
path: coverage/codeclimate.${{ matrix.ruby }}.json
|
||||||
|
|
||||||
upload_coverage:
|
upload_coverage:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ruby: [ 2.7, 3.0 ]
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
@ -102,7 +106,7 @@ jobs:
|
||||||
|
|
||||||
- uses: actions/download-artifact@v2.0.10
|
- uses: actions/download-artifact@v2.0.10
|
||||||
with:
|
with:
|
||||||
name: coverage-2.7
|
name: coverage-${{ matrix.ruby }}
|
||||||
path: coverage
|
path: coverage
|
||||||
|
|
||||||
- name: Aggregate & upload results to Code Climate
|
- name: Aggregate & upload results to Code Climate
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2.7.2
|
3.0.2
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
13.09.2021
|
||||||
|
* Upgrade Ruby to 3.0.2 [#2152](https://github.com/internetee/registry/pull/2152)
|
||||||
|
|
||||||
|
06.09.2021
|
||||||
|
|
||||||
31.08.2021
|
31.08.2021
|
||||||
* Fix for multiplied renew issue [#2135](https://github.com/internetee/registry/issues/2135)
|
* Fix for multiplied renew issue [#2135](https://github.com/internetee/registry/issues/2135)
|
||||||
* Admin: filtering and search options for the invoices view [#2124](https://github.com/internetee/registry/issues/2124)
|
* Admin: filtering and search options for the invoices view [#2124](https://github.com/internetee/registry/issues/2124)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM internetee/ruby:2.7-buster
|
FROM internetee/ruby:3.0-buster
|
||||||
|
|
||||||
RUN mkdir -p /opt/webapps/app/tmp/pids
|
RUN mkdir -p /opt/webapps/app/tmp/pids
|
||||||
WORKDIR /opt/webapps/app
|
WORKDIR /opt/webapps/app
|
||||||
|
|
22
Gemfile
22
Gemfile
|
@ -5,8 +5,8 @@ gem 'active_interaction', '~> 4.0'
|
||||||
gem 'apipie-rails', '~> 0.5.19'
|
gem 'apipie-rails', '~> 0.5.19'
|
||||||
gem 'bootsnap', '>= 1.1.0', require: false
|
gem 'bootsnap', '>= 1.1.0', require: false
|
||||||
gem 'iso8601', '0.13.0' # for dates and times
|
gem 'iso8601', '0.13.0' # for dates and times
|
||||||
gem 'mime-types-data'
|
|
||||||
gem 'mimemagic', '0.4.3'
|
gem 'mimemagic', '0.4.3'
|
||||||
|
gem 'mime-types-data'
|
||||||
gem 'puma'
|
gem 'puma'
|
||||||
gem 'rails', '~> 6.1.4'
|
gem 'rails', '~> 6.1.4'
|
||||||
gem 'rest-client'
|
gem 'rest-client'
|
||||||
|
@ -29,22 +29,22 @@ gem 'nokogiri', '~> 1.12.4'
|
||||||
|
|
||||||
# style
|
# style
|
||||||
gem 'bootstrap-sass', '~> 3.4'
|
gem 'bootstrap-sass', '~> 3.4'
|
||||||
|
gem 'cancancan'
|
||||||
gem 'coderay', '1.1.3' # xml console visualize
|
gem 'coderay', '1.1.3' # xml console visualize
|
||||||
gem 'coffee-rails', '>= 5.0'
|
gem 'coffee-rails', '>= 5.0'
|
||||||
|
gem 'devise', '~> 4.8'
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
gem 'selectize-rails', '0.12.6' # include selectize.js for select
|
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'sass-rails'
|
gem 'sass-rails'
|
||||||
gem 'select2-rails', '4.0.13' # for autocomplete
|
gem 'select2-rails', '4.0.13' # for autocomplete
|
||||||
gem 'cancancan'
|
gem 'selectize-rails', '0.12.6' # include selectize.js for select
|
||||||
gem 'devise', '~> 4.8'
|
|
||||||
|
|
||||||
# registry specfic
|
# registry specfic
|
||||||
gem 'data_migrate', '~> 7.0'
|
gem 'data_migrate', '~> 7.0'
|
||||||
gem 'dnsruby', '~> 1.61'
|
gem 'dnsruby', '~> 1.61'
|
||||||
gem 'isikukood' # for EE-id validation
|
gem 'isikukood' # for EE-id validation
|
||||||
gem 'simpleidn', '0.2.1' # For punycode
|
|
||||||
gem 'money-rails'
|
gem 'money-rails'
|
||||||
|
gem 'simpleidn', '0.2.1' # For punycode
|
||||||
gem 'whenever', '1.0.0', require: false
|
gem 'whenever', '1.0.0', require: false
|
||||||
|
|
||||||
# country listing
|
# country listing
|
||||||
|
@ -62,22 +62,22 @@ gem 'omniauth-rails_csrf_protection'
|
||||||
gem 'omniauth-tara', github: 'internetee/omniauth-tara'
|
gem 'omniauth-tara', github: 'internetee/omniauth-tara'
|
||||||
|
|
||||||
|
|
||||||
|
gem 'airbrake'
|
||||||
|
gem 'daemons-rails', '1.2.1'
|
||||||
gem 'epp', github: 'internetee/epp', branch: :master
|
gem 'epp', github: 'internetee/epp', branch: :master
|
||||||
gem 'epp-xml', '1.2.0', github: 'internetee/epp-xml', branch: :master
|
gem 'epp-xml', '1.2.0', github: 'internetee/epp-xml', branch: :master
|
||||||
|
gem 'jquery-ui-rails', '6.0.1'
|
||||||
|
gem 'pdfkit'
|
||||||
gem 'que'
|
gem 'que'
|
||||||
gem 'daemons-rails', '1.2.1'
|
|
||||||
gem 'que-web'
|
gem 'que-web'
|
||||||
gem 'sidekiq'
|
gem 'sidekiq'
|
||||||
gem 'pdfkit'
|
|
||||||
gem 'jquery-ui-rails', '6.0.1'
|
|
||||||
gem 'airbrake'
|
|
||||||
|
|
||||||
gem 'company_register', github: 'internetee/company_register',
|
gem 'company_register', github: 'internetee/company_register',
|
||||||
branch: 'master'
|
branch: 'master'
|
||||||
gem 'e_invoice', github: 'internetee/e_invoice', branch: :master
|
|
||||||
gem 'lhv', github: 'internetee/lhv', branch: 'master'
|
|
||||||
gem 'domain_name'
|
gem 'domain_name'
|
||||||
|
gem 'e_invoice', github: 'internetee/e_invoice', branch: :master
|
||||||
gem 'haml', '~> 5.2'
|
gem 'haml', '~> 5.2'
|
||||||
|
gem 'lhv', github: 'internetee/lhv', branch: 'master'
|
||||||
gem 'rexml'
|
gem 'rexml'
|
||||||
gem 'wkhtmltopdf-binary', '~> 0.12.5.1'
|
gem 'wkhtmltopdf-binary', '~> 0.12.5.1'
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,12 @@ module Admin
|
||||||
@account_activities = @q.result.page(params[:page]).per(params[:results_per_page])
|
@account_activities = @q.result.page(params[:page]).per(params[:results_per_page])
|
||||||
@count = @q.result.count
|
@count = @q.result.count
|
||||||
|
|
||||||
if params[:page] && params[:page].to_i > 1
|
@sum = if params[:page] && params[:page].to_i > 1
|
||||||
@sum = @q.result.limit(@account_activities.offset_value).sum(:sum) +
|
@q.result.limit(@account_activities.offset_value).sum(:sum) +
|
||||||
@b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})")
|
@b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
|
||||||
.sum(:sum)
|
else
|
||||||
else
|
@b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
|
||||||
@sum = @b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
|
end
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|
|
@ -63,7 +63,12 @@ module Admin
|
||||||
|
|
||||||
def admin_user_params
|
def admin_user_params
|
||||||
params.require(:admin_user).permit(:username,
|
params.require(:admin_user).permit(:username,
|
||||||
:password, :password_confirmation, :identity_code, :email, :country_code, { roles: [] })
|
:password,
|
||||||
|
:password_confirmation,
|
||||||
|
:identity_code,
|
||||||
|
:email,
|
||||||
|
:country_code,
|
||||||
|
{ roles: [] })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,9 +61,9 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def bank_statement_params
|
def bank_statement_params
|
||||||
params.require(:bank_statement).permit(:bank_code, :iban, bank_transactions_attributes: [
|
params.require(:bank_statement).permit(:bank_code, :iban, bank_transactions_attributes: %i[
|
||||||
:description, :sum, :currency, :reference_no, :paid_at
|
description sum currency reference_no paid_at
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,7 +43,6 @@ module Admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def blocked_domain_params
|
def blocked_domain_params
|
||||||
params.require(:blocked_domain).permit(:name)
|
params.require(:blocked_domain).permit(:name)
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,19 +11,20 @@ module Admin
|
||||||
@versions = @q.result.page(params[:page])
|
@versions = @q.result.page(params[:page])
|
||||||
search_params = params[:q].deep_dup
|
search_params = params[:q].deep_dup
|
||||||
|
|
||||||
whereS = "1=1"
|
where_s = "1=1"
|
||||||
|
|
||||||
search_params.each do |key, value|
|
search_params.each do |key, value|
|
||||||
next if value.empty?
|
next if value.empty?
|
||||||
case key
|
|
||||||
when 'event'
|
where_s += case key
|
||||||
whereS += " AND event = '#{value}'"
|
when 'event'
|
||||||
else
|
" AND event = '#{value}'"
|
||||||
whereS += create_where_string(key, value)
|
else
|
||||||
end
|
create_where_string(key, value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
versions = Version::ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
versions = Version::ContactVersion.includes(:item).where(where_s).order(created_at: :desc, id: :desc)
|
||||||
@q = versions.search(params[:q])
|
@q = versions.search(params[:q])
|
||||||
@versions = @q.result.page(params[:page])
|
@versions = @q.result.page(params[:page])
|
||||||
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
|
|
|
@ -9,7 +9,8 @@ module Admin
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
search_params = params[:q].deep_dup
|
search_params = params[:q].deep_dup
|
||||||
|
|
||||||
if search_params[:domain_contacts_type_in].is_a?(Array) && search_params[:domain_contacts_type_in].delete('registrant')
|
if search_params[:domain_contacts_type_in].is_a?(Array) &&
|
||||||
|
search_params[:domain_contacts_type_in].delete('registrant')
|
||||||
search_params[:registrant_domains_id_not_null] = 1
|
search_params[:registrant_domains_id_not_null] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,26 +21,31 @@ module Admin
|
||||||
search_params.delete(:registrar)
|
search_params.delete(:registrar)
|
||||||
end
|
end
|
||||||
|
|
||||||
whereS = "1=1"
|
where_s = "1=1"
|
||||||
|
|
||||||
search_params.each do |key, value|
|
search_params.each do |key, value|
|
||||||
next if value.empty?
|
next if value.empty?
|
||||||
case key
|
|
||||||
when 'event'
|
where_s += case key
|
||||||
whereS += " AND event = '#{value}'"
|
when 'event'
|
||||||
when 'name'
|
" AND event = '#{value}'"
|
||||||
whereS += " AND (object->>'name' ~* '#{value}' OR object_changes->>'name' ~* '#{value}')"
|
when 'name'
|
||||||
else
|
" AND (object->>'name' ~* '#{value}' OR object_changes->>'name' ~* '#{value}')"
|
||||||
whereS += create_where_string(key, value)
|
else
|
||||||
end
|
create_where_string(key, value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
whereS += " AND object->>'registrant_id' IN (#{registrants.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrants.present?
|
if registrants.present?
|
||||||
whereS += " AND 1=0" if registrants == []
|
where_s += " AND object->>'registrant_id' IN (#{registrants.map { |r| "'#{r.id}'" }.join ','})"
|
||||||
whereS += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrars.present?
|
end
|
||||||
whereS += " AND 1=0" if registrars == []
|
where_s += " AND 1=0" if registrants == []
|
||||||
|
if registrars.present?
|
||||||
|
where_s += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id}'" }.join ','})"
|
||||||
|
end
|
||||||
|
where_s += " AND 1=0" if registrars == []
|
||||||
|
|
||||||
versions = Version::DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
versions = Version::DomainVersion.includes(:item).where(where_s).order(created_at: :desc, id: :desc)
|
||||||
@q = versions.search(params[:q])
|
@q = versions.search(params[:q])
|
||||||
@versions = @q.result.page(params[:page])
|
@versions = @q.result.page(params[:page])
|
||||||
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
|
|
|
@ -5,20 +5,19 @@ module Admin
|
||||||
|
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
if params[:statuses_contains]
|
domains = if params[:statuses_contains]
|
||||||
domains = Domain.includes(:registrar, :registrant).where(
|
Domain.includes(:registrar, :registrant).where(
|
||||||
"domains.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
"domains.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
domains = Domain.includes(:registrar, :registrant)
|
Domain.includes(:registrar, :registrant)
|
||||||
end
|
end
|
||||||
|
|
||||||
normalize_search_parameters do
|
normalize_search_parameters do
|
||||||
@q = domains.search(params[:q])
|
@q = domains.search(params[:q])
|
||||||
@domains = @q.result.page(params[:page])
|
@domains = @q.result.page(params[:page])
|
||||||
if @domains.count == 1 && params[:q][:name_matches].present?
|
(redirect_to [:admin, @domains.first] and return if @domains.count == 1 && params[:q][:name_matches].present?)
|
||||||
redirect_to [:admin, @domains.first] and return
|
if @domains.count.zero? && params[:q][:name_matches] !~ /^%.+%$/
|
||||||
elsif @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/
|
|
||||||
# if we do not get any results, add wildcards to the name field and search again
|
# if we do not get any results, add wildcards to the name field and search again
|
||||||
n_cache = params[:q][:name_matches]
|
n_cache = params[:q][:name_matches]
|
||||||
params[:q][:name_matches] = "%#{params[:q][:name_matches]}%"
|
params[:q][:name_matches] = "%#{params[:q][:name_matches]}%"
|
||||||
|
@ -51,7 +50,7 @@ module Admin
|
||||||
redirect_to [:admin, @domain]
|
redirect_to [:admin, @domain]
|
||||||
else
|
else
|
||||||
build_associations
|
build_associations
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_domain') + ' ' + @domain.errors.full_messages.join(", ")
|
flash.now[:alert] = "#{I18n.t('failed_to_update_domain')} #{@domain.errors.full_messages.join(', ')}"
|
||||||
render 'edit'
|
render 'edit'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,17 +3,25 @@ module Admin
|
||||||
load_and_authorize_resource class: ApiLog::EppLog
|
load_and_authorize_resource class: ApiLog::EppLog
|
||||||
before_action :set_default_dates, only: [:index]
|
before_action :set_default_dates, only: [:index]
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/MethodLength
|
||||||
def index
|
def index
|
||||||
@q = ApiLog::EppLog.ransack(params[:q])
|
@q = ApiLog::EppLog.ransack(params[:q])
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
|
|
||||||
@epp_logs = @q.result
|
@epp_logs = @q.result
|
||||||
@epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
if params[:q][:created_at_gteq].present?
|
||||||
@epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
@epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)",
|
||||||
|
Time.parse(params[:q][:created_at_gteq]))
|
||||||
|
end
|
||||||
|
if params[:q][:created_at_lteq].present?
|
||||||
|
@epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)",
|
||||||
|
Time.parse(params[:q][:created_at_lteq]))
|
||||||
|
end
|
||||||
@epp_logs = @epp_logs.page(params[:page])
|
@epp_logs = @epp_logs.page(params[:page])
|
||||||
|
|
||||||
render_by_format('admin/epp_logs/index', 'epp_logs')
|
render_by_format('admin/epp_logs/index', 'epp_logs')
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Metrics/MethodLength
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@epp_log = ApiLog::EppLog.find(params[:id])
|
@epp_log = ApiLog::EppLog.find(params[:id])
|
||||||
|
|
|
@ -3,19 +3,27 @@ module Admin
|
||||||
load_and_authorize_resource class: ApiLog::ReppLog
|
load_and_authorize_resource class: ApiLog::ReppLog
|
||||||
before_action :set_default_dates, only: [:index]
|
before_action :set_default_dates, only: [:index]
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/MethodLength
|
||||||
def index
|
def index
|
||||||
@q = ApiLog::ReppLog.search(params[:q])
|
@q = ApiLog::ReppLog.search(params[:q])
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
|
|
||||||
@repp_logs = @q.result
|
@repp_logs = @q.result
|
||||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
if params[:q][:created_at_gteq].present?
|
||||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
@repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)",
|
||||||
|
Time.parse(params[:q][:created_at_gteq]))
|
||||||
|
end
|
||||||
|
if params[:q][:created_at_lteq].present?
|
||||||
|
@repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)",
|
||||||
|
Time.parse(params[:q][:created_at_lteq]))
|
||||||
|
end
|
||||||
@repp_logs = @repp_logs.page(params[:page])
|
@repp_logs = @repp_logs.page(params[:page])
|
||||||
@count = @q.result.count
|
@count = @q.result.count
|
||||||
@repp_logs = @repp_logs.per(params[:results_per_page]) if paginate?
|
@repp_logs = @repp_logs.per(params[:results_per_page]) if paginate?
|
||||||
|
|
||||||
render_by_format('admin/repp_logs/index', 'repp_logs')
|
render_by_format('admin/repp_logs/index', 'repp_logs')
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Metrics/MethodLength
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@repp_log = ApiLog::ReppLog.find(params[:id])
|
@repp_log = ApiLog::ReppLog.find(params[:id])
|
||||||
|
|
|
@ -45,8 +45,7 @@ module Api
|
||||||
|
|
||||||
def create_token(user)
|
def create_token(user)
|
||||||
token_creator = AuthTokenCreator.create_with_defaults(user)
|
token_creator = AuthTokenCreator.create_with_defaults(user)
|
||||||
hash = token_creator.token_in_hash
|
token_creator.token_in_hash
|
||||||
hash
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_ip_whitelist
|
def check_ip_whitelist
|
||||||
|
|
|
@ -15,9 +15,7 @@ module Api
|
||||||
current_registrant: serialized_registrant(@domain.registrant),
|
current_registrant: serialized_registrant(@domain.registrant),
|
||||||
}
|
}
|
||||||
|
|
||||||
unless delete_action?
|
res[:new_registrant] = serialized_registrant(@domain.pending_registrant) unless delete_action?
|
||||||
res[:new_registrant] = serialized_registrant(@domain.pending_registrant)
|
|
||||||
end
|
|
||||||
|
|
||||||
render json: res, status: :ok
|
render json: res, status: :ok
|
||||||
end
|
end
|
||||||
|
@ -103,9 +101,10 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_action
|
def verify_action
|
||||||
action = if params[:template] == 'change'
|
action = case params[:template]
|
||||||
|
when 'change'
|
||||||
@domain.registrant_update_confirmable?(verify_params[:token])
|
@domain.registrant_update_confirmable?(verify_params[:token])
|
||||||
elsif params[:template] == 'delete'
|
when 'delete'
|
||||||
@domain.registrant_delete_confirmable?(verify_params[:token])
|
@domain.registrant_delete_confirmable?(verify_params[:token])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -77,9 +77,7 @@ module Api
|
||||||
render json: { errors: [{ address: [error_msg] }] }, status: :bad_request and return
|
render json: { errors: [{ address: [error_msg] }] }, status: :bad_request and return
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV['fax_enabled'] == 'true'
|
contact.fax = params[:fax] if ENV['fax_enabled'] == 'true' && params[:fax].present?
|
||||||
contact.fax = params[:fax] if params[:fax].present?
|
|
||||||
end
|
|
||||||
|
|
||||||
logger.debug "ENV['fax_enabled'] is set to #{ENV['fax_enabled']}"
|
logger.debug "ENV['fax_enabled'] is set to #{ENV['fax_enabled']}"
|
||||||
if ENV['fax_enabled'] != 'true' && params[:fax]
|
if ENV['fax_enabled'] != 'true' && params[:fax]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module Epp
|
module Epp
|
||||||
class BaseController < ActionController::Base
|
class BaseController < ApplicationController
|
||||||
class AuthorizationError < StandardError; end
|
class AuthorizationError < StandardError; end
|
||||||
skip_before_action :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
||||||
check_authorization
|
check_authorization
|
||||||
|
@ -303,16 +303,25 @@ module Epp
|
||||||
if request_command == 'login' && frame.present?
|
if request_command == 'login' && frame.present?
|
||||||
frame.gsub!(/pw>.+<\//, 'pw>[FILTERED]</')
|
frame.gsub!(/pw>.+<\//, 'pw>[FILTERED]</')
|
||||||
end
|
end
|
||||||
trimmed_request = frame.gsub(/<eis:legalDocument([^>]+)>([^<])+<\/eis:legalDocument>/, "<eis:legalDocument>[FILTERED]</eis:legalDocument>") if frame.present?
|
if frame.present?
|
||||||
|
trimmed_request = frame.gsub(/<eis:legalDocument([^>]+)>([^<])+<\/eis:legalDocument>/,
|
||||||
|
"<eis:legalDocument>[FILTERED]</eis:legalDocument>")
|
||||||
|
end
|
||||||
|
|
||||||
ApiLog::EppLog.create({
|
ApiLog::EppLog.create({
|
||||||
request: trimmed_request,
|
request: trimmed_request,
|
||||||
request_command: request_command,
|
request_command: request_command,
|
||||||
request_successful: epp_errors.empty?,
|
request_successful: epp_errors.empty?,
|
||||||
request_object: resource ? "#{params[:epp_object_type]}: #{resource.class} - #{resource.id} - #{resource.name}" : params[:epp_object_type],
|
request_object: if resource
|
||||||
|
"#{params[:epp_object_type]}: #{resource.class} - "\
|
||||||
|
"#{resource.id} - #{resource.name}"
|
||||||
|
else
|
||||||
|
params[:epp_object_type]
|
||||||
|
end,
|
||||||
response: @response,
|
response: @response,
|
||||||
api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public',
|
api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public',
|
||||||
api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s),
|
api_user_registrar: @api_user.try(:registrar).try(:to_s) ||
|
||||||
|
current_user.try(:registrar).try(:to_s),
|
||||||
ip: request.ip,
|
ip: request.ip,
|
||||||
uuid: request.uuid
|
uuid: request.uuid
|
||||||
})
|
})
|
||||||
|
|
|
@ -155,8 +155,8 @@ module Epp
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_update
|
def validate_update
|
||||||
if element_count('update > chg > registrant') > 0
|
if element_count('update > chg > registrant').positive? && current_user.legaldoc_mandatory?
|
||||||
requires 'extension > extdata > legalDocument' if current_user.legaldoc_mandatory?
|
requires 'extension > extdata > legalDocument'
|
||||||
end
|
end
|
||||||
|
|
||||||
@prefix = 'update > update >'
|
@prefix = 'update > update >'
|
||||||
|
|
|
@ -51,6 +51,7 @@ module Epp
|
||||||
end
|
end
|
||||||
|
|
||||||
handle_errors(@notification) and return unless @notification.mark_as_read
|
handle_errors(@notification) and return unless @notification.mark_as_read
|
||||||
|
|
||||||
render_epp_response 'epp/poll/poll_ack'
|
render_epp_response 'epp/poll/poll_ack'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,38 +14,31 @@ module Epp
|
||||||
webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)
|
webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)
|
||||||
if webclient_request && !Rails.env.test? && !Rails.env.development?
|
if webclient_request && !Rails.env.test? && !Rails.env.development?
|
||||||
client_md5 = Certificate.parse_md_from_string(request.env['HTTP_SSL_CLIENT_CERT'])
|
client_md5 = Certificate.parse_md_from_string(request.env['HTTP_SSL_CLIENT_CERT'])
|
||||||
if ENV['cert_path'].blank?
|
raise 'webclient cert (cert_path) missing, registrar (r)epp disabled' if ENV['cert_path'].blank?
|
||||||
raise 'webclient cert (cert_path) missing, registrar (r)epp disabled'
|
|
||||||
end
|
|
||||||
|
|
||||||
server_md5 = Certificate.parse_md_from_string(File.read(ENV['cert_path']))
|
server_md5 = Certificate.parse_md_from_string(File.read(ENV['cert_path']))
|
||||||
if client_md5 != server_md5
|
if client_md5 != server_md5
|
||||||
msg = 'Authentication error; server closing connection (certificate is not valid)'
|
msg = 'Authentication error; server closing connection (certificate is not valid)'
|
||||||
epp_errors.add(:epp_errors,
|
epp_errors.add(:epp_errors,
|
||||||
msg: msg,
|
msg: msg, code: '2501')
|
||||||
code: '2501')
|
|
||||||
|
|
||||||
success = false
|
success = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if !Rails.env.development? && (!webclient_request && @api_user)
|
if !Rails.env.development? && (!webclient_request && @api_user) &&
|
||||||
unless @api_user.pki_ok?(request.env['HTTP_SSL_CLIENT_CERT'],
|
!@api_user.pki_ok?(request.env['HTTP_SSL_CLIENT_CERT'], request.env['HTTP_SSL_CLIENT_S_DN_CN'])
|
||||||
request.env['HTTP_SSL_CLIENT_S_DN_CN'])
|
msg = 'Authentication error; server closing connection (certificate is not valid)'
|
||||||
msg = 'Authentication error; server closing connection (certificate is not valid)'
|
epp_errors.add(:epp_errors,
|
||||||
epp_errors.add(:epp_errors,
|
msg: msg, code: '2501')
|
||||||
msg: msg,
|
|
||||||
code: '2501')
|
|
||||||
|
|
||||||
success = false
|
success = false
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if success && !@api_user
|
if success && !@api_user
|
||||||
msg = 'Authentication error; server closing connection (API user not found)'
|
msg = 'Authentication error; server closing connection (API user not found)'
|
||||||
epp_errors.add(:epp_errors,
|
epp_errors.add(:epp_errors,
|
||||||
msg: msg,
|
msg: msg, code: '2501')
|
||||||
code: '2501')
|
|
||||||
|
|
||||||
success = false
|
success = false
|
||||||
end
|
end
|
||||||
|
@ -53,8 +46,7 @@ module Epp
|
||||||
if success && !@api_user.try(:active)
|
if success && !@api_user.try(:active)
|
||||||
msg = 'Authentication error; server closing connection (API user is not active)'
|
msg = 'Authentication error; server closing connection (API user is not active)'
|
||||||
epp_errors.add(:epp_errors,
|
epp_errors.add(:epp_errors,
|
||||||
msg: msg,
|
msg: msg, code: '2501')
|
||||||
code: '2501')
|
|
||||||
|
|
||||||
success = false
|
success = false
|
||||||
end
|
end
|
||||||
|
@ -62,8 +54,7 @@ module Epp
|
||||||
if success && @api_user.cannot?(:create, :epp_login)
|
if success && @api_user.cannot?(:create, :epp_login)
|
||||||
msg = 'Authentication error; server closing connection (API user does not have epp role)'
|
msg = 'Authentication error; server closing connection (API user does not have epp role)'
|
||||||
epp_errors.add(:epp_errors,
|
epp_errors.add(:epp_errors,
|
||||||
msg: msg,
|
msg: msg, code: '2501')
|
||||||
code: '2501')
|
|
||||||
|
|
||||||
success = false
|
success = false
|
||||||
end
|
end
|
||||||
|
@ -71,8 +62,7 @@ module Epp
|
||||||
if success && !ip_white?
|
if success && !ip_white?
|
||||||
msg = 'Authentication error; server closing connection (IP is not whitelisted)'
|
msg = 'Authentication error; server closing connection (IP is not whitelisted)'
|
||||||
epp_errors.add(:epp_errors,
|
epp_errors.add(:epp_errors,
|
||||||
msg: msg,
|
msg: msg, code: '2501')
|
||||||
code: '2501')
|
|
||||||
|
|
||||||
success = false
|
success = false
|
||||||
end
|
end
|
||||||
|
@ -80,8 +70,7 @@ module Epp
|
||||||
if success && EppSession.limit_reached?(@api_user.registrar)
|
if success && EppSession.limit_reached?(@api_user.registrar)
|
||||||
msg = 'Session limit exceeded; server closing connection (connection limit reached)'
|
msg = 'Session limit exceeded; server closing connection (connection limit reached)'
|
||||||
epp_errors.add(:epp_errors,
|
epp_errors.add(:epp_errors,
|
||||||
msg: msg,
|
msg: msg, code: '2502')
|
||||||
code: '2502')
|
|
||||||
|
|
||||||
success = false
|
success = false
|
||||||
end
|
end
|
||||||
|
@ -99,8 +88,7 @@ module Epp
|
||||||
|
|
||||||
if already_authenticated
|
if already_authenticated
|
||||||
epp_errors.add(:epp_errors,
|
epp_errors.add(:epp_errors,
|
||||||
msg: 'Command use error; Already authenticated',
|
msg: 'Command use error; Already authenticated', code: 2002)
|
||||||
code: 2002)
|
|
||||||
handle_errors
|
handle_errors
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -118,17 +106,15 @@ module Epp
|
||||||
def ip_white?
|
def ip_white?
|
||||||
webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)
|
webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)
|
||||||
return true if webclient_request
|
return true if webclient_request
|
||||||
if @api_user
|
return false if @api_user && !@api_user.registrar.api_ip_white?(request.ip)
|
||||||
return false unless @api_user.registrar.api_ip_white?(request.ip)
|
|
||||||
end
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def logout
|
def logout
|
||||||
unless signed_in?
|
unless signed_in?
|
||||||
epp_errors.add(:epp_errors,
|
epp_errors.add(:epp_errors,
|
||||||
code: 2201,
|
code: 2201, msg: 'Authorization error')
|
||||||
msg: 'Authorization error')
|
|
||||||
handle_errors
|
handle_errors
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -89,7 +89,7 @@ class Registrar
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_ids_for_bulk_renew
|
def domain_ids_for_bulk_renew
|
||||||
params.dig('domain_ids')&.reject { |id| id.blank? }
|
params['domain_ids']&.reject { |id| id.blank? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def renew_task(domains)
|
def renew_task(domains)
|
||||||
|
|
|
@ -13,7 +13,8 @@ class Registrar
|
||||||
|
|
||||||
search_params = params[:q].deep_dup
|
search_params = params[:q].deep_dup
|
||||||
|
|
||||||
if search_params[:domain_contacts_type_in].is_a?(Array) && search_params[:domain_contacts_type_in].delete('registrant')
|
if search_params[:domain_contacts_type_in].is_a?(Array) &&
|
||||||
|
search_params[:domain_contacts_type_in].delete('registrant')
|
||||||
search_params[:registrant_domains_id_not_null] = 1
|
search_params[:registrant_domains_id_not_null] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,7 @@ class Registrar
|
||||||
current_domain_scope
|
current_domain_scope
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:contacts_ident_eq]
|
domains = domains.where(contacts: { ident: params[:contacts_ident_eq] }) if params[:contacts_ident_eq]
|
||||||
domains = domains.where(contacts: { ident: params[:contacts_ident_eq] })
|
|
||||||
end
|
|
||||||
|
|
||||||
normalize_search_parameters do
|
normalize_search_parameters do
|
||||||
@q = domains.search(search_params.except(:contacts_ident_eq))
|
@q = domains.search(search_params.except(:contacts_ident_eq))
|
||||||
|
|
|
@ -35,9 +35,7 @@ class Registrar
|
||||||
notices = ["#{t('.replaced')}. #{t('.affected_domains')}: " \
|
notices = ["#{t('.replaced')}. #{t('.affected_domains')}: " \
|
||||||
"#{res[:data][:affected_domains].join(', ')}"]
|
"#{res[:data][:affected_domains].join(', ')}"]
|
||||||
|
|
||||||
if res[:data][:skipped_domains]
|
notices << "#{t('.skipped_domains')}: #{res[:data][:skipped_domains].join(', ')}" if res[:data][:skipped_domains]
|
||||||
notices << "#{t('.skipped_domains')}: #{res[:data][:skipped_domains].join(', ')}"
|
|
||||||
end
|
|
||||||
|
|
||||||
notices.join(', ')
|
notices.join(', ')
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,9 +16,7 @@ class Registrar
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@data = depp_current_user.request(@ex.poll(poll: {
|
@data = depp_current_user.request(@ex.poll(poll: { value: '', attrs: { op: 'ack', msgID: params[:id] } }))
|
||||||
value: '', attrs: { op: 'ack', msgID: params[:id] }
|
|
||||||
}))
|
|
||||||
|
|
||||||
@results = @data.css('result')
|
@results = @data.css('result')
|
||||||
|
|
||||||
|
|
|
@ -30,22 +30,18 @@ class Registrar
|
||||||
show_error and return
|
show_error and return
|
||||||
end
|
end
|
||||||
|
|
||||||
if @depp_user.pki
|
if @depp_user.pki && !@api_user.pki_ok?(request.env['HTTP_SSL_CLIENT_CERT'],
|
||||||
unless @api_user.pki_ok?(request.env['HTTP_SSL_CLIENT_CERT'],
|
request.env['HTTP_SSL_CLIENT_S_DN_CN'], api: false)
|
||||||
request.env['HTTP_SSL_CLIENT_S_DN_CN'], api: false)
|
@depp_user.errors.add(:base, :invalid_cert)
|
||||||
@depp_user.errors.add(:base, :invalid_cert)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if @depp_user.errors.none?
|
show_error and return unless @depp_user.errors.none?
|
||||||
if @api_user.active?
|
|
||||||
sign_in_and_redirect(:registrar_user, @api_user)
|
if @api_user.active?
|
||||||
else
|
sign_in_and_redirect(:registrar_user, @api_user)
|
||||||
@depp_user.errors.add(:base, :not_active)
|
|
||||||
show_error and return
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
show_error and return
|
@depp_user.errors.add(:base, :not_active)
|
||||||
|
show_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,9 +61,7 @@ class Registrar
|
||||||
|
|
||||||
possible_users = ApiUser.where(identity_code: idc) || User.new
|
possible_users = ApiUser.where(identity_code: idc) || User.new
|
||||||
possible_users.each do |selected_user|
|
possible_users.each do |selected_user|
|
||||||
if selected_user.registrar.white_ips.registrar_area.include_ip?(request.ip)
|
return selected_user if selected_user.registrar.white_ips.registrar_area.include_ip?(request.ip)
|
||||||
return selected_user
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Registrar
|
||||||
|
|
||||||
def load_xml
|
def load_xml
|
||||||
cl_trid = "#{depp_current_user.tag}-#{Time.zone.now.to_i}"
|
cl_trid = "#{depp_current_user.tag}-#{Time.zone.now.to_i}"
|
||||||
xml_dir_path = Rails.root + 'app/views/registrar/xml_consoles/epp_requests'
|
xml_dir_path = Rails.root.join('app/views/registrar/xml_consoles/epp_requests').to_s
|
||||||
xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml")
|
xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml")
|
||||||
xml = prepare_payload(xml, cl_trid)
|
xml = prepare_payload(xml, cl_trid)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class Registrar
|
||||||
end
|
end
|
||||||
|
|
||||||
def insert_prefix_and_version(xml, pref, version)
|
def insert_prefix_and_version(xml, pref, version)
|
||||||
xml.gsub!('"' + pref.to_s + '"',
|
xml.gsub!("\"#{pref}\"",
|
||||||
"\"#{Xsd::Schema.filename(for_prefix: pref.to_s, for_version: version)}\"")
|
"\"#{Xsd::Schema.filename(for_prefix: pref.to_s, for_version: version)}\"")
|
||||||
xml
|
xml
|
||||||
end
|
end
|
||||||
|
|
|
@ -74,7 +74,7 @@ module Repp
|
||||||
render_epp_error
|
render_epp_error
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_epp_error(status = :bad_request, data = {})
|
def render_epp_error(status = :bad_request, **data)
|
||||||
@epp_errors ||= ActiveModel::Errors.new(self)
|
@epp_errors ||= ActiveModel::Errors.new(self)
|
||||||
@epp_errors.add(:epp_errors, msg: 'Command failed', code: '2304') if data != {}
|
@epp_errors.add(:epp_errors, msg: 'Command failed', code: '2304') if data != {}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ module Repp
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
render_success(create_update_success_body)
|
render_success(**create_update_success_body)
|
||||||
end
|
end
|
||||||
|
|
||||||
api :PUT, '/repp/v1/contacts/:contact_code'
|
api :PUT, '/repp/v1/contacts/:contact_code'
|
||||||
|
@ -58,7 +58,7 @@ module Repp
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
render_success(create_update_success_body)
|
render_success(**create_update_success_body)
|
||||||
end
|
end
|
||||||
|
|
||||||
api :DELETE, '/repp/v1/contacts/:contact_code'
|
api :DELETE, '/repp/v1/contacts/:contact_code'
|
||||||
|
@ -89,13 +89,11 @@ module Repp
|
||||||
|
|
||||||
return contacts.pluck(:code) unless details
|
return contacts.pluck(:code) unless details
|
||||||
|
|
||||||
contacts = contacts.map do |contact|
|
contacts.map do |contact|
|
||||||
serializer = ::Serializers::Repp::Contact.new(contact,
|
serializer = ::Serializers::Repp::Contact.new(contact,
|
||||||
show_address: Contact.address_processing?)
|
show_address: Contact.address_processing?)
|
||||||
serializer.to_json
|
serializer.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
contacts
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def opt_addr?
|
def opt_addr?
|
||||||
|
|
|
@ -53,7 +53,7 @@ module Repp
|
||||||
end
|
end
|
||||||
|
|
||||||
def nameserver_params
|
def nameserver_params
|
||||||
params.permit(:domain_id, nameservers: [[:hostname, :action, ipv4: [], ipv6: []]])
|
params.permit(:domain_id, nameservers: [[:hostname, :action, { ipv4: [], ipv6: [] }]])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -223,7 +223,7 @@ module Repp
|
||||||
params.require(:domain).permit(:name, :registrant, :period, :period_unit, :registrar,
|
params.require(:domain).permit(:name, :registrant, :period, :period_unit, :registrar,
|
||||||
:transfer_code, :reserved_pw,
|
:transfer_code, :reserved_pw,
|
||||||
dnskeys_attributes: [%i[flags alg protocol public_key]],
|
dnskeys_attributes: [%i[flags alg protocol public_key]],
|
||||||
nameservers_attributes: [[:hostname, ipv4: [], ipv6: []]],
|
nameservers_attributes: [[:hostname, { ipv4: [], ipv6: [] }]],
|
||||||
admin_contacts: [], tech_contacts: [])
|
admin_contacts: [], tech_contacts: [])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ module ApplicationHelper
|
||||||
|
|
||||||
def env_style
|
def env_style
|
||||||
return '' if unstable_env.nil?
|
return '' if unstable_env.nil?
|
||||||
"background-image: url(#{image_path(unstable_env.to_s + '.png')});"
|
"background-image: url(#{image_path("#{unstable_env}.png")});"
|
||||||
end
|
end
|
||||||
|
|
||||||
def ident_for(contact)
|
def ident_for(contact)
|
||||||
|
@ -110,7 +110,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def verified_email_span(verification)
|
def verified_email_span(verification)
|
||||||
content_tag(:span, verification.email, class: verified_email_class(verification))
|
tag.span(verification.email, class: verified_email_class(verification))
|
||||||
end
|
end
|
||||||
|
|
||||||
def verified_email_class(verification)
|
def verified_email_class(verification)
|
||||||
|
|
|
@ -2,9 +2,7 @@ module ObjectVersionsHelper
|
||||||
def attach_existing_fields(version, new_object)
|
def attach_existing_fields(version, new_object)
|
||||||
version.object_changes.to_h.each do |key, value|
|
version.object_changes.to_h.each do |key, value|
|
||||||
method_name = "#{key}=".to_sym
|
method_name = "#{key}=".to_sym
|
||||||
if new_object.respond_to?(method_name)
|
new_object.public_send(method_name, event_value(version, value)) if new_object.respond_to?(method_name)
|
||||||
new_object.public_send(method_name, event_value(version, value))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
module Actions
|
module Actions
|
||||||
class ContactDelete
|
class ContactDelete
|
||||||
attr_reader :contact
|
attr_reader :contact, :new_attributes, :legal_document, :ident, :user
|
||||||
attr_reader :new_attributes
|
|
||||||
attr_reader :legal_document
|
|
||||||
attr_reader :ident
|
|
||||||
attr_reader :user
|
|
||||||
|
|
||||||
def initialize(contact, legal_document = nil)
|
def initialize(contact, legal_document = nil)
|
||||||
@legal_document = legal_document
|
@legal_document = legal_document
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
module Actions
|
module Actions
|
||||||
class ContactUpdate
|
class ContactUpdate
|
||||||
attr_reader :contact
|
attr_reader :contact, :new_attributes, :legal_document, :ident, :user
|
||||||
attr_reader :new_attributes
|
|
||||||
attr_reader :legal_document
|
|
||||||
attr_reader :ident
|
|
||||||
attr_reader :user
|
|
||||||
|
|
||||||
def initialize(contact, new_attributes, legal_document, ident, user)
|
def initialize(contact, new_attributes, legal_document, ident, user)
|
||||||
@contact = contact
|
@contact = contact
|
||||||
|
|
|
@ -6,14 +6,13 @@ module Actions
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
response = if Rails.env.test?
|
if Rails.env.test?
|
||||||
do_test_request(@request, @uri)
|
do_test_request(@request, @uri)
|
||||||
elsif Rails.env.development?
|
elsif Rails.env.development?
|
||||||
do_dev_request(@request, @uri)
|
do_dev_request(@request, @uri)
|
||||||
else
|
else
|
||||||
do_live_request(@request, @uri)
|
do_live_request(@request, @uri)
|
||||||
end
|
end
|
||||||
response
|
|
||||||
rescue StandardError, OpenURI::HTTPError => e
|
rescue StandardError, OpenURI::HTTPError => e
|
||||||
Rails.logger.debug e.message
|
Rails.logger.debug e.message
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
module Actions
|
module Actions
|
||||||
class DomainDelete
|
class DomainDelete
|
||||||
attr_reader :domain
|
attr_reader :domain, :params, :user
|
||||||
attr_reader :params
|
|
||||||
attr_reader :user
|
|
||||||
|
|
||||||
def initialize(domain, params, user)
|
def initialize(domain, params, user)
|
||||||
@domain = domain
|
@domain = domain
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
module Actions
|
module Actions
|
||||||
class DomainRenew
|
class DomainRenew
|
||||||
attr_reader :domain
|
attr_reader :domain, :params, :user
|
||||||
attr_reader :params
|
|
||||||
attr_reader :user
|
|
||||||
|
|
||||||
def initialize(domain, params, user)
|
def initialize(domain, params, user)
|
||||||
@domain = domain
|
@domain = domain
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
module Actions
|
module Actions
|
||||||
class DomainTransfer
|
class DomainTransfer
|
||||||
attr_reader :domain
|
attr_reader :domain, :transfer_code, :legal_document, :ident, :user
|
||||||
attr_reader :transfer_code
|
|
||||||
attr_reader :legal_document
|
|
||||||
attr_reader :ident
|
|
||||||
attr_reader :user
|
|
||||||
|
|
||||||
def initialize(domain, transfer_code, user)
|
def initialize(domain, transfer_code, user)
|
||||||
@domain = domain
|
@domain = domain
|
||||||
|
|
|
@ -43,9 +43,7 @@ module Actions
|
||||||
end
|
end
|
||||||
|
|
||||||
def assign_new_registrant
|
def assign_new_registrant
|
||||||
unless params[:registrant][:code]
|
domain.add_epp_error('2306', nil, nil, %i[registrant cannot_be_missing]) unless params[:registrant][:code]
|
||||||
domain.add_epp_error('2306', nil, nil, %i[registrant cannot_be_missing])
|
|
||||||
end
|
|
||||||
|
|
||||||
regt = Registrant.find_by(code: params[:registrant][:code])
|
regt = Registrant.find_by(code: params[:registrant][:code])
|
||||||
unless regt
|
unless regt
|
||||||
|
|
|
@ -11,9 +11,7 @@ module Domains
|
||||||
renewed_expire_time = prepare_renewed_expire_time
|
renewed_expire_time = prepare_renewed_expire_time
|
||||||
in_transaction_with_retries do
|
in_transaction_with_retries do
|
||||||
check_balance
|
check_balance
|
||||||
success = domain.renew(renewed_expire_time: renewed_expire_time,
|
success = domain.renew(renewed_expire_time, period, unit)
|
||||||
period: period,
|
|
||||||
unit: unit)
|
|
||||||
if success
|
if success
|
||||||
check_balance
|
check_balance
|
||||||
reduce_balance
|
reduce_balance
|
||||||
|
@ -39,11 +37,11 @@ module Domains
|
||||||
price: domain_pricelist)
|
price: domain_pricelist)
|
||||||
end
|
end
|
||||||
|
|
||||||
def in_transaction_with_retries
|
def in_transaction_with_retries(&block)
|
||||||
if Rails.env.test?
|
if Rails.env.test?
|
||||||
yield
|
yield
|
||||||
else
|
else
|
||||||
transaction_wrapper { yield }
|
transaction_wrapper(&block)
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::StatementInvalid => e
|
rescue ActiveRecord::StatementInvalid => e
|
||||||
log_error e
|
log_error e
|
||||||
|
@ -72,8 +70,9 @@ module Domains
|
||||||
max_reg_time = 11.years.from_now
|
max_reg_time = 11.years.from_now
|
||||||
|
|
||||||
if renewed_expire_time >= max_reg_time
|
if renewed_expire_time >= max_reg_time
|
||||||
domain.add_epp_error('2105', nil, nil, I18n.t('epp.domains.object_is_not_eligible_for_renewal',
|
domain.add_epp_error('2105', nil, nil,
|
||||||
max_date: max_reg_time.to_date.to_s(:db)))
|
I18n.t('epp.domains.object_is_not_eligible_for_renewal',
|
||||||
|
max_date: max_reg_time.to_date.to_s(:db)))
|
||||||
end
|
end
|
||||||
renewed_expire_time
|
renewed_expire_time
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ module Domains
|
||||||
class Base < ActiveInteraction::Base
|
class Base < ActiveInteraction::Base
|
||||||
def to_stdout(message)
|
def to_stdout(message)
|
||||||
time = Time.zone.now.utc
|
time = Time.zone.now.utc
|
||||||
STDOUT << "#{time} - #{message}\n" unless Rails.env.test?
|
$stdout << "#{time} - #{message}\n" unless Rails.env.test?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,11 +3,11 @@ module Domains
|
||||||
class Base < ActiveInteraction::Base
|
class Base < ActiveInteraction::Base
|
||||||
def to_stdout(message)
|
def to_stdout(message)
|
||||||
time = Time.zone.now.utc
|
time = Time.zone.now.utc
|
||||||
STDOUT << "#{time} - #{message}\n" unless Rails.env.test?
|
$stdout << "#{time} - #{message}\n" unless Rails.env.test?
|
||||||
end
|
end
|
||||||
|
|
||||||
def logger
|
def logger
|
||||||
@logger ||= Logger.new(Rails.root.join('log', 'domain_expire_period.log'))
|
@logger ||= Logger.new(Rails.root.join('log/domain_expire_period.log'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ module Domains
|
||||||
class Base < ActiveInteraction::Base
|
class Base < ActiveInteraction::Base
|
||||||
def to_stdout(message)
|
def to_stdout(message)
|
||||||
time = Time.zone.now.utc
|
time = Time.zone.now.utc
|
||||||
STDOUT << "#{time} - #{message}\n" unless Rails.env.test?
|
$stdout << "#{time} - #{message}\n" unless Rails.env.test?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Domains
|
||||||
count = 0
|
count = 0
|
||||||
expired_pending_domains.each do |domain|
|
expired_pending_domains.each do |domain|
|
||||||
log_error(domain) && next unless need_to_be_cleared?(domain)
|
log_error(domain) && next unless need_to_be_cleared?(domain)
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
Domains::ExpiredPendings::ProcessClean.run(domain: domain)
|
Domains::ExpiredPendings::ProcessClean.run(domain: domain)
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,7 +37,7 @@ module Domains
|
||||||
def added_additional_email_into_notes(domain)
|
def added_additional_email_into_notes(domain)
|
||||||
return if domain.status_notes[DomainStatus::FORCE_DELETE].include? email
|
return if domain.status_notes[DomainStatus::FORCE_DELETE].include? email
|
||||||
|
|
||||||
domain.status_notes[DomainStatus::FORCE_DELETE].concat(' ' + email)
|
domain.status_notes[DomainStatus::FORCE_DELETE].concat(" #{email}")
|
||||||
domain.save(validate: false)
|
domain.save(validate: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ module Domains
|
||||||
class Base < ActiveInteraction::Base
|
class Base < ActiveInteraction::Base
|
||||||
def to_stdout(message)
|
def to_stdout(message)
|
||||||
time = Time.zone.now.utc
|
time = Time.zone.now.utc
|
||||||
STDOUT << "#{time} - #{message}\n" unless Rails.env.test?
|
$stdout << "#{time} - #{message}\n" unless Rails.env.test?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ module Domains
|
||||||
private
|
private
|
||||||
|
|
||||||
def user_id
|
def user_id
|
||||||
@user_id ||= domain.pending_json.dig('current_user_id')
|
@user_id ||= domain.pending_json['current_user_id']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ class CsyncJob < ApplicationJob
|
||||||
@store = {}
|
@store = {}
|
||||||
@input_store = { secure: {}, insecure: {} }
|
@input_store = { secure: {}, insecure: {} }
|
||||||
@results = {}
|
@results = {}
|
||||||
@logger = Rails.env.test? ? Rails.logger : Logger.new(STDOUT)
|
@logger = Rails.env.test? ? Rails.logger : Logger.new($stdout)
|
||||||
generate ? generate_scanner_input : process_scanner_results
|
generate ? generate_scanner_input : process_scanner_results
|
||||||
|
|
||||||
@logger.info 'CsyncJob: Finished.'
|
@logger.info 'CsyncJob: Finished.'
|
||||||
|
@ -37,9 +37,7 @@ class CsyncJob < ApplicationJob
|
||||||
def unqualification_reason(nss, key, result_types)
|
def unqualification_reason(nss, key, result_types)
|
||||||
return 'no CDNSKEY / nameservers reported different CDNSKEYs' unless key
|
return 'no CDNSKEY / nameservers reported different CDNSKEYs' unless key
|
||||||
|
|
||||||
if result_types.include? 'untrustworthy'
|
return 'current DNSSEC config invalid (required for rollover/delete)' if result_types.include? 'untrustworthy'
|
||||||
return 'current DNSSEC config invalid (required for rollover/delete)'
|
|
||||||
end
|
|
||||||
|
|
||||||
"Nameserver(s) not reachable / invalid data (#{result_types.join(', ')})" unless nss
|
"Nameserver(s) not reachable / invalid data (#{result_types.join(', ')})" unless nss
|
||||||
end
|
end
|
||||||
|
@ -47,7 +45,7 @@ class CsyncJob < ApplicationJob
|
||||||
def process_scanner_results
|
def process_scanner_results
|
||||||
scanner_results
|
scanner_results
|
||||||
|
|
||||||
@results.keys.each do |domain|
|
@results.each_key do |domain|
|
||||||
begin
|
begin
|
||||||
next unless qualified_for_monitoring?(domain, @results[domain])
|
next unless qualified_for_monitoring?(domain, @results[domain])
|
||||||
|
|
||||||
|
@ -121,7 +119,7 @@ class CsyncJob < ApplicationJob
|
||||||
end
|
end
|
||||||
|
|
||||||
out_file.close
|
out_file.close
|
||||||
@logger.info 'CsyncJob Generate: Finished writing output to ' + ENV['cdns_scanner_input_file']
|
@logger.info "CsyncJob Generate: Finished writing output to #{ENV['cdns_scanner_input_file']}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_directory
|
def check_directory
|
||||||
|
@ -134,7 +132,7 @@ class CsyncJob < ApplicationJob
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_input_lines(out_file, state)
|
def create_input_lines(out_file, state)
|
||||||
@input_store[state].keys.each do |nameserver|
|
@input_store[state].each_key do |nameserver|
|
||||||
domains = @input_store[state][nameserver].join(' ')
|
domains = @input_store[state][nameserver].join(' ')
|
||||||
next unless domains.length.positive?
|
next unless domains.length.positive?
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,7 @@ class DirectoInvoiceForwardJob < ApplicationJob
|
||||||
end
|
end
|
||||||
|
|
||||||
def assign_monthly_numbers
|
def assign_monthly_numbers
|
||||||
if directo_counter_exceedable?(@client.invoices.count)
|
raise 'Directo Counter is going to be out of period!' if directo_counter_exceedable?(@client.invoices.count)
|
||||||
raise 'Directo Counter is going to be out of period!'
|
|
||||||
end
|
|
||||||
|
|
||||||
min_directo = Setting.directo_monthly_number_min.presence.try(:to_i)
|
min_directo = Setting.directo_monthly_number_min.presence.try(:to_i)
|
||||||
directo_number = [Setting.directo_monthly_number_last.presence.try(:to_i),
|
directo_number = [Setting.directo_monthly_number_last.presence.try(:to_i),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class DisputeStatusUpdateJob < ApplicationJob
|
class DisputeStatusUpdateJob < ApplicationJob
|
||||||
def perform(logger: Logger.new(STDOUT))
|
def perform(logger: Logger.new($stdout))
|
||||||
@logger = logger
|
@logger = logger
|
||||||
|
|
||||||
@backlog = { 'activated': 0, 'closed': 0, 'activate_fail': [], 'close_fail': [] }
|
@backlog = { 'activated': 0, 'closed': 0, 'activate_fail': [], 'close_fail': [] }
|
||||||
|
|
|
@ -12,9 +12,9 @@ class DomainExpireEmailJob < ApplicationJob
|
||||||
}
|
}
|
||||||
|
|
||||||
if domain.force_delete_scheduled?
|
if domain.force_delete_scheduled?
|
||||||
DomainExpireMailer.expired_soft(attrs).deliver_now
|
DomainExpireMailer.expired_soft(**attrs).deliver_now
|
||||||
else
|
else
|
||||||
DomainExpireMailer.expired(attrs).deliver_now
|
DomainExpireMailer.expired(**attrs).deliver_now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,6 +31,6 @@ class MigrateBeforeForceDeleteStatusesJob < ApplicationJob
|
||||||
end
|
end
|
||||||
|
|
||||||
def logger
|
def logger
|
||||||
@logger ||= Logger.new(Rails.root.join('log', 'migrate_before_force_delete_statuses.log'))
|
@logger ||= Logger.new(Rails.root.join('log/migrate_before_force_delete_statuses.log'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,6 +31,6 @@ class MigrateStatusesToDomainHistoryJob < ApplicationJob
|
||||||
end
|
end
|
||||||
|
|
||||||
def logger
|
def logger
|
||||||
@logger ||= Logger.new(Rails.root.join('log', 'migrate_statuses_to_domain_history.log'))
|
@logger ||= Logger.new(Rails.root.join('log/migrate_statuses_to_domain_history.log'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,8 @@ class RegistrantChangeConfirmEmailJob < ApplicationJob
|
||||||
private
|
private
|
||||||
|
|
||||||
def log(domain)
|
def log(domain)
|
||||||
message = "Send RegistrantChangeMailer#confirm email for domain #{domain.name} (##{domain.id}) to #{domain.registrant.email}"
|
message = 'Send RegistrantChangeMailer#confirm email for domain '\
|
||||||
|
"#{domain.name} (##{domain.id}) to #{domain.registrant.email}"
|
||||||
logger.info(message)
|
logger.info(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ class RegistrantChangeNoticeEmailJob < ApplicationJob
|
||||||
private
|
private
|
||||||
|
|
||||||
def log(domain, new_registrant)
|
def log(domain, new_registrant)
|
||||||
message = "Send RegistrantChangeMailer#notice email for domain #{domain.name} (##{domain.id}) to #{new_registrant.email}"
|
message = 'Send RegistrantChangeMailer#notice email for domain '\
|
||||||
|
"#{domain.name} (##{domain.id}) to #{new_registrant.email}"
|
||||||
logger.info(message)
|
logger.info(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class SendEInvoiceJob < ApplicationJob
|
class SendEInvoiceJob < ApplicationJob
|
||||||
discard_on HTTPClient::TimeoutError
|
discard_on HTTPClient::TimeoutError
|
||||||
|
|
||||||
def perform(invoice_id, payable = true)
|
def perform(invoice_id, payable: true)
|
||||||
logger.info "Started to process e-invoice for invoice_id #{invoice_id}"
|
logger.info "Started to process e-invoice for invoice_id #{invoice_id}"
|
||||||
invoice = Invoice.find_by(id: invoice_id)
|
invoice = Invoice.find_by(id: invoice_id)
|
||||||
return unless need_to_process_invoice?(invoice: invoice, payable: payable)
|
return unless need_to_process_invoice?(invoice: invoice, payable: payable)
|
||||||
|
|
|
@ -26,7 +26,7 @@ class VerifyEmailsJob < ApplicationJob
|
||||||
end
|
end
|
||||||
|
|
||||||
def logger
|
def logger
|
||||||
@logger ||= Logger.new(Rails.root.join('log', 'email_verification.log'))
|
@logger ||= Logger.new(Rails.root.join('log/email_verification.log'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def log_success(verification)
|
def log_success(verification)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class ToStdout
|
class ToStdout
|
||||||
def self.msg(message)
|
def self.msg(message)
|
||||||
time = Time.zone.now.utc
|
time = Time.zone.now.utc
|
||||||
STDOUT << "#{time} - #{message}\n" unless Rails.env.test?
|
$stdout << "#{time} - #{message}\n" unless Rails.env.test?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ApplicationMailer < ActionMailer::Base
|
class ApplicationMailer < ActionMailer::Base
|
||||||
append_view_path Rails.root.join('app', 'views', 'mailers')
|
append_view_path Rails.root.join('app/views/mailers')
|
||||||
layout 'mailer'
|
layout 'mailer'
|
||||||
|
|
||||||
def registrant_confirm_url(domain:, method:)
|
def registrant_confirm_url(domain:, method:)
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Ability
|
||||||
can(:delete, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
|
can(:delete, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
|
||||||
|
|
||||||
# Epp::Contact
|
# Epp::Contact
|
||||||
can(:info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || pw.blank? ? true : c.auth_info == pw }
|
can(:info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || pw.blank? ? true : c.auth_info == pw }
|
||||||
can(:view_full_info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
|
can(:view_full_info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
|
||||||
can(:check, Epp::Contact)
|
can(:check, Epp::Contact)
|
||||||
can(:create, Epp::Contact)
|
can(:create, Epp::Contact)
|
||||||
|
|
|
@ -39,4 +39,3 @@ class AccountActivity < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
module Actions
|
module Actions
|
||||||
class ContactDelete
|
class ContactDelete
|
||||||
attr_reader :contact
|
attr_reader :contact, :new_attributes, :legal_document, :ident, :user
|
||||||
attr_reader :new_attributes
|
|
||||||
attr_reader :legal_document
|
|
||||||
attr_reader :ident
|
|
||||||
attr_reader :user
|
|
||||||
|
|
||||||
def initialize(contact, legal_document = nil)
|
def initialize(contact, legal_document = nil)
|
||||||
@legal_document = legal_document
|
@legal_document = legal_document
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
module Actions
|
module Actions
|
||||||
class ContactUpdate
|
class ContactUpdate
|
||||||
attr_reader :contact
|
attr_reader :contact, :new_attributes, :legal_document, :ident, :user
|
||||||
attr_reader :new_attributes
|
|
||||||
attr_reader :legal_document
|
|
||||||
attr_reader :ident
|
|
||||||
attr_reader :user
|
|
||||||
|
|
||||||
def initialize(contact, new_attributes, legal_document, ident, user)
|
def initialize(contact, new_attributes, legal_document, ident, user)
|
||||||
@contact = contact
|
@contact = contact
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
module Actions
|
module Actions
|
||||||
class DomainTransfer
|
class DomainTransfer
|
||||||
attr_reader :domain
|
attr_reader :domain, :transfer_code, :legal_document, :ident, :user
|
||||||
attr_reader :transfer_code
|
|
||||||
attr_reader :legal_document
|
|
||||||
attr_reader :ident
|
|
||||||
attr_reader :user
|
|
||||||
|
|
||||||
def initialize(domain, transfer_code, user)
|
def initialize(domain, transfer_code, user)
|
||||||
@domain = domain
|
@domain = domain
|
||||||
|
|
|
@ -44,6 +44,7 @@ class ApiUser < User
|
||||||
after_initialize :set_defaults
|
after_initialize :set_defaults
|
||||||
def set_defaults
|
def set_defaults
|
||||||
return unless new_record?
|
return unless new_record?
|
||||||
|
|
||||||
self.active = true unless saved_change_to_active?
|
self.active = true unless saved_change_to_active?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ class ApiUser < User
|
||||||
end
|
end
|
||||||
|
|
||||||
def linked_with?(another_api_user)
|
def linked_with?(another_api_user)
|
||||||
another_api_user.identity_code == self.identity_code
|
another_api_user.identity_code == identity_code
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -2,8 +2,7 @@ module BalanceAutoReloadTypes
|
||||||
class Threshold
|
class Threshold
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
attr_accessor :amount
|
attr_accessor :amount, :threshold
|
||||||
attr_accessor :threshold
|
|
||||||
|
|
||||||
validates :amount, numericality: { greater_than_or_equal_to: :min_amount }
|
validates :amount, numericality: { greater_than_or_equal_to: :min_amount }
|
||||||
validates :threshold, numericality: { greater_than_or_equal_to: 0 }
|
validates :threshold, numericality: { greater_than_or_equal_to: 0 }
|
||||||
|
|
|
@ -9,7 +9,8 @@ module Billing
|
||||||
|
|
||||||
validates :price, :valid_from, :operation_category, :duration, presence: true
|
validates :price, :valid_from, :operation_category, :duration, presence: true
|
||||||
validates :operation_category, inclusion: { in: Proc.new { |price| price.class.operation_categories } }
|
validates :operation_category, inclusion: { in: Proc.new { |price| price.class.operation_categories } }
|
||||||
validates :duration, inclusion: { in: Proc.new { |price| price.class.durations.values } }, if: :should_validate_duration?
|
validates :duration, inclusion: { in: Proc.new { |price| price.class.durations.values } },
|
||||||
|
if: :should_validate_duration?
|
||||||
|
|
||||||
alias_attribute :effect_time, :valid_from
|
alias_attribute :effect_time, :valid_from
|
||||||
alias_attribute :expire_time, :valid_to
|
alias_attribute :expire_time, :valid_to
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Billing
|
module Billing
|
||||||
class ReferenceNo
|
class ReferenceNo
|
||||||
REGEXP = /\A\d{2,20}\z/.freeze
|
REGEXP = /\A\d{2,20}\z/
|
||||||
MULTI_REGEXP = /(\d{2,20})/.freeze
|
MULTI_REGEXP = /(\d{2,20})/
|
||||||
|
|
||||||
def self.generate
|
def self.generate
|
||||||
base = Base.generate
|
base = Base.generate
|
||||||
|
|
|
@ -8,7 +8,7 @@ class BlockedDomain < ApplicationRecord
|
||||||
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def by_domain name
|
def by_domain(name)
|
||||||
where(name: name)
|
where(name: name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -29,7 +29,7 @@ class BlockedDomain < ApplicationRecord
|
||||||
|
|
||||||
def generate_json
|
def generate_json
|
||||||
h = HashWithIndifferentAccess.new
|
h = HashWithIndifferentAccess.new
|
||||||
h[:name] = self.name
|
h[:name] = name
|
||||||
h[:status] = ['Blocked']
|
h[:status] = ['Blocked']
|
||||||
h
|
h
|
||||||
end
|
end
|
||||||
|
|
|
@ -67,9 +67,7 @@ class Certificate < ApplicationRecord
|
||||||
|
|
||||||
@cached_status = SIGNED
|
@cached_status = SIGNED
|
||||||
|
|
||||||
if parsed_crt.not_before > Time.zone.now.utc && parsed_crt.not_after < Time.zone.now.utc
|
@cached_status = EXPIRED if parsed_crt.not_before > Time.zone.now.utc && parsed_crt.not_after < Time.zone.now.utc
|
||||||
@cached_status = EXPIRED
|
|
||||||
end
|
|
||||||
|
|
||||||
crl = OpenSSL::X509::CRL.new(File.open("#{ENV['crl_dir']}/crl.pem").read)
|
crl = OpenSSL::X509::CRL.new(File.open("#{ENV['crl_dir']}/crl.pem").read)
|
||||||
return @cached_status unless crl.revoked.map(&:serial).include?(parsed_crt.serial)
|
return @cached_status unless crl.revoked.map(&:serial).include?(parsed_crt.serial)
|
||||||
|
@ -83,10 +81,11 @@ class Certificate < ApplicationRecord
|
||||||
csr_file.rewind
|
csr_file.rewind
|
||||||
|
|
||||||
crt_file = Tempfile.new('client_crt')
|
crt_file = Tempfile.new('client_crt')
|
||||||
_out, err, _st = Open3.capture3("openssl ca -config #{ENV['openssl_config_path']} -keyfile #{ENV['ca_key_path']} \
|
_out, err, _st = Open3.capture3('openssl', 'ca', '-config', ENV['openssl_config_path'],
|
||||||
-cert #{ENV['ca_cert_path']} \
|
'-keyfile', ENV['ca_key_path'], '-cert', ENV['ca_cert_path'],
|
||||||
-extensions usr_cert -notext -md sha256 \
|
'-extensions', 'usr_cert', '-notext', '-md sha256',
|
||||||
-in #{csr_file.path} -out #{crt_file.path} -key '#{ENV['ca_key_password']}' -batch")
|
'-in', csr_file.path, '-out', crt_file.path, '-key', ENV['ca_key_password'],
|
||||||
|
'-batch')
|
||||||
|
|
||||||
if err.match?(/Data Base Updated/)
|
if err.match?(/Data Base Updated/)
|
||||||
crt_file.rewind
|
crt_file.rewind
|
||||||
|
@ -103,7 +102,7 @@ class Certificate < ApplicationRecord
|
||||||
end
|
end
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
puts "Certificate sign issue: #{err.inspect}" if Rails.env.test?
|
puts "Certificate sign issue: #{err.inspect}" if Rails.env.test?
|
||||||
return false
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -112,7 +111,8 @@ class Certificate < ApplicationRecord
|
||||||
crt_file.write(crt)
|
crt_file.write(crt)
|
||||||
crt_file.rewind
|
crt_file.rewind
|
||||||
|
|
||||||
_out, err, _st = Open3.capture3("openssl ca -config #{ENV['openssl_config_path']} -keyfile #{ENV['ca_key_path']} \
|
_out, err, _st = Open3.capture3("openssl ca -config #{ENV['openssl_config_path']} \
|
||||||
|
-keyfile #{ENV['ca_key_path']} \
|
||||||
-cert #{ENV['ca_cert_path']} \
|
-cert #{ENV['ca_cert_path']} \
|
||||||
-revoke #{crt_file.path} -key '#{ENV['ca_key_password']}' -batch")
|
-revoke #{crt_file.path} -key '#{ENV['ca_key_password']}' -batch")
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ class Certificate < ApplicationRecord
|
||||||
class << self
|
class << self
|
||||||
def tostdout(message)
|
def tostdout(message)
|
||||||
time = Time.zone.now.utc
|
time = Time.zone.now.utc
|
||||||
STDOUT << "#{time} - #{message}\n" unless Rails.env.test?
|
$stdout << "#{time} - #{message}\n" unless Rails.env.test?
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_crl
|
def update_crl
|
||||||
|
|
|
@ -16,9 +16,7 @@ module Contact::Archivable
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive(verified: false, notify: true, extra_log: false)
|
def archive(verified: false, notify: true, extra_log: false)
|
||||||
unless verified
|
raise 'Contact cannot be archived' if !verified && !archivable?(post: true)
|
||||||
raise 'Contact cannot be archived' unless archivable?(post: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
notify_registrar_about_archivation if notify
|
notify_registrar_about_archivation if notify
|
||||||
write_to_registrar_log if extra_log
|
write_to_registrar_log if extra_log
|
||||||
|
@ -35,9 +33,7 @@ module Contact::Archivable
|
||||||
end
|
end
|
||||||
|
|
||||||
def inactive?
|
def inactive?
|
||||||
if Version::DomainVersion.contact_unlinked_more_than?(contact_id: id, period: inactivity_period)
|
return true if Version::DomainVersion.contact_unlinked_more_than?(contact_id: id, period: inactivity_period)
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
Version::DomainVersion.was_contact_linked?(id) ? false : created_at <= inactivity_period.ago
|
Version::DomainVersion.was_contact_linked?(id) ? false : created_at <= inactivity_period.ago
|
||||||
end
|
end
|
||||||
|
@ -47,7 +43,7 @@ module Contact::Archivable
|
||||||
end
|
end
|
||||||
|
|
||||||
def log(msg)
|
def log(msg)
|
||||||
@log ||= Logger.new(STDOUT)
|
@log ||= Logger.new($stdout)
|
||||||
@log.info(msg)
|
@log.info(msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,7 @@ module Domain::Expirable
|
||||||
def expirable?
|
def expirable?
|
||||||
return false if expire_time > Time.zone.now
|
return false if expire_time > Time.zone.now
|
||||||
|
|
||||||
if statuses.include?(DomainStatus::EXPIRED) && outzone_at.present? && delete_date.present?
|
return false if statuses.include?(DomainStatus::EXPIRED) && outzone_at.present? && delete_date.present?
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,9 @@ module Domain::ForceDelete
|
||||||
DomainStatus::SERVER_RENEW_PROHIBITED,
|
DomainStatus::SERVER_RENEW_PROHIBITED,
|
||||||
DomainStatus::SERVER_TRANSFER_PROHIBITED].freeze
|
DomainStatus::SERVER_TRANSFER_PROHIBITED].freeze
|
||||||
|
|
||||||
|
HOLD_STATUSES = [DomainStatus::SERVER_HOLD,
|
||||||
|
DomainStatus::CLIENT_HOLD].freeze
|
||||||
|
|
||||||
included do
|
included do
|
||||||
store_accessor :force_delete_data,
|
store_accessor :force_delete_data,
|
||||||
:force_delete_type,
|
:force_delete_type,
|
||||||
|
@ -15,11 +18,6 @@ module Domain::ForceDelete
|
||||||
lambda {
|
lambda {
|
||||||
where("(force_delete_data->>'contact_notification_sent_date') is null")
|
where("(force_delete_data->>'contact_notification_sent_date') is null")
|
||||||
}
|
}
|
||||||
|
|
||||||
HOLD_STATUSES = [
|
|
||||||
DomainStatus::SERVER_HOLD,
|
|
||||||
DomainStatus::CLIENT_HOLD,
|
|
||||||
].freeze
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
|
|
|
@ -121,7 +121,7 @@ module EppErrors
|
||||||
err = { code: code, msg: t }
|
err = { code: code, msg: t }
|
||||||
val = check_for_status(code, obj, val)
|
val = check_for_status(code, obj, val)
|
||||||
err[:value] = { val: val, obj: obj } if val.present?
|
err[:value] = { val: val, obj: obj } if val.present?
|
||||||
self.errors.add(:epp_errors, err)
|
errors.add(:epp_errors, **err)
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_for_status(code, obj, val)
|
def check_for_status(code, obj, val)
|
||||||
|
|
|
@ -68,13 +68,10 @@ module Registrar::BookKeeping
|
||||||
|
|
||||||
def finalize_invoice_line(line, price:, activity:, duration:)
|
def finalize_invoice_line(line, price:, activity:, duration:)
|
||||||
yearly = price.duration.in_years.to_i >= 1
|
yearly = price.duration.in_years.to_i >= 1
|
||||||
|
|
||||||
line['price'] = yearly ? (price.price.amount / price.duration.in_years.to_i) : price.price.amount
|
line['price'] = yearly ? (price.price.amount / price.duration.in_years.to_i) : price.price.amount
|
||||||
line['description'] = description_in_language(price: price, yearly: yearly)
|
line['description'] = description_in_language(price: price, yearly: yearly)
|
||||||
|
|
||||||
if duration.present?
|
add_product_timeframe(line: line, activity: activity, duration: duration) if duration.present? && (duration > 1)
|
||||||
add_product_timeframe(line: line, activity: activity, duration: duration) if duration > 1
|
|
||||||
end
|
|
||||||
|
|
||||||
line
|
line
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,26 +5,25 @@ module UserEvents
|
||||||
# EPP requires a server defined creator ID, which should be registrar code if we have one
|
# EPP requires a server defined creator ID, which should be registrar code if we have one
|
||||||
def cr_id
|
def cr_id
|
||||||
# try this, rebuild user for registrar before searching history? really?
|
# try this, rebuild user for registrar before searching history? really?
|
||||||
registrar = self.creator.try(:registrar)
|
registrar = creator.try(:registrar)
|
||||||
if registrar.present? # Did creator return a kind of User that has a registrar?
|
if registrar.present? # Did creator return a kind of User that has a registrar?
|
||||||
registrar.code
|
registrar.code
|
||||||
else
|
else
|
||||||
if self.versions.first.try(:object).nil?
|
if versions.first.try(:object).nil?
|
||||||
changes = self.versions.first.try(:object_changes)
|
changes = versions.first.try(:object_changes)
|
||||||
cr_registrar_id = changes['registrar_id'].second if changes.present?
|
cr_registrar_id = changes['registrar_id'].second if changes.present?
|
||||||
else
|
else
|
||||||
# untested, expected never to execute
|
# untested, expected never to execute
|
||||||
cr_registrar_id = self.versions.first.object['registrar_id']
|
cr_registrar_id = versions.first.object['registrar_id']
|
||||||
end
|
end
|
||||||
|
|
||||||
if cr_registrar_id.present?
|
if cr_registrar_id.present?
|
||||||
Registrar.find(cr_registrar_id).code
|
Registrar.find(cr_registrar_id).code
|
||||||
else
|
else
|
||||||
# cr_id optional for domain, but required for contact; but we want something here anyway
|
# cr_id optional for domain, but required for contact; but we want something here anyway
|
||||||
self.creator_str || self.registrar.code # Fallback
|
creator_str || self.registrar.code # Fallback
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Contact < ApplicationRecord
|
||||||
include Contact::Archivable
|
include Contact::Archivable
|
||||||
include EmailVerifable
|
include EmailVerifable
|
||||||
|
|
||||||
belongs_to :original, class_name: self.name
|
belongs_to :original, class_name: 'Contact'
|
||||||
belongs_to :registrar, required: true
|
belongs_to :registrar, required: true
|
||||||
has_many :domain_contacts
|
has_many :domain_contacts
|
||||||
has_many :domains, through: :domain_contacts
|
has_many :domains, through: :domain_contacts
|
||||||
|
@ -20,6 +20,7 @@ class Contact < ApplicationRecord
|
||||||
has_many :actions, dependent: :destroy
|
has_many :actions, dependent: :destroy
|
||||||
|
|
||||||
attr_accessor :legal_document_id
|
attr_accessor :legal_document_id
|
||||||
|
|
||||||
alias_attribute :kind, :ident_type
|
alias_attribute :kind, :ident_type
|
||||||
alias_attribute :copy_from_id, :original_id # Old attribute name; for PaperTrail
|
alias_attribute :copy_from_id, :original_id # Old attribute name; for PaperTrail
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ class Contact < ApplicationRecord
|
||||||
}
|
}
|
||||||
|
|
||||||
NAME_REGEXP = /([\u00A1-\u00B3\u00B5-\u00BF\u0021-\u0026\u0028-\u002C\u003A-\u0040]|
|
NAME_REGEXP = /([\u00A1-\u00B3\u00B5-\u00BF\u0021-\u0026\u0028-\u002C\u003A-\u0040]|
|
||||||
[\u005B-\u005F\u007B-\u007E\u2040-\u206F\u20A0-\u20BF\u2100-\u218F])/x.freeze
|
[\u005B-\u005F\u007B-\u007E\u2040-\u206F\u20A0-\u20BF\u2100-\u218F])/x
|
||||||
|
|
||||||
validates :name, :email, presence: true
|
validates :name, :email, presence: true
|
||||||
validates :name, format: { without: NAME_REGEXP, message: :invalid }, if: -> { priv? }
|
validates :name, format: { without: NAME_REGEXP, message: :invalid }, if: -> { priv? }
|
||||||
|
@ -43,9 +44,9 @@ class Contact < ApplicationRecord
|
||||||
validate :correct_email_format, if: proc { |c| c.will_save_change_to_email? }
|
validate :correct_email_format, if: proc { |c| c.will_save_change_to_email? }
|
||||||
|
|
||||||
validates :code,
|
validates :code,
|
||||||
uniqueness: { message: :epp_id_taken },
|
uniqueness: { message: :epp_id_taken },
|
||||||
format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid },
|
format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid },
|
||||||
length: { maximum: 100, message: :too_long_contact_code }
|
length: { maximum: 100, message: :too_long_contact_code }
|
||||||
validates_associated :identifier
|
validates_associated :identifier
|
||||||
|
|
||||||
validate :validate_html
|
validate :validate_html
|
||||||
|
@ -164,7 +165,9 @@ class Contact < ApplicationRecord
|
||||||
scope = all
|
scope = all
|
||||||
|
|
||||||
# all contacts has state ok, so no need to filter by it
|
# all contacts has state ok, so no need to filter by it
|
||||||
scope = scope.where("NOT contacts.statuses && ?::varchar[]", "{#{(STATUSES - [OK, LINKED]).join(',')}}") if states.delete(OK)
|
if states.delete(OK)
|
||||||
|
scope = scope.where("NOT contacts.statuses && ?::varchar[]", "{#{(STATUSES - [OK, LINKED]).join(',')}}")
|
||||||
|
end
|
||||||
scope = scope.linked if states.delete(LINKED)
|
scope = scope.linked if states.delete(LINKED)
|
||||||
scope = scope.where("contacts.statuses @> ?::varchar[]", "{#{states.join(',')}}") if states.any?
|
scope = scope.where("contacts.statuses @> ?::varchar[]", "{#{states.join(',')}}") if states.any?
|
||||||
scope
|
scope
|
||||||
|
@ -385,7 +388,6 @@ class Contact < ApplicationRecord
|
||||||
self.email = email.to_s.strip
|
self.email = email.to_s.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# what we can do load firstly by registrant
|
# what we can do load firstly by registrant
|
||||||
# if total is smaller than needed, the load more
|
# if total is smaller than needed, the load more
|
||||||
# we also need to sort by valid_to
|
# we also need to sort by valid_to
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
class Contact
|
class Contact
|
||||||
class Address
|
class Address
|
||||||
attr_reader :street
|
attr_reader :street, :zip, :city, :state, :country_code
|
||||||
attr_reader :zip
|
|
||||||
attr_reader :city
|
|
||||||
attr_reader :state
|
|
||||||
attr_reader :country_code
|
|
||||||
|
|
||||||
def initialize(street, zip, city, state, country_code)
|
def initialize(street, zip, city, state, country_code)
|
||||||
@street = street
|
@street = street
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
class Contact::Ident
|
class Contact::Ident
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
attr_accessor :code
|
attr_accessor :code, :type, :country_code
|
||||||
attr_accessor :type
|
|
||||||
attr_accessor :country_code
|
|
||||||
|
|
||||||
validates :code, presence: true
|
validates :code, presence: true
|
||||||
validates :code, national_id: true, if: :national_id?
|
validates :code, national_id: true, if: :national_id?
|
||||||
|
|
|
@ -122,7 +122,7 @@ class CsyncRecord < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.log
|
def self.log
|
||||||
Rails.env.test? ? logger : Logger.new(STDOUT)
|
Rails.env.test? ? logger : Logger.new($stdout)
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_csync_action
|
def validate_csync_action
|
||||||
|
|
|
@ -34,10 +34,10 @@ module Depp
|
||||||
org_name: params[:org_name],
|
org_name: params[:org_name],
|
||||||
|
|
||||||
# address
|
# address
|
||||||
street: params[:street],
|
street: params[:street],
|
||||||
city: params[:city],
|
city: params[:city],
|
||||||
zip: params[:zip],
|
zip: params[:zip],
|
||||||
state: params[:state],
|
state: params[:state],
|
||||||
country_code: params[:country_code]
|
country_code: params[:country_code]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -61,10 +61,10 @@ module Depp
|
||||||
org_name: res.css('postalInfo org').text,
|
org_name: res.css('postalInfo org').text,
|
||||||
|
|
||||||
# address
|
# address
|
||||||
street: res.css('postalInfo addr street').text,
|
street: res.css('postalInfo addr street').text,
|
||||||
city: res.css('postalInfo addr city').text,
|
city: res.css('postalInfo addr city').text,
|
||||||
zip: res.css('postalInfo addr pc').text,
|
zip: res.css('postalInfo addr pc').text,
|
||||||
state: res.css('postalInfo addr sp').text,
|
state: res.css('postalInfo addr sp').text,
|
||||||
country_code: res.css('postalInfo addr cc').text,
|
country_code: res.css('postalInfo addr cc').text,
|
||||||
|
|
||||||
# authInfo
|
# authInfo
|
||||||
|
@ -116,10 +116,11 @@ module Depp
|
||||||
xml.with_indifferent_access
|
xml.with_indifferent_access
|
||||||
end
|
end
|
||||||
|
|
||||||
def extract_disclosure_hash(cpd) # cpd = contact_params[:disclose]
|
# cpd = contact_params[:disclose]
|
||||||
|
def extract_disclosure_hash(cpd)
|
||||||
return {} unless cpd
|
return {} unless cpd
|
||||||
cpd = cpd.delete_if { |k, v| v if v != '1' && k == 'flag' }
|
|
||||||
cpd
|
cpd.delete_if { |k, v| v if v != '1' && k == 'flag' }
|
||||||
end
|
end
|
||||||
|
|
||||||
def extract_info_disclosure(data)
|
def extract_info_disclosure(data)
|
||||||
|
@ -147,7 +148,7 @@ module Depp
|
||||||
id: { value: code },
|
id: { value: code },
|
||||||
postalInfo: {
|
postalInfo: {
|
||||||
name: { value: name },
|
name: { value: name },
|
||||||
org: { value: org_name },
|
org: { value: org_name },
|
||||||
},
|
},
|
||||||
voice: { value: phone },
|
voice: { value: phone },
|
||||||
email: { value: email }
|
email: { value: email }
|
||||||
|
@ -195,7 +196,7 @@ module Depp
|
||||||
chg: {
|
chg: {
|
||||||
postalInfo: {
|
postalInfo: {
|
||||||
name: { value: name },
|
name: { value: name },
|
||||||
org: { value: org_name },
|
org: { value: org_name },
|
||||||
},
|
},
|
||||||
voice: { value: phone },
|
voice: { value: phone },
|
||||||
email: { value: email },
|
email: { value: email },
|
||||||
|
@ -240,7 +241,7 @@ module Depp
|
||||||
ident = ident_xml[:_anonymus].try(:first)
|
ident = ident_xml[:_anonymus].try(:first)
|
||||||
when :update
|
when :update
|
||||||
# detect if any ident has changed, nb! ident and self.ident is not always same
|
# detect if any ident has changed, nb! ident and self.ident is not always same
|
||||||
if !(ident == self.ident && ident == self.ident_type && ident_country_code == self.ident_country_code)
|
unless ident == self.ident && ident == ident_type && ident_country_code == self.ident_country_code
|
||||||
ident = ident_xml[:_anonymus].try(:first)
|
ident = ident_xml[:_anonymus].try(:first)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,11 +109,9 @@ module Depp
|
||||||
period = params[:period].to_i.to_s
|
period = params[:period].to_i.to_s
|
||||||
period_unit = params[:period][-1].to_s
|
period_unit = params[:period][-1].to_s
|
||||||
|
|
||||||
current_user.request(epp_xml.renew(
|
current_user.request(epp_xml.renew(name: { value: params[:domain_name] },
|
||||||
name: { value: params[:domain_name] },
|
curExpDate: { value: params[:cur_exp_date] },
|
||||||
curExpDate: { value: params[:cur_exp_date] },
|
period: { value: period, attrs: { unit: period_unit } }))
|
||||||
period: { value: period, attrs: { unit: period_unit } }
|
|
||||||
))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def transfer(params)
|
def transfer(params)
|
||||||
|
|
|
@ -11,7 +11,7 @@ module Depp
|
||||||
validate :validate_existance_in_server
|
validate :validate_existance_in_server
|
||||||
|
|
||||||
def initialize(args = {})
|
def initialize(args = {})
|
||||||
args.each { |k, v| send(k.to_s + '=', v) }
|
args.each { |k, v| send("#{k}=", v) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def server
|
def server
|
||||||
|
@ -20,13 +20,13 @@ module Depp
|
||||||
port = ENV['epp_port'] || '700'
|
port = ENV['epp_port'] || '700'
|
||||||
|
|
||||||
@server_cache ||= Epp::Server.new({
|
@server_cache ||= Epp::Server.new({
|
||||||
server: ENV['epp_hostname'],
|
server: ENV['epp_hostname'],
|
||||||
tag: tag,
|
tag: tag,
|
||||||
password: password,
|
password: password,
|
||||||
port: port,
|
port: port,
|
||||||
cert: OpenSSL::X509::Certificate.new(client_cert),
|
cert: OpenSSL::X509::Certificate.new(client_cert),
|
||||||
key: OpenSSL::PKey::RSA.new(client_key)
|
key: OpenSSL::PKey::RSA.new(client_key)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
def request(xml)
|
def request(xml)
|
||||||
|
|
|
@ -20,7 +20,7 @@ module DNS
|
||||||
def self.generate_zonefile(origin)
|
def self.generate_zonefile(origin)
|
||||||
filename = "#{origin}.zone"
|
filename = "#{origin}.zone"
|
||||||
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Generating zonefile #{filename}\n"
|
$stdout << "#{Time.zone.now.utc} - Generating zonefile #{filename}\n"
|
||||||
|
|
||||||
zf = ActiveRecord::Base.connection.execute(
|
zf = ActiveRecord::Base.connection.execute(
|
||||||
"select generate_zonefile('#{origin}')"
|
"select generate_zonefile('#{origin}')"
|
||||||
|
@ -28,7 +28,7 @@ module DNS
|
||||||
|
|
||||||
File.open("#{ENV['zonefile_export_dir']}/#{filename}", 'w') { |f| f.write(zf) }
|
File.open("#{ENV['zonefile_export_dir']}/#{filename}", 'w') { |f| f.write(zf) }
|
||||||
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Successfully generated zonefile #{filename}\n"
|
$stdout << "#{Time.zone.now.utc} - Successfully generated zonefile #{filename}\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.origins
|
def self.origins
|
||||||
|
|
|
@ -24,7 +24,8 @@ class Dnskey < ApplicationRecord
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
ALGORITHMS = Depp::Dnskey::ALGORITHMS.map {|pair| pair[1].to_s}.freeze # IANA numbers, single authority list
|
# IANA numbers, single authority list
|
||||||
|
ALGORITHMS = Depp::Dnskey::ALGORITHMS.map {|pair| pair[1].to_s}.freeze
|
||||||
PROTOCOLS = %w(3)
|
PROTOCOLS = %w(3)
|
||||||
FLAGS = %w(0 256 257) # 256 = ZSK, 257 = KSK
|
FLAGS = %w(0 256 257) # 256 = ZSK, 257 = KSK
|
||||||
DS_DIGEST_TYPE = [1,2]
|
DS_DIGEST_TYPE = [1,2]
|
||||||
|
@ -75,13 +76,15 @@ class Dnskey < ApplicationRecord
|
||||||
def validate_flags
|
def validate_flags
|
||||||
return if flags.blank?
|
return if flags.blank?
|
||||||
return if FLAGS.include?(flags.to_s)
|
return if FLAGS.include?(flags.to_s)
|
||||||
|
|
||||||
errors.add(:flags, :invalid, values: "Valid flags are: #{FLAGS.join(', ')}")
|
errors.add(:flags, :invalid, values: "Valid flags are: #{FLAGS.join(', ')}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_digest
|
def generate_digest
|
||||||
return unless flags == 257 || flags == 256 # require ZoneFlag, but optional SecureEntryPoint
|
return unless flags == 257 || flags == 256 # require ZoneFlag, but optional SecureEntryPoint
|
||||||
|
|
||||||
self.ds_alg = alg
|
self.ds_alg = alg
|
||||||
self.ds_digest_type = Setting.ds_digest_type if self.ds_digest_type.blank? || !DS_DIGEST_TYPE.include?(ds_digest_type)
|
self.ds_digest_type = Setting.ds_digest_type if ds_digest_type.blank? || !DS_DIGEST_TYPE.include?(ds_digest_type)
|
||||||
|
|
||||||
flags_hex = self.class.int_to_hex(flags)
|
flags_hex = self.class.int_to_hex(flags)
|
||||||
protocol_hex = self.class.int_to_hex(protocol)
|
protocol_hex = self.class.int_to_hex(protocol)
|
||||||
|
@ -90,9 +93,10 @@ class Dnskey < ApplicationRecord
|
||||||
hex = [domain.name_in_wire_format, flags_hex, protocol_hex, alg_hex, public_key_hex].join
|
hex = [domain.name_in_wire_format, flags_hex, protocol_hex, alg_hex, public_key_hex].join
|
||||||
bin = self.class.hex_to_bin(hex)
|
bin = self.class.hex_to_bin(hex)
|
||||||
|
|
||||||
if self.ds_digest_type == 1
|
case ds_digest_type
|
||||||
|
when 1
|
||||||
self.ds_digest = Digest::SHA1.hexdigest(bin).upcase
|
self.ds_digest = Digest::SHA1.hexdigest(bin).upcase
|
||||||
elsif self.ds_digest_type == 2
|
when 2
|
||||||
self.ds_digest = Digest::SHA256.hexdigest(bin).upcase
|
self.ds_digest = Digest::SHA256.hexdigest(bin).upcase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -109,11 +113,11 @@ class Dnskey < ApplicationRecord
|
||||||
|
|
||||||
c = 0
|
c = 0
|
||||||
wire_format.each_byte.with_index do |b, i|
|
wire_format.each_byte.with_index do |b, i|
|
||||||
if i.even?
|
c += if i.even?
|
||||||
c += b << 8
|
b << 8
|
||||||
else
|
else
|
||||||
c += b
|
b
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.ds_key_tag = ((c & 0xFFFF) + (c >> 16)) & 0xFFFF
|
self.ds_key_tag = ((c & 0xFFFF) + (c >> 16)) & 0xFFFF
|
||||||
|
@ -146,21 +150,21 @@ class Dnskey < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def int_to_hex(s)
|
def int_to_hex(num)
|
||||||
s = s.to_s(16)
|
num = num.to_s(16)
|
||||||
s.prepend('0') if s.length.odd?
|
num.prepend('0') if num.length.odd?
|
||||||
end
|
end
|
||||||
|
|
||||||
def hex_to_bin(s)
|
def hex_to_bin(num)
|
||||||
s.scan(/../).map(&:hex).pack('c*')
|
num.scan(/../).map(&:hex).pack('c*')
|
||||||
end
|
end
|
||||||
|
|
||||||
def bin_to_hex(s)
|
def bin_to_hex(num)
|
||||||
s.each_byte.map { |b| format('%02X', b) }.join
|
num.each_byte.map { |b| format('%02X', b) }.join
|
||||||
end
|
end
|
||||||
|
|
||||||
def pub_key_base64?(pub)
|
def pub_key_base64?(pub)
|
||||||
return unless pub&.is_a?(String)
|
return unless pub.is_a?(String)
|
||||||
|
|
||||||
Base64.strict_encode64(Base64.strict_decode64(pub)) == pub
|
Base64.strict_encode64(Base64.strict_decode64(pub)) == pub
|
||||||
rescue ArgumentError
|
rescue ArgumentError
|
||||||
|
|
|
@ -13,9 +13,14 @@ class Domain < ApplicationRecord
|
||||||
include Domain::Disputable
|
include Domain::Disputable
|
||||||
include Domain::BulkUpdatable
|
include Domain::BulkUpdatable
|
||||||
|
|
||||||
attr_accessor :roles
|
attr_accessor :roles,
|
||||||
|
:legal_document_id,
|
||||||
attr_accessor :legal_document_id
|
:is_admin,
|
||||||
|
:registrant_typeahead,
|
||||||
|
:update_me,
|
||||||
|
:epp_pending_update,
|
||||||
|
:epp_pending_delete,
|
||||||
|
:reserved_pw
|
||||||
|
|
||||||
alias_attribute :on_hold_time, :outzone_at
|
alias_attribute :on_hold_time, :outzone_at
|
||||||
alias_attribute :outzone_time, :outzone_at
|
alias_attribute :outzone_time, :outzone_at
|
||||||
|
@ -27,16 +32,18 @@ class Domain < ApplicationRecord
|
||||||
:admin_store_statuses_history
|
:admin_store_statuses_history
|
||||||
|
|
||||||
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
|
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
|
||||||
# TODO: most inputs should be trimmed before validatation, probably some global logic?
|
# TODO: most inputs should be trimmed before validation, probably some global logic?
|
||||||
|
|
||||||
belongs_to :registrar, required: true
|
belongs_to :registrar, required: true
|
||||||
belongs_to :registrant, required: true
|
belongs_to :registrant, required: true
|
||||||
# TODO: should we user validates_associated :registrant here?
|
# TODO: should we user validates_associated :registrant here?
|
||||||
|
|
||||||
has_many :admin_domain_contacts
|
has_many :admin_domain_contacts
|
||||||
accepts_nested_attributes_for :admin_domain_contacts, allow_destroy: true, reject_if: :admin_change_prohibited?
|
accepts_nested_attributes_for :admin_domain_contacts,
|
||||||
|
allow_destroy: true, reject_if: :admin_change_prohibited?
|
||||||
has_many :tech_domain_contacts
|
has_many :tech_domain_contacts
|
||||||
accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: true, reject_if: :tech_change_prohibited?
|
accepts_nested_attributes_for :tech_domain_contacts,
|
||||||
|
allow_destroy: true, reject_if: :tech_change_prohibited?
|
||||||
|
|
||||||
def registrant_change_prohibited?
|
def registrant_change_prohibited?
|
||||||
statuses.include? DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED
|
statuses.include? DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED
|
||||||
|
@ -114,16 +121,12 @@ class Domain < ApplicationRecord
|
||||||
validate :status_is_consistant
|
validate :status_is_consistant
|
||||||
def status_is_consistant
|
def status_is_consistant
|
||||||
has_error = (hold_status? && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE))
|
has_error = (hold_status? && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE))
|
||||||
unless has_error
|
if !has_error && (statuses & DELETE_STATUSES).any?
|
||||||
if (statuses & DELETE_STATUSES).any?
|
has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED
|
||||||
has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error
|
errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_accessor :is_admin
|
|
||||||
|
|
||||||
# Removed to comply new ForceDelete procedure
|
# Removed to comply new ForceDelete procedure
|
||||||
# at https://github.com/internetee/registry/issues/1428#issuecomment-570561967
|
# at https://github.com/internetee/registry/issues/1428#issuecomment-570561967
|
||||||
#
|
#
|
||||||
|
@ -204,12 +207,10 @@ class Domain < ApplicationRecord
|
||||||
|
|
||||||
def statuses_uniqueness
|
def statuses_uniqueness
|
||||||
return if statuses.uniq == statuses
|
return if statuses.uniq == statuses
|
||||||
|
|
||||||
errors.add(:statuses, :taken)
|
errors.add(:statuses, :taken)
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_accessor :registrant_typeahead, :update_me,
|
|
||||||
:epp_pending_update, :epp_pending_delete, :reserved_pw
|
|
||||||
|
|
||||||
self.ignored_columns = %w[legacy_id legacy_registrar_id legacy_registrant_id]
|
self.ignored_columns = %w[legacy_id legacy_registrar_id legacy_registrant_id]
|
||||||
|
|
||||||
def subordinate_nameservers
|
def subordinate_nameservers
|
||||||
|
@ -350,10 +351,10 @@ class Domain < ApplicationRecord
|
||||||
# find by internationalized domain name
|
# find by internationalized domain name
|
||||||
# internet domain name => ascii or puny, but db::domains.name is unicode
|
# internet domain name => ascii or puny, but db::domains.name is unicode
|
||||||
def self.find_by_idn(name)
|
def self.find_by_idn(name)
|
||||||
domain = self.find_by_name name
|
domain = find_by(name: name)
|
||||||
if domain.blank? && name.include?('-')
|
if domain.blank? && name.include?('-')
|
||||||
unicode = SimpleIDN.to_unicode name # we have no index on domains.name_puny
|
unicode = SimpleIDN.to_unicode name # we have no index on domains.name_puny
|
||||||
domain = self.find_by_name unicode
|
domain = find_by(name: unicode)
|
||||||
end
|
end
|
||||||
domain
|
domain
|
||||||
end
|
end
|
||||||
|
@ -386,9 +387,7 @@ class Domain < ApplicationRecord
|
||||||
return true unless Setting.days_to_renew_domain_before_expire != 0
|
return true unless Setting.days_to_renew_domain_before_expire != 0
|
||||||
|
|
||||||
# if you can renew domain at days_to_renew before domain expiration
|
# if you can renew domain at days_to_renew before domain expiration
|
||||||
if (expire_time.to_date - Time.zone.today) + 1 > Setting.days_to_renew_domain_before_expire
|
return false if (expire_time.to_date - Time.zone.today) + 1 > Setting.days_to_renew_domain_before_expire
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -431,9 +430,11 @@ class Domain < ApplicationRecord
|
||||||
|
|
||||||
def pending_update!
|
def pending_update!
|
||||||
return true if pending_update?
|
return true if pending_update?
|
||||||
|
|
||||||
self.epp_pending_update = true # for epp
|
self.epp_pending_update = true # for epp
|
||||||
|
|
||||||
return true unless registrant_verification_asked?
|
return true unless registrant_verification_asked?
|
||||||
|
|
||||||
pending_json_cache = pending_json
|
pending_json_cache = pending_json
|
||||||
token = registrant_verification_token
|
token = registrant_verification_token
|
||||||
asked_at = registrant_verification_asked_at
|
asked_at = registrant_verification_asked_at
|
||||||
|
@ -590,20 +591,19 @@ class Domain < ApplicationRecord
|
||||||
# special handling for admin changing status
|
# special handling for admin changing status
|
||||||
def admin_status_update(update)
|
def admin_status_update(update)
|
||||||
update_unless_locked_by_registrant(update)
|
update_unless_locked_by_registrant(update)
|
||||||
|
|
||||||
update_not_by_locked_statuses(update)
|
update_not_by_locked_statuses(update)
|
||||||
# check for deleted status
|
# check for deleted status
|
||||||
statuses.each do |s|
|
statuses.each do |s|
|
||||||
unless update.include? s
|
unless update.include? s
|
||||||
case s
|
case s
|
||||||
when DomainStatus::PENDING_DELETE
|
when DomainStatus::PENDING_DELETE
|
||||||
self.delete_date = nil
|
self.delete_date = nil
|
||||||
when DomainStatus::SERVER_MANUAL_INZONE # removal causes server hold to set
|
when DomainStatus::SERVER_MANUAL_INZONE # removal causes server hold to set
|
||||||
self.outzone_at = Time.zone.now if force_delete_scheduled?
|
self.outzone_at = Time.zone.now if force_delete_scheduled?
|
||||||
when DomainStatus::EXPIRED # removal causes server hold to set
|
when DomainStatus::EXPIRED # removal causes server hold to set
|
||||||
self.outzone_at = self.expire_time + 15.day
|
self.outzone_at = expire_time + 15.day
|
||||||
when DomainStatus::SERVER_HOLD # removal causes server hold to set
|
when DomainStatus::SERVER_HOLD # removal causes server hold to set
|
||||||
self.outzone_at = nil
|
self.outzone_at = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -103,24 +103,24 @@ class DomainStatus < ApplicationRecord
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
UPDATE_PROHIBIT_STATES = [
|
UPDATE_PROHIBIT_STATES = [
|
||||||
DomainStatus::PENDING_DELETE_CONFIRMATION,
|
DomainStatus::PENDING_DELETE_CONFIRMATION,
|
||||||
DomainStatus::CLIENT_UPDATE_PROHIBITED,
|
DomainStatus::CLIENT_UPDATE_PROHIBITED,
|
||||||
DomainStatus::SERVER_UPDATE_PROHIBITED,
|
DomainStatus::SERVER_UPDATE_PROHIBITED,
|
||||||
DomainStatus::PENDING_CREATE,
|
DomainStatus::PENDING_CREATE,
|
||||||
DomainStatus::PENDING_UPDATE,
|
DomainStatus::PENDING_UPDATE,
|
||||||
DomainStatus::PENDING_DELETE,
|
DomainStatus::PENDING_DELETE,
|
||||||
DomainStatus::PENDING_RENEW,
|
DomainStatus::PENDING_RENEW,
|
||||||
DomainStatus::PENDING_TRANSFER
|
DomainStatus::PENDING_TRANSFER
|
||||||
]
|
].freeze
|
||||||
|
|
||||||
DELETE_PROHIBIT_STATES = [
|
DELETE_PROHIBIT_STATES = [
|
||||||
DomainStatus::CLIENT_DELETE_PROHIBITED,
|
DomainStatus::CLIENT_DELETE_PROHIBITED,
|
||||||
DomainStatus::SERVER_DELETE_PROHIBITED,
|
DomainStatus::SERVER_DELETE_PROHIBITED,
|
||||||
DomainStatus::PENDING_CREATE,
|
DomainStatus::PENDING_CREATE,
|
||||||
DomainStatus::PENDING_RENEW,
|
DomainStatus::PENDING_RENEW,
|
||||||
DomainStatus::PENDING_TRANSFER,
|
DomainStatus::PENDING_TRANSFER,
|
||||||
DomainStatus::PENDING_UPDATE,
|
DomainStatus::PENDING_UPDATE,
|
||||||
DomainStatus::PENDING_DELETE
|
DomainStatus::PENDING_DELETE
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
def epp_code_map
|
def epp_code_map
|
||||||
|
@ -153,7 +153,6 @@ class DomainStatus < ApplicationRecord
|
||||||
admin_statuses_map.map(&:second)
|
admin_statuses_map.map(&:second)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def admin_statuses_map
|
def admin_statuses_map
|
||||||
admin_statuses = [
|
admin_statuses = [
|
||||||
['Hold', SERVER_HOLD],
|
['Hold', SERVER_HOLD],
|
||||||
|
|
|
@ -98,8 +98,8 @@ class Epp::Contact < Contact
|
||||||
return unless legal_document_data
|
return unless legal_document_data
|
||||||
|
|
||||||
legal_documents.create(
|
legal_documents.create(
|
||||||
document_type: legal_document_data[:type],
|
document_type: legal_document_data[:type],
|
||||||
body: legal_document_data[:body]
|
body: legal_document_data[:body]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -108,9 +108,9 @@ class Epp::Contact < Contact
|
||||||
return unless legal_document_data
|
return unless legal_document_data
|
||||||
|
|
||||||
doc = LegalDocument.create(
|
doc = LegalDocument.create(
|
||||||
documentable_type: Contact,
|
documentable_type: Contact,
|
||||||
document_type: legal_document_data[:type],
|
document_type: legal_document_data[:type],
|
||||||
body: legal_document_data[:body]
|
body: legal_document_data[:body]
|
||||||
)
|
)
|
||||||
self.legal_documents = [doc]
|
self.legal_documents = [doc]
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ class Epp::Domain < Domain
|
||||||
return true if is_transfer || is_renewal
|
return true if is_transfer || is_renewal
|
||||||
return unless update_prohibited?
|
return unless update_prohibited?
|
||||||
|
|
||||||
stat = (statuses & (DomainStatus::UPDATE_PROHIBIT_STATES + DomainStatus::DELETE_PROHIBIT_STATES)).first
|
stat = (statuses &
|
||||||
|
(DomainStatus::UPDATE_PROHIBIT_STATES + DomainStatus::DELETE_PROHIBIT_STATES)).first
|
||||||
add_epp_error('2304', 'status', stat, I18n.t(:object_status_prohibits_operation))
|
add_epp_error('2304', 'status', stat, I18n.t(:object_status_prohibits_operation))
|
||||||
throw(:abort)
|
throw(:abort)
|
||||||
end
|
end
|
||||||
|
@ -144,8 +144,8 @@ class Epp::Domain < Domain
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if doc = attach_legal_document(::Deserializers::Xml::LegalDocument.new(frame).call)
|
if doc = attach_legal_document(::Deserializers::Xml::LegalDocument.new(frame).call) && doc&.persisted?
|
||||||
frame.css("legalDocument").first.content = doc.path if doc&.persisted?
|
frame.css("legalDocument").first.content = doc.path
|
||||||
end
|
end
|
||||||
|
|
||||||
if Setting.request_confirmation_on_domain_deletion_enabled &&
|
if Setting.request_confirmation_on_domain_deletion_enabled &&
|
||||||
|
@ -174,7 +174,7 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
### RENEW ###
|
### RENEW ###
|
||||||
|
|
||||||
def renew(renewed_expire_time:, period:, unit:)
|
def renew(renewed_expire_time, period, unit)
|
||||||
@is_renewal = true
|
@is_renewal = true
|
||||||
|
|
||||||
add_renew_epp_errors unless renewable?
|
add_renew_epp_errors unless renewable?
|
||||||
|
@ -216,7 +216,8 @@ class Epp::Domain < Domain
|
||||||
return transfers.last if transfers.any?
|
return transfers.last if transfers.any?
|
||||||
when 'request'
|
when 'request'
|
||||||
return pending_transfer if pending_transfer
|
return pending_transfer if pending_transfer
|
||||||
return query_transfer(frame, current_user)
|
|
||||||
|
query_transfer(frame, current_user)
|
||||||
when 'approve'
|
when 'approve'
|
||||||
return approve_transfer(frame, current_user) if pending_transfer
|
return approve_transfer(frame, current_user) if pending_transfer
|
||||||
when 'reject'
|
when 'reject'
|
||||||
|
@ -308,10 +309,12 @@ class Epp::Domain < Domain
|
||||||
begin
|
begin
|
||||||
return if cur_exp_date.to_date == valid_to.to_date
|
return if cur_exp_date.to_date == valid_to.to_date
|
||||||
rescue
|
rescue
|
||||||
add_epp_error('2306', 'curExpDate', cur_exp_date, I18n.t('errors.messages.epp_exp_dates_do_not_match'))
|
add_epp_error('2306', 'curExpDate', cur_exp_date,
|
||||||
|
I18n.t('errors.messages.epp_exp_dates_do_not_match'))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
add_epp_error('2306', 'curExpDate', cur_exp_date, I18n.t('errors.messages.epp_exp_dates_do_not_match'))
|
add_epp_error('2306', 'curExpDate', cur_exp_date,
|
||||||
|
I18n.t('errors.messages.epp_exp_dates_do_not_match'))
|
||||||
end
|
end
|
||||||
|
|
||||||
### ABILITIES ###
|
### ABILITIES ###
|
||||||
|
@ -323,10 +326,10 @@ class Epp::Domain < Domain
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED]).any?
|
||||||
errors.add(:base, :domain_status_prohibits_operation)
|
errors.add(:base, :domain_status_prohibits_operation)
|
||||||
return false
|
return false
|
||||||
end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED]).any?
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ class InactiveContacts
|
||||||
end
|
end
|
||||||
|
|
||||||
def log(msg)
|
def log(msg)
|
||||||
@log ||= Logger.new(STDOUT)
|
@log ||= Logger.new($stdout)
|
||||||
@log.info(msg)
|
@log.info(msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,22 +12,26 @@ class Invoice < ApplicationRecord
|
||||||
has_many :payment_orders
|
has_many :payment_orders
|
||||||
|
|
||||||
accepts_nested_attributes_for :items
|
accepts_nested_attributes_for :items
|
||||||
|
# rubocop:disable Layout/LineLength
|
||||||
scope :all_columns, ->{select("invoices.*")}
|
# rubocop:disable Style/MultilineBlockLayout
|
||||||
scope :sort_due_date_column, ->{all_columns.select("CASE WHEN invoices.cancelled_at is not null THEN
|
scope :all_columns, -> { select("invoices.*") }
|
||||||
|
scope :sort_due_date_column, -> { all_columns.select("CASE WHEN invoices.cancelled_at is not null THEN
|
||||||
(invoices.cancelled_at + interval '100 year') ELSE
|
(invoices.cancelled_at + interval '100 year') ELSE
|
||||||
invoices.due_date END AS sort_due_date")}
|
invoices.due_date END AS sort_due_date")
|
||||||
scope :sort_by_sort_due_date_asc, ->{sort_due_date_column.order("sort_due_date ASC")}
|
}
|
||||||
scope :sort_by_sort_due_date_desc, ->{sort_due_date_column.order("sort_due_date DESC")}
|
scope :sort_by_sort_due_date_asc, -> { sort_due_date_column.order("sort_due_date ASC") }
|
||||||
scope :sort_receipt_date_column, ->{all_columns.includes(:account_activity).references(:account_activity).select(%Q{
|
scope :sort_by_sort_due_date_desc, -> { sort_due_date_column.order("sort_due_date DESC") }
|
||||||
|
scope :sort_receipt_date_column, -> { all_columns.includes(:account_activity).references(:account_activity).select(%(
|
||||||
CASE WHEN account_activities.created_at is not null THEN account_activities.created_at
|
CASE WHEN account_activities.created_at is not null THEN account_activities.created_at
|
||||||
WHEN invoices.cancelled_at is not null THEN invoices.cancelled_at + interval '100 year'
|
WHEN invoices.cancelled_at is not null THEN invoices.cancelled_at + interval '100 year'
|
||||||
ELSE NULL END AS sort_receipt_date })}
|
ELSE NULL END AS sort_receipt_date ))
|
||||||
scope :sort_by_sort_receipt_date_asc, ->{sort_receipt_date_column.order("sort_receipt_date ASC")}
|
}
|
||||||
scope :sort_by_sort_receipt_date_desc, ->{sort_receipt_date_column.order("sort_receipt_date DESC")}
|
scope :sort_by_sort_receipt_date_asc, -> { sort_receipt_date_column.order("sort_receipt_date ASC") }
|
||||||
|
scope :sort_by_sort_receipt_date_desc, -> { sort_receipt_date_column.order("sort_receipt_date DESC") }
|
||||||
|
|
||||||
scope :overdue, -> { unpaid.non_cancelled.where('due_date < ?', Time.zone.today) }
|
scope :overdue, -> { unpaid.non_cancelled.where('due_date < ?', Time.zone.today) }
|
||||||
|
# rubocop:enable Layout/LineLength
|
||||||
|
# rubocop:enable Style/MultilineBlockLayout
|
||||||
validates :due_date, :currency, :seller_name,
|
validates :due_date, :currency, :seller_name,
|
||||||
:seller_iban, :buyer_name, :items, presence: true
|
:seller_iban, :buyer_name, :items, presence: true
|
||||||
|
|
||||||
|
@ -38,7 +42,7 @@ class Invoice < ApplicationRecord
|
||||||
attribute :vat_rate, ::Type::VatRate.new
|
attribute :vat_rate, ::Type::VatRate.new
|
||||||
|
|
||||||
def set_invoice_number
|
def set_invoice_number
|
||||||
last_no = Invoice.order(number: :desc).limit(1).pluck(:number).first
|
last_no = Invoice.order(number: :desc).limit(1).pick(:number)
|
||||||
|
|
||||||
if last_no && last_no >= Setting.invoice_number_min.to_i
|
if last_no && last_no >= Setting.invoice_number_min.to_i
|
||||||
self.number = last_no + 1
|
self.number = last_no + 1
|
||||||
|
@ -91,8 +95,8 @@ class Invoice < ApplicationRecord
|
||||||
read_attribute(:total)
|
read_attribute(:total)
|
||||||
end
|
end
|
||||||
|
|
||||||
def each
|
def each(&block)
|
||||||
items.each { |item| yield item }
|
items.each(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_pdf
|
def as_pdf
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class Invoice
|
class Invoice
|
||||||
class EInvoiceGenerator
|
class EInvoiceGenerator
|
||||||
attr_reader :invoice
|
attr_reader :invoice, :payable
|
||||||
attr_reader :payable
|
|
||||||
|
|
||||||
def initialize(invoice, payable)
|
def initialize(invoice, payable)
|
||||||
@invoice = invoice
|
@invoice = invoice
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class Invoice
|
class Invoice
|
||||||
class VatRateCalculator
|
class VatRateCalculator
|
||||||
attr_reader :registry
|
attr_reader :registry, :registrar
|
||||||
attr_reader :registrar
|
|
||||||
|
|
||||||
def initialize(registry: Registry.current, registrar:)
|
def initialize(registry: Registry.current, registrar:)
|
||||||
@registry = registry
|
@registry = registry
|
||||||
|
|
|
@ -65,7 +65,6 @@ class LegalDocument < ApplicationRecord
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.remove_duplicates
|
def self.remove_duplicates
|
||||||
start = Time.zone.now.to_f
|
start = Time.zone.now.to_f
|
||||||
Rails.logger.info '-----> Removing legal documents duplicates'
|
Rails.logger.info '-----> Removing legal documents duplicates'
|
||||||
|
@ -84,7 +83,8 @@ class LegalDocument < ApplicationRecord
|
||||||
File.delete(new_legal.path) if File.exist?(new_legal.path)
|
File.delete(new_legal.path) if File.exist?(new_legal.path)
|
||||||
new_legal.update(path: orig_legal.path)
|
new_legal.update(path: orig_legal.path)
|
||||||
count += 1
|
count += 1
|
||||||
Rails.logger.info "File #{new_legal.path} has been removed by Domain #{new_legal.documentable_id}. Document id: #{new_legal.id}"
|
Rails.logger.info "File #{new_legal.path} has been removed by Domain "\
|
||||||
|
"#{new_legal.documentable_id}. Document id: #{new_legal.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -107,7 +107,8 @@ class LegalDocument < ApplicationRecord
|
||||||
File.delete(new_legal.path) if File.exist?(new_legal.path)
|
File.delete(new_legal.path) if File.exist?(new_legal.path)
|
||||||
new_legal.update(path: orig_legal.path)
|
new_legal.update(path: orig_legal.path)
|
||||||
count += 1
|
count += 1
|
||||||
Rails.logger.info "File #{new_legal.path} has been removed by Contact #{new_legal.documentable_id}. Document id: #{new_legal.id}"
|
Rails.logger.info "File #{new_legal.path} has been removed by Contact "\
|
||||||
|
"#{new_legal.documentable_id}. Document id: #{new_legal.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,18 +38,18 @@ class Nameserver < ApplicationRecord
|
||||||
|
|
||||||
def epp_code_map
|
def epp_code_map
|
||||||
{
|
{
|
||||||
'2302' => [
|
'2302' => [
|
||||||
[:hostname, :taken, { value: { obj: 'hostAttr', val: {'hostName': hostname} } }]
|
[:hostname, :taken, { value: { obj: 'hostAttr', val: { 'hostName': hostname } } }]
|
||||||
],
|
],
|
||||||
'2005' => [
|
'2005' => [
|
||||||
[:hostname, :invalid, { value: { obj: 'hostAttr', val: hostname } }],
|
[:hostname, :invalid, { value: { obj: 'hostAttr', val: hostname } }],
|
||||||
[:hostname, :puny_to_long, { value: { obj: 'hostAttr', val: hostname } }],
|
[:hostname, :puny_to_long, { value: { obj: 'hostAttr', val: hostname } }],
|
||||||
[:ipv4, :invalid, { value: { obj: 'hostAddr', val: ipv4 } }],
|
[:ipv4, :invalid, { value: { obj: 'hostAddr', val: ipv4 } }],
|
||||||
[:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }]
|
[:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }]
|
||||||
],
|
],
|
||||||
'2003' => [
|
'2003' => [
|
||||||
%i[base ip_required],
|
%i[base ip_required],
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,11 +63,10 @@ class Nameserver < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def from_hash_params params
|
def from_hash_params(params)
|
||||||
params = params.with_indifferent_access
|
params = params.with_indifferent_access
|
||||||
rel = all
|
rel = all
|
||||||
rel = rel.where(hostname: params[:hostname])
|
rel.where(hostname: params[:hostname])
|
||||||
rel
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def hostnames
|
def hostnames
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue