Merge pull request #484 from internetee/registry-475

Registry 475
This commit is contained in:
Timo Võhmar 2017-04-27 18:02:17 +03:00 committed by GitHub
commit baf3c96ad2
153 changed files with 3416 additions and 1902 deletions

View file

@ -124,6 +124,7 @@ group :development do
# deploy
gem 'mina', '0.3.1' # for fast deployment
gem 'puma'
end
group :development, :test do

View file

@ -351,6 +351,7 @@ GEM
method_source (~> 0.8.1)
slop (~> 3.4)
public_suffix (2.0.5)
puma (3.8.2)
que (0.10.0)
que-web (0.4.0)
erubis
@ -608,6 +609,7 @@ DEPENDENCIES
phantomjs-binaries (= 1.9.2.4)
poltergeist (= 1.6.0)
pry (= 0.10.1)
puma
que (= 0.10.0)
que-web (= 0.4.0)
que_mailer!

View file

@ -5,10 +5,10 @@
//= require 'select2-bootstrap'
@import shared/fonts
@import shared/general
@import forms
@import typeaheadjs
@import selectize
@import selectize.bootstrap3
// @import bootstrap-datepicker3
@import admin/admin
@import admin/bootstrap-dialog-fix

View file

@ -0,0 +1,7 @@
input[type=number]::-webkit-inner-spin-button {
display: none;
}
input[type=number] {
-moz-appearance: textfield;
}

View file

@ -0,0 +1,87 @@
module Admin
module Billing
class PricesController < AdminController
authorize_resource(class: 'Billing::Price')
before_action :load_price, only: %i[edit update destroy]
helper_method :zones
helper_method :operation_categories
helper_method :durations
def index
@q = ::Billing::Price.search(params[:q])
@q.sorts = ['zone_id asc', 'duration asc', 'operation_category asc',
'valid_from desc', 'valid_to asc'] if @q.sorts.empty?
@prices = @q.result.page(params[:page])
end
def new
@price = ::Billing::Price.new
end
def edit
end
def create
@price = ::Billing::Price.new(price_params)
if @price.save
flash[:notice] = t('.created')
redirect_to_index
else
render :new
end
end
def update
if @price.update_attributes(price_params)
flash[:notice] = t('.updated')
redirect_to_index
else
render :edit
end
end
def destroy
@price.destroy!
flash[:notice] = t('.destroyed')
redirect_to_index
end
private
def load_price
@price = ::Billing::Price.find(params[:id])
end
def price_params
allowed_params = %i[
zone_id
operation_category
duration
price
valid_from
valid_to
]
params.require(:price).permit(*allowed_params)
end
def redirect_to_index
redirect_to admin_prices_url
end
def zones
::DNS::Zone.all
end
def operation_categories
::Billing::Price::operation_categories
end
def durations
durations = ::Billing::Price::durations
durations.collect { |duration| [duration.sub('mon', 'month'), duration] }
end
end
end
end

View file

@ -0,0 +1,74 @@
module Admin
module DNS
class ZonesController < AdminController
authorize_resource(class: 'DNS::Zone')
before_action :load_zone, only: %i[edit update destroy]
def index
@zones = ::DNS::Zone.all
end
def new
@zone = ::DNS::Zone.new
end
def create
@zone = ::DNS::Zone.new(zone_params)
if @zone.save
flash[:notice] = t('.created')
redirect_to_index
else
render :new
end
end
def edit
@zone = ::DNS::Zone.find(params[:id])
end
def update
if @zone.update(zone_params)
flash[:notice] = t('.updated')
redirect_to_index
else
render :edit
end
end
def destroy
@zone.destroy!
flash[:notice] = t('.destroyed')
redirect_to_index
end
private
def load_zone
@zone = ::DNS::Zone.find(params[:id])
end
def zone_params
allowed_params = %i[
origin
ttl
refresh
retry
expire
minimum_ttl
email
master_nameserver
ns_records
a_records
a4_records
]
params.require(:zone).permit(*allowed_params)
end
def redirect_to_index
redirect_to admin_zones_url
end
end
end
end

View file

@ -1,54 +0,0 @@
class Admin::PricelistsController < AdminController
load_and_authorize_resource
before_action :set_pricelist, only: [:show, :edit, :update]
def index
@q = Pricelist.search(params[:q])
@q.sorts = ['category asc', 'duration asc', 'operation_category asc',
'valid_from desc', 'valid_to asc'] if @q.sorts.empty?
@pricelists = @q.result.page(params[:page])
end
def new
@pricelist = Pricelist.new
end
def edit
end
def create
comma_support_for(:pricelist, :price)
@pricelist = Pricelist.new(pricelist_params)
if @pricelist.save
redirect_to admin_pricelists_url
else
render 'new'
end
end
def update
comma_support_for(:pricelist, :price)
if @pricelist.update_attributes(pricelist_params)
redirect_to admin_pricelists_url
else
render 'edit'
end
end
def destroy
@pricelist.destroy
redirect_to admin_pricelists_url
end
private
def set_pricelist
@pricelist = Pricelist.find(params[:id])
end
def pricelist_params
params.require(:pricelist).permit(:operation_category, :category, :price_category,
:duration, :price, :valid_from, :valid_to)
end
end

View file

@ -1,60 +0,0 @@
class Admin::ZonefileSettingsController < AdminController
load_and_authorize_resource
before_action :set_zonefile_setting, only: [:update, :edit]
def index
@zonefile_settings = ZonefileSetting.all
end
def new
@zonefile_setting = ZonefileSetting.new
end
def create
@zonefile_setting = ZonefileSetting.new(zonefile_setting_params)
if @zonefile_setting.save
flash[:notice] = I18n.t('record_created')
redirect_to admin_zonefile_settings_path
else
flash.now[:alert] = I18n.t('failed_to_create_record')
render 'new'
end
end
def edit
@zonefile_setting = ZonefileSetting.find(params[:id])
end
def update
if @zonefile_setting.update(zonefile_setting_params)
flash[:notice] = I18n.t('record_updated')
redirect_to admin_zonefile_settings_path
else
flash.now[:alert] = I18n.t('failed_to_update_record')
render 'edit'
end
end
def destroy
if @zonefile_setting.destroy
flash[:notice] = I18n.t('record_deleted')
redirect_to admin_zonefile_settings_path
else
flash.now[:alert] = I18n.t('failed_to_delete_record')
render 'edit'
end
end
private
def set_zonefile_setting
@zonefile_setting = ZonefileSetting.find(params[:id])
end
def zonefile_setting_params
params.require(:zonefile_setting).permit(
:origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email,
:master_nameserver, :ns_records, :a_records, :a4_records
)
end
end

View file

@ -3,7 +3,7 @@ class Admin::ZonefilesController < ApplicationController
# TODO: Refactor this
def create
if ZonefileSetting.origins.include?(params[:origin])
if DNS::Zone.origins.include?(params[:origin])
@zonefile = ActiveRecord::Base.connection.execute(
"select generate_zonefile('#{params[:origin]}')"

View file

@ -105,7 +105,10 @@ class Epp::DomainsController < EppController
balance_ok?('renew', period, period_unit) # loading pricelist
ActiveRecord::Base.transaction do
begin
ActiveRecord::Base.transaction(isolation: :serializable) do
@domain.reload
success = @domain.renew(
params[:parsed_frame].css('curExpDate').text,
period, period_unit
@ -129,6 +132,10 @@ class Epp::DomainsController < EppController
handle_errors(@domain)
end
end
rescue ActiveRecord::StatementInvalid => e
sleep rand / 100
retry
end
end
def transfer

View file

@ -1,4 +1,5 @@
class Registrar::AccountActivitiesController < RegistrarController
class Registrar
class AccountActivitiesController < BaseController
load_and_authorize_resource
def index # rubocop: disable Metrics/AbcSize
@ -26,3 +27,4 @@ class Registrar::AccountActivitiesController < RegistrarController
params[:q][:created_at_lteq] = ca_cache
end
end
end

View file

@ -0,0 +1,40 @@
class Registrar
class BaseController < ApplicationController
before_action :authenticate_user!, :check_ip
include Registrar::ApplicationHelper
helper_method :depp_controller?
def depp_controller?
false
end
def check_ip
return unless current_user
unless current_user.is_a? ApiUser
sign_out(current_user)
return
end
return if Rails.env.development?
registrar_ip_whitelisted = current_user.registrar.registrar_ip_white?(request.ip)
return if registrar_ip_whitelisted
flash[:alert] = t('ip_is_not_whitelisted')
sign_out(current_user)
redirect_to registrar_login_path and return
end
helper_method :head_title_sufix
def head_title_sufix
t(:registrar_head_title_sufix)
end
protected
def current_ability
@current_ability ||= Ability.new(current_user, request.remote_ip)
end
end
end

View file

@ -1,4 +1,5 @@
class Registrar::ContactsController < Registrar::DeppController # EPP controller
class Registrar
class ContactsController < DeppController
before_action :init_epp_contact
helper_method :address_processing?
@ -140,3 +141,4 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller
Contact.address_processing?
end
end
end

View file

@ -1,4 +1,5 @@
class Registrar::DashboardController < RegistrarController
class Registrar
class DashboardController < BaseController
authorize_resource class: false
def show
@ -9,3 +10,4 @@ class Registrar::DashboardController < RegistrarController
end
end
end
end

View file

@ -1,4 +1,5 @@
class Registrar::DepositsController < RegistrarController
class Registrar
class DepositsController < BaseController
authorize_resource class: false
def new
@ -24,3 +25,4 @@ class Registrar::DepositsController < RegistrarController
params.require(:deposit).permit(:amount, :description)
end
end
end

View file

@ -1,4 +1,5 @@
class Registrar::DeppController < RegistrarController # EPP controller
class Registrar
class DeppController < BaseController
helper_method :depp_current_user
rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |exception|
@ -8,6 +9,7 @@ class Registrar::DeppController < RegistrarController # EPP controller
end
before_action :authenticate_user
def authenticate_user
redirect_to registrar_login_url and return unless depp_current_user
end
@ -32,3 +34,4 @@ class Registrar::DeppController < RegistrarController # EPP controller
true
end
end
end

View file

@ -1,4 +1,5 @@
class Registrar::DomainsController < Registrar::DeppController # EPP controller
class Registrar
class DomainsController < DeppController
before_action :init_domain, except: :new
helper_method :contacts
@ -55,6 +56,7 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller
end
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
@ -189,3 +191,4 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller
params[:q][:valid_to_lteq] = ca_cache
end
end
end

View file

@ -1,4 +1,5 @@
class Registrar::InvoicesController < RegistrarController
class Registrar
class InvoicesController < BaseController
load_and_authorize_resource
before_action :set_invoice, only: [:show, :forward, :download_pdf]
@ -14,7 +15,8 @@ class Registrar::InvoicesController < RegistrarController
end
end
def show; end
def show;
end
def forward
@invoice.billing_email = @invoice.buyer.billing_email
@ -69,3 +71,4 @@ class Registrar::InvoicesController < RegistrarController
params[:q][:due_date_lteq] = ca_cache
end
end
end

View file

@ -1,4 +1,5 @@
class Registrar::KeyrelaysController < Registrar::DeppController # EPP controller
class Registrar
class KeyrelaysController < DeppController
def show
authorize! :view, Depp::Keyrelay
end
@ -16,3 +17,4 @@ class Registrar::KeyrelaysController < Registrar::DeppController # EPP controlle
end
end
end
end

View file

@ -1,4 +1,5 @@
class Registrar::PaymentsController < RegistrarController
class Registrar
class PaymentsController < BaseController
protect_from_forgery except: :back
skip_authorization_check # actually anyone can pay, no problems at all
@ -35,6 +36,7 @@ class Registrar::PaymentsController < RegistrarController
end
private
def banks
ENV['payments_banks'].split(",").map(&:strip)
end
@ -42,5 +44,5 @@ class Registrar::PaymentsController < RegistrarController
def check_bank
raise StandardError.new("Not Implemented bank") unless banks.include?(params[:bank])
end
end
end

View file

@ -1,11 +1,15 @@
class Registrar::PollsController < Registrar::DeppController # EPP controller
class Registrar
class PollsController < DeppController
authorize_resource class: false
before_action :init_epp_xml
def show
if Rails.env.test? # Stub for depp server request
@data = Object.new
def @data.css(key); []; end
def @data.css(key)
; [];
end
else
@data = depp_current_user.request(@ex.poll)
end
@ -54,3 +58,4 @@ class Registrar::PollsController < Registrar::DeppController # EPP controller
@domain = Depp::Domain.new(current_user: depp_current_user)
end
end
end

View file

@ -1,6 +1,7 @@
class Registrar::SessionsController < Devise::SessionsController
layout 'registrar/application'
class Registrar
class SessionsController < Devise::SessionsController
helper_method :depp_controller?
def depp_controller?
false
end
@ -59,6 +60,7 @@ class Registrar::SessionsController < Devise::SessionsController
render 'login'
end
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
@ -76,6 +78,7 @@ class Registrar::SessionsController < Devise::SessionsController
redirect_to registrar_root_url
end
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/PerceivedComplexity
@ -128,6 +131,7 @@ class Registrar::SessionsController < Devise::SessionsController
render json: { message: t(:no_such_user) }, status: :unauthorized
end
end
# rubocop:enable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
@ -169,6 +173,7 @@ class Registrar::SessionsController < Devise::SessionsController
render json: { message: t(:internal_error) }, status: :bad_request
end
end
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/MethodLength
@ -186,3 +191,4 @@ class Registrar::SessionsController < Devise::SessionsController
render text: t('access_denied') and return
end
end
end

View file

@ -1,4 +1,5 @@
class Registrar::XmlConsolesController < Registrar::DeppController # EPP controller
class Registrar
class XmlConsolesController < DeppController
authorize_resource class: false
def show
@ -21,3 +22,4 @@ class Registrar::XmlConsolesController < Registrar::DeppController # EPP control
render text: xml
end
end
end

View file

@ -1,37 +0,0 @@
class RegistrarController < ApplicationController
before_action :authenticate_user!, :check_ip
layout 'registrar/application'
include Registrar::ApplicationHelper
helper_method :depp_controller?
def depp_controller?
false
end
def check_ip
return unless current_user
unless current_user.is_a? ApiUser
sign_out(current_user)
return
end
return if Rails.env.development?
registrar_ip_whitelisted = current_user.registrar.registrar_ip_white?(request.ip)
return if registrar_ip_whitelisted
flash[:alert] = t('ip_is_not_whitelisted')
sign_out(current_user)
redirect_to registrar_login_path and return
end
helper_method :head_title_sufix
def head_title_sufix
t(:registrar_head_title_sufix)
end
private
def current_ability
@current_ability ||= Ability.new(current_user, request.remote_ip)
end
end

View file

@ -3,4 +3,8 @@ class DefaultFormBuilder < ActionView::Helpers::FormBuilder
self.multipart = true
@template.legal_document_field(@object_name, method, objectify_options(options))
end
def money_field(method, options = {})
@template.money_field(@object_name, method, objectify_options(options))
end
end

View file

@ -5,4 +5,11 @@ module FormHelper
file_field(object_name, method, options)
end
def money_field(object_name, method, options = {})
options[:pattern] = '^[0-9.,]+$' unless options[:pattern]
options[:maxlength] = 255 unless options[:maxlength]
text_field(object_name, method, options)
end
end

View file

@ -93,10 +93,10 @@ class Ability
can :manage, Setting
can :manage, BlockedDomain
can :manage, ReservedDomain
can :manage, ZonefileSetting
can :manage, DNS::Zone
can :manage, DomainVersion
can :manage, ContactVersion
can :manage, Pricelist
can :manage, Billing::Price
can :manage, User
can :manage, ApiUser
can :manage, AdminUser

5
app/models/billing.rb Normal file
View file

@ -0,0 +1,5 @@
module Billing
def self.use_relative_model_naming?
true
end
end

View file

@ -0,0 +1,77 @@
module Billing
class Price < ActiveRecord::Base
include Versions
has_paper_trail class_name: '::PriceVersion'
self.auto_html5_validation = false
belongs_to :zone, class_name: 'DNS::Zone', required: true
validates :price, :valid_from, :operation_category, :duration, presence: true
validates :operation_category, inclusion: { in: Proc.new { |price| price.class.operation_categories } }
validates :duration, inclusion: { in: Proc.new { |price| price.class.durations } }
monetize :price_cents, allow_nil: true, numericality: { greater_than_or_equal_to: 0 }
after_initialize :init_values
def self.operation_categories
%w[create renew]
end
def self.durations
[
'3 mons',
'6 mons',
'9 mons',
'1 year',
'2 years',
'3 years',
'4 years',
'5 years',
'6 years',
'7 years',
'8 years',
'9 years',
'10 years',
]
end
def self.valid
where('valid_from <= ? AND (valid_to >= ? OR valid_to IS NULL)', Time.zone.now.end_of_day,
Time.zone.now.beginning_of_day)
end
def self.price_for(zone, operation_category, duration)
lists = valid.where(zone: zone, operation_category: operation_category, duration: duration)
return lists.first if lists.count == 1
lists.order(valid_from: :desc).first
end
def name
"#{operation_category} #{zone_name}"
end
def years_amount
duration.to_i
end
def price_decimal
price_cents / BigDecimal.new('100')
end
def zone_name
zone.origin
end
private
def to_partial_path
'price'
end
def init_values
return unless new_record?
self.valid_from = Time.zone.now.beginning_of_year unless valid_from
end
end
end

View file

@ -14,7 +14,21 @@ module Depp
clientUpdateProhibited
)
PERIODS = [['1 year', '1y'], ['2 years', '2y'], ['3 years', '3y']]
PERIODS = [
['3 months', '3m'],
['6 months', '6m'],
['9 months', '9m'],
['1 year', '1y'],
['2 years', '2y'],
['3 years', '3y'],
['4 years', '4y'],
['5 years', '5y'],
['6 years', '6y'],
['7 years', '7y'],
['8 years', '8y'],
['9 years', '9y'],
['10 years', '10y'],
]
def initialize(args = {})
self.current_user = args[:current_user]
@ -40,10 +54,13 @@ module Depp
keys = Domain.create_dnskeys_hash(domain_params)
dns_hash[:_anonymus] = keys if keys.any?
period = domain_params[:period].to_i.to_s
period_unit = domain_params[:period][-1].to_s
if domain_params[:nameservers_attributes].select { |key, value| value['hostname'].present? }.any?
xml = epp_xml.create({
name: { value: domain_params[:name] },
period: { value: domain_params[:period].to_s[0], attrs: { unit: domain_params[:period].to_s[1] } },
period: { value: period, attrs: { unit: period_unit } },
ns: Domain.create_nameservers_hash(domain_params),
registrant: { value: domain_params[:registrant] },
_anonymus: Domain.create_contacts_hash(domain_params)
@ -51,7 +68,7 @@ module Depp
else
xml = epp_xml.create({
name: { value: domain_params[:name] },
period: { value: domain_params[:period].to_s[0], attrs: { unit: domain_params[:period].to_s[1] } },
period: { value: period, attrs: { unit: period_unit } },
registrant: { value: domain_params[:registrant] },
_anonymus: Domain.create_contacts_hash(domain_params)
}, dns_hash, Domain.construct_custom_params_hash(domain_params))
@ -83,10 +100,13 @@ module Depp
end
def renew(params)
period = params[:period].to_i.to_s
period_unit = params[:period][-1].to_s
current_user.request(epp_xml.renew(
name: { value: params[:domain_name] },
curExpDate: { value: params[:cur_exp_date] },
period: { value: params[:period].to_s[0], attrs: { unit: params[:period].to_s[1] } }
period: { value: period, attrs: { unit: period_unit } }
))
end

5
app/models/dns.rb Normal file
View file

@ -0,0 +1,5 @@
module DNS
def self.use_relative_model_naming?
true
end
end

49
app/models/dns/zone.rb Normal file
View file

@ -0,0 +1,49 @@
module DNS
class Zone < ActiveRecord::Base
self.auto_html5_validation = false
validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, :master_nameserver, presence: true
validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true }
validates :origin, uniqueness: true
before_destroy do
!used?
end
def self.generate_zonefiles
pluck(:origin).each do |origin|
generate_zonefile(origin)
end
end
def self.generate_zonefile(origin)
filename = "#{origin}.zone"
STDOUT << "#{Time.zone.now.utc} - Generating zonefile #{filename}\n"
zf = ActiveRecord::Base.connection.execute(
"select generate_zonefile('#{origin}')"
)[0]['generate_zonefile']
File.open("#{ENV['zonefile_export_dir']}/#{filename}", 'w') { |f| f.write(zf) }
STDOUT << "#{Time.zone.now.utc} - Successfully generated zonefile #{filename}\n"
end
def self.origins
pluck(:origin)
end
def used?
Domain.uses_zone?(self)
end
def to_s
origin
end
def to_partial_path
'zone'
end
end
end

View file

@ -107,7 +107,6 @@ class Domain < ActiveRecord::Base
validates :period, numericality: { only_integer: true }
validates :registrant, :registrar, presence: true
validate :validate_period
validate :validate_reservation
def validate_reservation
return if persisted? || !in_reserved_list?
@ -229,12 +228,6 @@ class Domain < ActiveRecord::Base
end
class << self
def convert_period_to_time(period, unit)
return (period.to_i / 365).years if unit == 'd'
return (period.to_i / 12).years if unit == 'm'
return period.to_i.years if unit == 'y'
end
def included
includes(
:registrant,
@ -450,18 +443,16 @@ class Domain < ActiveRecord::Base
self.delete_at = nil
end
def pricelist(operation, period_i = nil, unit = nil)
def pricelist(operation_category, period_i = nil, unit = nil)
period_i ||= period
unit ||= period_unit
# TODO: test if name.scan(/\.(.+)\z/).first.first is faster
zone = name.split('.').drop(1).join('.')
zone_name = name.split('.').drop(1).join('.')
zone = DNS::Zone.find_by(origin: zone_name)
p = period_i / 365 if unit == 'd'
p = period_i / 12 if unit == 'm'
p = period_i if unit == 'y'
duration = "P#{period_i}#{unit.upcase}"
Pricelist.pricelist_for(zone, operation, "#{p}year".pluralize(p))
Billing::Price.price_for(zone, operation_category, duration)
end
### VALIDATIONS ###
@ -476,19 +467,6 @@ class Domain < ActiveRecord::Base
end
end
def validate_period
return unless period.present?
if period_unit == 'd'
valid_values = %w(365 730 1095)
elsif period_unit == 'm'
valid_values = %w(12 24 36)
else
valid_values = %w(1 2 3)
end
errors.add(:period, :out_of_range) unless valid_values.include?(period.to_s)
end
# used for highlighting form tabs
def parent_valid?
assoc_errors = errors.keys.select { |x| x.match(/\./) }
@ -724,5 +702,9 @@ class Domain < ActiveRecord::Base
def self.delete_candidates
where("#{attribute_alias(:delete_time)} < ?", Time.zone.now)
end
def self.uses_zone?(zone)
exists?(["name ILIKE ?", "%.#{zone.origin}"])
end
end
# rubocop: enable Metrics/ClassLength

View file

@ -55,7 +55,12 @@ class Epp::Domain < Domain
domain.attach_default_contacts
domain.registered_at = Time.zone.now
domain.valid_from = Time.zone.now
domain.valid_to = domain.valid_from.beginning_of_day + convert_period_to_time(domain.period, domain.period_unit) + 1.day
period = domain.period.to_i
plural_period_unit_name = (domain.period_unit == 'm' ? 'months' : 'years').to_sym
expire_time = (Time.zone.now.advance(plural_period_unit_name => period) + 1.day).beginning_of_day
domain.expire_time = expire_time
domain
end
end
@ -109,7 +114,6 @@ class Epp::Domain < Domain
[:base, :domain_status_prohibits_operation]
],
'2306' => [ # Parameter policy error
[:period, :out_of_range, { value: { obj: 'period', val: period } }],
[:base, :ds_data_with_key_not_allowed],
[:base, :ds_data_not_allowed],
[:base, :key_data_not_allowed],
@ -588,8 +592,6 @@ class Epp::Domain < Domain
save(validate: false)
end
### RENEW ###
def renew(cur_exp_date, period, unit = 'y')
@is_renewal = true
validate_exp_dates(cur_exp_date)
@ -597,11 +599,11 @@ class Epp::Domain < Domain
add_epp_error('2105', nil, nil, I18n.t('object_is_not_eligible_for_renewal')) unless renewable?
return false if errors.any?
p = self.class.convert_period_to_time(period, unit)
renewed_expire_time = valid_to + p
period = period.to_i
plural_period_unit_name = (unit == 'm' ? 'months' : 'years').to_sym
renewed_expire_time = valid_to.advance(plural_period_unit_name => period.to_i)
# Change it when Pricelist model periods change
max_reg_time = 4.years.from_now
max_reg_time = 11.years.from_now
if renewed_expire_time >= max_reg_time
add_epp_error('2105', nil, nil, I18n.t('epp.domains.object_is_not_eligible_for_renewal',
@ -609,7 +611,7 @@ class Epp::Domain < Domain
return false if errors.any?
end
self.valid_to = renewed_expire_time
self.expire_time = renewed_expire_time
self.outzone_at = nil
self.delete_at = nil
self.period = period

View file

@ -1,47 +0,0 @@
class Pricelist < ActiveRecord::Base
include Versions # version/pricelist_version.rb
scope :valid, lambda {
where(
"valid_from <= ? AND (valid_to >= ? OR valid_to IS NULL)",
Time.zone.now.end_of_day, Time.zone.now.beginning_of_day
)
}
scope :valid_at, ->(time){ where("valid_from IS NULL OR valid_from <= ?", time).where("valid_to IS NULL OR valid_to >= ?", time) }
monetize :price_cents
validates :price_cents, :price_currency, :price,
:valid_from, :category, :operation_category, :duration, presence: true
CATEGORIES = %w(ee pri.ee fie.ee med.ee com.ee)
OPERATION_CATEGORIES = %w(create renew)
DURATIONS = %w(1year 2years 3years)
after_initialize :init_values
def init_values
return unless new_record?
self.valid_from = Time.zone.now.beginning_of_year unless valid_from
end
def name
"#{operation_category} #{category}"
end
def years_amount
duration.to_i
end
def price_decimal
price_cents / BigDecimal.new('100')
end
class << self
def pricelist_for(zone, operation, period)
lists = valid.where(category: zone, operation_category: operation, duration: period)
return lists.first if lists.count == 1
lists.order(valid_from: :desc).first
end
end
end

View file

@ -1,4 +1,4 @@
class PricelistVersion < PaperTrail::Version
class PriceVersion < PaperTrail::Version
self.table_name = :log_pricelists
self.sequence_name = :log_pricelists_id_seq
end

View file

@ -1,5 +0,0 @@
class ZonefileSettingVersion < PaperTrail::Version
include VersionSession
self.table_name = :log_zonefile_settings
self.sequence_name = :log_zonefile_settings_id_seq
end

View file

@ -1,42 +0,0 @@
class ZonefileSetting < ActiveRecord::Base
include Versions # version/zonefile_setting_version.rb
validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, :master_nameserver, presence: true
validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true }
validates :origin, uniqueness: true
before_destroy :check_for_dependencies
def check_for_dependencies
dc = Domain.where("name ILIKE ?", "%.#{origin}").count
return if dc == 0
errors.add(:base, I18n.t('there_are_count_domains_in_this_zone', count: dc))
false
end
def self.generate_zonefiles
pluck(:origin).each do |origin|
generate_zonefile(origin)
end
end
def self.generate_zonefile(origin)
filename = "#{origin}.zone"
STDOUT << "#{Time.zone.now.utc} - Generating zonefile #{filename}\n"
zf = ActiveRecord::Base.connection.execute(
"select generate_zonefile('#{origin}')"
)[0]['generate_zonefile']
File.open("#{ENV['zonefile_export_dir']}/#{filename}", 'w') { |f| f.write(zf) }
STDOUT << "#{Time.zone.now.utc} - Successfully generated zonefile #{filename}\n"
end
def self.origins
pluck(:origin)
end
def to_s
origin
end
end

View file

@ -12,7 +12,7 @@ class DomainNameValidator < ActiveModel::EachValidator
return true unless value
value = value.mb_chars.downcase.strip
origins = ZonefileSetting.origins
origins = DNS::Zone.origins
# if someone tries to register an origin domain, let this validation pass
# the error will be caught in blocked domains validator
return true if origins.include?(value)
@ -38,7 +38,7 @@ class DomainNameValidator < ActiveModel::EachValidator
def validate_blocked(value)
return true unless value
return false if BlockedDomain.where(name: value).count > 0
ZonefileSetting.where(origin: value).count.zero?
DNS::Zone.where(origin: value).count.zero?
end
end
end

View file

@ -19,8 +19,8 @@
%li= link_to t('.admin_users'), admin_admin_users_path
%li.divider
%li.dropdown-header= t(:billing)
- if can? :view, Pricelist
%li= link_to t(:pricelists), admin_pricelists_path
- if can? :view, Billing::Price
%li= link_to t('.prices'), admin_prices_path
%li= link_to t(:bank_statements), admin_bank_statements_path
%li= link_to t(:invoices), admin_invoices_path
%li= link_to t(:account_activities), admin_account_activities_path(created_after: 'today')
@ -31,7 +31,7 @@
%li.divider
%li.dropdown-header= t(:system)
%li= link_to t(:settings), admin_settings_path
%li= link_to t(:zonefile), admin_zonefile_settings_path
%li= link_to t('.zones'), admin_zones_path
%li= link_to t('.blocked_domains'), admin_blocked_domains_path
%li= link_to t('.reserved_domains'), admin_reserved_domains_path
%li= link_to t(:mail_templates), admin_mail_templates_path

View file

@ -0,0 +1,60 @@
<%= form_for [:admin, price], html: { class: 'form-horizontal' } do |f| %>
<%= render 'form_errors', target: price %>
<div class="form-group">
<%= f.label :zone_id, class: 'col-sm-2 control-label' %>
<div class="col-sm-3">
<%= f.collection_select :zone_id, zones, :id, :origin, {}, class: 'form-control', required: true %>
</div>
</div>
<div class="form-group">
<%= f.label :operation_category, class: 'col-sm-2 control-label' %>
<div class="col-sm-3">
<%= f.select :operation_category, operation_categories, {}, class: 'form-control', required: true %>
</div>
</div>
<div class="form-group">
<%= f.label :duration, class: 'col-sm-2 control-label' %>
<div class="col-sm-3">
<%= f.select :duration, durations, {}, class: 'form-control', required: true %>
</div>
</div>
<div class="form-group">
<%= f.label :price, class: 'col-sm-2 control-label' %>
<div class="col-sm-3">
<div class="input-group">
<%= f.money_field :price, class: 'form-control', required: true %>
<div class="input-group-addon"><%= Money::default_currency.symbol %></div>
</div>
</div>
</div>
<div class="form-group">
<%= f.label :valid_from, class: 'col-sm-2 control-label' %>
<div class="col-sm-6">
<div class="input-group">
<%= f.text_field :valid_from, value: f.object.valid_from.try(:to_s, :dshort),
class: 'form-control datepicker' %>
<span class="input-group-addon">-</span>
<%= f.text_field :valid_to, value: f.object.valid_to.try(:to_s, :dshort),
class: 'form-control datepicker' %>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-8 text-right">
<%= f.submit t(".#{f.object.new_record? ? 'create' : 'update'}_btn"), class: 'btn btn-success', name: nil %>
</div>
</div>
<% end %>

View file

@ -0,0 +1,8 @@
<tr>
<td><%= link_to price.zone_name, edit_admin_price_path(price), id: 'admin-edit-price-btn' %></td>
<td><%= price.duration.sub('mons', 'months') %></td>
<td><%= price.operation_category %></td>
<td><%= number_to_currency price.price %></td>
<td><%= l price.valid_from, format: :date %></td>
<td><%= l price.valid_to, format: :date %></td>
</tr>

View file

@ -0,0 +1,31 @@
<ol class="breadcrumb">
<li><%= link_to t('admin.billing.prices.index.title'), admin_prices_path %></li>
</ol>
<div class="page-header">
<div class="row">
<div class="col-sm-10">
<h1><%= t '.title' %></h1>
</div>
<div class="col-sm-2 text-right">
<%= link_to(t('.delete_btn'), admin_price_path(@price),
method: :delete,
data: { confirm: t('.delete_btn_confirm') },
class: 'btn btn-danger') %>
</div>
</div>
</div>
<% if @price.persisted? && @price.errors.none? %>
<div class="alert alert-info">
<% active_price = ::Billing::Price.price_for(@price.zone, @price.operation_category, @price.duration) %>
<% if active_price %>
<%= t('active_price_for_this_operation_is', price: "#{active_price.price.amount.to_s} EUR") %>
<% else %>
<%= t('active_price_missing_for_this_operation') %>
<% end %>
</div>
<% end %>
<%= render 'form', price: @price %>

View file

@ -0,0 +1,40 @@
<div class="page-header">
<div class="row">
<div class="col-sm-10">
<h1><%= t '.title' %></h1>
</div>
<div class="col-sm-2 text-right">
<%= link_to t('.new_btn'), new_admin_price_path, class: 'btn btn-primary' %>
</div>
</div>
</div>
<% if @prices.present? %>
<table class="table table-hover table-bordered table-wrapped">
<thead>
<tr>
<th><%= sort_link(@q, 'zone_id', DNS::Zone.model_name.human) %></th>
<th><%= sort_link(@q, 'duration', ::Billing::Price.human_attribute_name(:duration)) %></th>
<th><%= sort_link(@q, 'operation_category', ::Billing::Price.human_attribute_name(:operation)) %></th>
<th><%= sort_link(@q, 'price', t(:price)) %></th>
<th><%= sort_link(@q, 'valid_from', t(:valid_from)) %></th>
<th><%= sort_link(@q, 'valid_to', t(:valid_to)) %></th>
</tr>
</thead>
<tbody>
<% @prices.each do |price| %>
<%= render 'price', price: price %>
<% end %>
</tbody>
</table>
<div class="row">
<div class="col-md-12">
<%= paginate @prices %>
</div>
</div>
<% else %>
<div class="alert alert-info"><%= t '.not_found' %></div>
<% end %>

View file

@ -0,0 +1,9 @@
<ol class="breadcrumb">
<li><%= link_to t('admin.billing.prices.index.title'), admin_prices_path %></li>
</ol>
<div class="page-header">
<h1><%= t '.title' %></h1>
</div>
<%= render 'form', price: @price %>

View file

@ -1,5 +1,4 @@
= form_for [:admin, @zonefile_setting], html: { class: 'form-horizontal' } do |f|
= form_for [:admin, zone], html: { class: 'form-horizontal' } do |f|
.row
.col-md-8
#domain-statuses
@ -9,52 +8,52 @@
.col-md-4.control-label
= f.label :origin
.col-md-8
- if @zonefile_setting.persisted?
= f.text_field :origin, class: 'form-control', disabled: true
- if f.object.new_record?
= f.text_field :origin, class: 'form-control', required: true
- else
= f.text_field :origin, class: 'form-control'
= f.text_field :origin, class: 'form-control', disabled: true
.form-group
.col-md-4.control-label
= f.label :ttl
.col-md-8
= f.text_field :ttl, class: 'form-control'
= f.number_field :ttl, class: 'form-control', required: true
.form-group
.col-md-4.control-label
= f.label :refresh
.col-md-8
= f.text_field :refresh, class: 'form-control'
= f.number_field :refresh, class: 'form-control', required: true
.form-group
.col-md-4.control-label
= f.label :retry
.col-md-8
= f.text_field :retry, class: 'form-control'
= f.number_field :retry, class: 'form-control', required: true
.form-group
.col-md-4.control-label
= f.label :expire
.col-md-8
= f.text_field :expire, class: 'form-control'
= f.number_field :expire, class: 'form-control', required: true
.form-group
.col-md-4.control-label
= f.label :minimum_ttl
.col-md-8
= f.text_field :minimum_ttl, class: 'form-control'
= f.number_field :minimum_ttl, class: 'form-control', required: true
.form-group
.col-md-4.control-label
= f.label :email
.col-md-8
= f.text_field :email, class: 'form-control'
= f.text_field :email, class: 'form-control', required: true
.form-group
.col-md-4.control-label
= f.label :master_nameserver
.col-md-8
= f.text_field :master_nameserver, class: 'form-control'
= f.text_field :master_nameserver, class: 'form-control', required: true
.form-group
.col-md-4.control-label
@ -70,11 +69,11 @@
.form-group
.col-md-4.control-label
= f.label :a4_records, t(:a4_records)
= f.label :a4_records
.col-md-8
= f.text_area :a4_records, class: 'form-control', rows: 8
%hr
.row
.col-md-8.text-right
%button.btn.btn-primary= t(:save)
%button.btn.btn-success= t(".#{zone.new_record? ? 'create' : 'update'}_btn")

View file

@ -0,0 +1,9 @@
<tr>
<td><%= zone.origin %></td>
<td>
<%= link_to t('.edit_btn'), edit_admin_zone_path(zone), class: 'btn btn-xs btn-primary' %>
<%= link_to t('.generate_zone_file_btn'),
admin_zonefiles_path(origin: zone.origin),
method: 'post', class: 'btn btn-xs btn-primary' %>
</td>
</tr>

View file

@ -0,0 +1,20 @@
<ol class="breadcrumb">
<li><%= link_to t('admin.dns.zones.index.title'), admin_zones_path %></li>
</ol>
<div class="page-header">
<div class="row">
<div class="col-sm-10">
<h1><%= t '.title' %></h1>
</div>
<div class="col-sm-2 text-right">
<%= link_to(t('.delete_btn'), admin_zone_path(@zone),
method: :delete,
data: { confirm: t('.delete_btn_confirm') },
class: 'btn btn-danger') %>
</div>
</div>
</div>
<%= render 'form', zone: @zone %>

View file

@ -0,0 +1,28 @@
<div class="page-header">
<div class="row">
<div class="col-sm-10">
<h1><%= t '.title' %></h1>
</div>
<div class="col-sm-2 text-right">
<%= link_to t('.new_btn'), new_admin_zone_path, class: 'btn btn-primary' %>
</div>
</div>
</div>
<% if @zones.present? %>
<table class="table table-hover table-bordered table-wrapped">
<thead>
<tr>
<th><%= DNS::Zone.human_attribute_name :origin %></th>
<th></th>
</tr>
</thead>
<tbody>
<%= render @zones %>
</tbody>
</table>
<% else %>
<div class="alert alert-info"><%= t '.not_found' %></div>
<% end %>

View file

@ -0,0 +1,9 @@
<ol class="breadcrumb">
<li><%= link_to t('admin.dns.zones.index.title'), admin_zones_path %></li>
</ol>
<div class="page-header">
<h1><%= t '.title' %></h1>
</div>
<%= render 'form', zone: @zone %>

View file

@ -1,35 +0,0 @@
= form_for([:admin, @pricelist], multipart: true) do |f|
= render 'shared/errors', object: f.object
.row
.col-md-6
.form-group
= f.label :operation_category
= f.select(:operation_category, Pricelist::OPERATION_CATEGORIES, {}, { class: 'form-control' })
.form-group
= f.label :category, t(:category)
= f.select(:category, Pricelist::CATEGORIES, {}, { class: 'form-control' })
.form-group
= f.label :duration
= f.select(:duration, Pricelist::DURATIONS, {}, { class: 'form-control' })
.form-group
= f.label :price
.input-group
= f.text_field(:price, value: currency(f.object.price), class: 'form-control')
%span.input-group-addon= Money.default_currency
.form-group.input-daterange
= f.label :valid_from, t(:valid)
.input-group
= f.text_field(:valid_from, value: f.object.valid_from.try(:to_s, :dshort),
class: 'form-control datepicker')
%span.input-group-addon -
= f.text_field(:valid_to, value: f.object.valid_to.try(:to_s, :dshort),
class: 'form-control datepicker')
%hr
.row
.col-md-12.text-right
= button_tag(t(:save), class: 'btn btn-warning')
- if !f.object.new_record? && can?(:delete, f.object)
= link_to t(:delete), admin_pricelist_path(f.object),
method: :delete, data: { confirm: t(:are_you_sure_destroy) }, class: 'btn btn-danger'

View file

@ -1,14 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= "#{t(:edit)}: #{@pricelist.name}"
- if @pricelist.persisted? && @pricelist.errors.none?
%hr
- active_pricelist = Pricelist.pricelist_for(@pricelist.category, @pricelist.operation_category, @pricelist.duration)
- if active_pricelist
= t('active_price_for_this_operation_is', price: "#{active_pricelist.price.amount.to_s} #{active_pricelist.price_currency}")
- else
= t('active_price_missing_for_this_operation')
%hr
= render 'form'

View file

@ -1,43 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= t(:pricelists)
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t(:new), new_admin_pricelist_path, class: 'btn btn-primary')
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
= sort_link(@q, 'category', t(:category))
%th{class: 'col-xs-2'}
= sort_link(@q, 'duration', t(:duration))
%th{class: 'col-xs-2'}
= sort_link(@q, 'operation_category', t(:operation))
%th{class: 'col-xs-2'}
= sort_link(@q, 'price', t(:price))
%th{class: 'col-xs-2'}
= sort_link(@q, 'valid_from', t(:valid_from))
%th{class: 'col-xs-2'}
= sort_link(@q, 'valid_to', t(:valid_to))
%th{class: 'col-xs-2'}
= t(:action)
%tbody
- @pricelists.each do |pricelist|
%tr
%td= pricelist.category
%td= pricelist.duration
%td= pricelist.operation_category
%td= currency(pricelist.price)
%td= l(pricelist.valid_from, format: :ydate)
%td= l(pricelist.valid_to, format: :ydate)
%td= link_to(t(:edit), edit_admin_pricelist_path(pricelist), class: 'btn btn-xs btn-primary')
.row
.col-md-12
= paginate @pricelists

View file

@ -1,3 +0,0 @@
%h2= t(:new_price)
%hr
= render 'form'

View file

@ -1,7 +0,0 @@
- content_for :actions do
= link_to(t(:back), admin_zonefile_settings_path, class: 'btn btn-default')
= link_to(t(:delete), admin_zonefile_setting_path(@zonefile_setting),
method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger')
= render 'shared/title', name: t(:edit_zone)
= render 'form'

View file

@ -1,22 +0,0 @@
- content_for :actions do
= link_to(t(:new), new_admin_zonefile_setting_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:zonefile_settings)
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-10'}
= t(:origin)
%th{class: 'col-xs-2'}
= t(:action)
%tbody
- @zonefile_settings.each do |x|
%tr
%td= link_to(x, edit_admin_zonefile_setting_path(x))
%td
= link_to(t(:generate_zonefile),
admin_zonefiles_path(origin: x.origin),
method: 'post', class: 'btn btn-xs btn-primary')

View file

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

View file

@ -0,0 +1,11 @@
<% if target.errors.any? %>
<div class="alert alert-danger">
<p><%= pluralize(target.errors.count, 'error') %> prohibited this <%= target.model_name.human.downcase %> from being saved:</p>
<ul>
<% target.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>

View file

@ -1,75 +0,0 @@
!!! 5
%html{lang: I18n.locale.to_s}
%head
%meta{charset: "utf-8"}/
%meta{content: "IE=edge", "http-equiv" => "X-UA-Compatible"}/
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
%meta{content: "Full stack top-level domain (TLD) management.", name: "description"}/
%meta{content: "Gitlab LTD", name: "author"}/
- if content_for? :head_title
= yield :head_title
- else
%title= t(:registrar_head_title)
= csrf_meta_tags
= stylesheet_link_tag 'registrar-manifest', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'registrar-manifest', 'data-turbolinks-track' => true
= favicon_link_tag 'favicon.ico'
%body
/ Fixed navbar
%nav.navbar.navbar-default.navbar-fixed-top
.container
.navbar-header
%button.navbar-toggle.collapsed{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to main_app.registrar_root_path, class: 'navbar-brand' do
= t(:registrar_head_title)
- if unstable_env.present?
.text-center
%small{style: 'color: #0074B3;'}= unstable_env
- if current_user
.navbar-collapse.collapse
%ul.nav.navbar-nav.public-nav
- if can? :view, Depp::Domain
- active_class = %w(registrar/domains registrar/check registrar/renew registrar/tranfer registrar/keyrelays).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:domains), registrar_domains_path
- if can? :view, Depp::Contact
- active_class = ['registrar/contacts'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:contacts), registrar_contacts_path
- if can? :show, Invoice
- active_class = ['registrar/invoices'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:billing), registrar_invoices_path
- if !Rails.env.production? && can?(:manage, :xml_console)
- active_class = ['registrar/xml_consoles'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path
%ul.nav.navbar-nav.navbar-right
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
= "#{current_user} (#{current_user.roles.first}) - #{current_user.registrar}"
%span.caret
%ul.dropdown-menu{role: "menu"}
- ApiUser.all_by_identity_code(current_user.identity_code).each do |x|
%li= link_to "#{x} (#{x.roles.first}) - #{x.registrar}", "/registrar/switch_user/#{x.id}"
- if user_signed_in?
%li= link_to t(:log_out_), '/registrar/logout'
.container
= render 'shared/flash'
- if depp_controller?
= render 'registrar/shared/epp_results'
= yield
%footer.footer
.container
%row
.col-md-6
= image_tag 'eis-logo-et.png'
.col-md-6.text-right
Version
= CURRENT_COMMIT_HASH

View file

@ -0,0 +1,48 @@
!!! 5
%html{lang: I18n.locale.to_s}
%head
%meta{charset: "utf-8"}/
%meta{content: "IE=edge", "http-equiv" => "X-UA-Compatible"}/
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
%meta{content: "Full stack top-level domain (TLD) management.", name: "description"}/
%meta{content: "Gitlab LTD", name: "author"}/
- if content_for? :head_title
= yield :head_title
- else
%title= t(:registrar_head_title)
= csrf_meta_tags
= stylesheet_link_tag 'registrar-manifest', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'registrar-manifest', 'data-turbolinks-track' => true
= favicon_link_tag 'favicon.ico'
%body
/ Fixed navbar
%nav.navbar.navbar-default.navbar-fixed-top
.container
.navbar-header
%button.navbar-toggle.collapsed{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to main_app.registrar_root_path, class: 'navbar-brand' do
= t(:registrar_head_title)
- if unstable_env.present?
.text-center
%small{style: 'color: #0074B3;'}= unstable_env
- if current_user
= render 'navbar'
.container
= render 'shared/flash'
- if depp_controller?
= render 'registrar/shared/epp_results'
= yield
%footer.footer
.container
%row
.col-md-6
= image_tag 'eis-logo-et.png'
.col-md-6.text-right
Version
= CURRENT_COMMIT_HASH

View file

@ -0,0 +1,11 @@
<% if target.errors.any? %>
<div class="alert alert-danger">
<p><%= pluralize(target.errors.count, 'error') %> prohibited this <%= target.model_name.human.downcase %> from being saved:</p>
<ul>
<% target.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>

View file

@ -0,0 +1,28 @@
.navbar-collapse.collapse
%ul.nav.navbar-nav.public-nav
- if can? :view, Depp::Domain
- active_class = %w(registrar/domains registrar/check registrar/renew registrar/tranfer registrar/keyrelays).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:domains), registrar_domains_path
- if can? :view, Depp::Contact
- active_class = ['registrar/contacts'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:contacts), registrar_contacts_path
- if can? :show, Invoice
- active_class = ['registrar/invoices'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:billing), registrar_invoices_path
- if !Rails.env.production? && can?(:manage, :xml_console)
- active_class = ['registrar/xml_consoles'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path
%ul.nav.navbar-nav.navbar-right
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
= "#{current_user} (#{current_user.roles.first}) - #{current_user.registrar}"
%span.caret
%ul.dropdown-menu{role: "menu"}
- ApiUser.all_by_identity_code(current_user.identity_code).each do |x|
%li= link_to "#{x} (#{x.roles.first}) - #{x.registrar}", "/registrar/switch_user/#{x.id}"
- if user_signed_in?
%li= link_to t(:log_out_), '/registrar/logout'

View file

@ -25,7 +25,7 @@
%dt= t(:payment_term)
%dd= t(@invoice.payment_term)
%dt= t(:"invoice no")
%dt= t(:invoice_number)
%dd= @invoice.number
- if @invoice.description.present?

View file

@ -175,7 +175,7 @@
%dt= t(:payment_term)
%dd= t(@invoice.payment_term)
%dt= t(:"invoice no")
%dt= t(:invoice_number)
%dd= @invoice.number
- if @invoice.description.present?

View file

@ -18,11 +18,6 @@ api_log_development:
<<: *default
database: registry_api_log_development
registrant_write_development:
<<: *default
database: registry_development
test:
<<: *default
database: registry_test
@ -34,8 +29,3 @@ whois_test:
api_log_test:
<<: *default
database: registry_api_log_test
registrant_write_test:
<<: *default
database: registry_test

View file

@ -25,14 +25,6 @@ staging:
username: registrant_read_only
password: registrant_read_only_pwd
registrant_write_staging:
<<: *default
database: registry_development # registry real database
host: localhost
username: registrant_write # user should have write access only to registrant_verifications table
password: registrant_write_pwd
#
# Production config for Registrant
#
@ -43,10 +35,3 @@ production:
host: localhost # registry production mirror location
username: registrant_read_only
password: registrant_read_only_pwd
registrant_write_production:
<<: *default
database: registry_production # registry production database name
host: localhost # registry database location
username: registrant_write # user should have write access only to registrant_verifications table
password: registrant_write_pwd

View file

@ -18,11 +18,6 @@ api_log_test:
<<: *default
database: registry_api_log_test
registrant_write_test:
<<: *default
database: registry_test
# only for testing assets
production:
<<: *default
database: registry_test
@ -34,7 +29,3 @@ whois_test:
api_log_test:
<<: *default
database: registry_api_log_test
registrant_write_test:
<<: *default
database: registry_test

View file

@ -17,7 +17,3 @@ whois_test:
api_log_test:
<<: *default
database: registry_api_log_test
registrant_write_test:
<<: *default
database: registry_test

View file

@ -10,7 +10,6 @@
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym 'DNS'
end

View file

@ -0,0 +1,29 @@
en:
admin:
billing:
prices:
index:
title: Prices
new_btn: New price
not_found: No price found
new:
title: New price
create:
created: Price has been created
edit:
title: Edit price
delete_btn: Delete
delete_btn_confirm: Are you sure you want to delete price?
update:
updated: Price has been updated
destroy:
destroyed: Price has been deleted
form:
create_btn: Create price
update_btn: Update price

View file

@ -0,0 +1,33 @@
en:
admin:
dns:
zones:
index:
title: Zones
new_btn: New zone
not_found: No zone found
new:
title: New zone
create:
created: Zone has been created
edit:
title: Edit zone
delete_btn: Delete
delete_btn_confirm: Are you sure you want to delete zone?
update:
updated: Zone has been updated
destroy:
destroyed: Zone has been deleted
form:
create_btn: Create zone
update_btn: Update zone
zone:
edit_btn: Edit
generate_zone_file_btn: Generate zone file

View file

@ -4,9 +4,11 @@ en:
users: Users
api_users: API users
admin_users: Admin users
prices: Prices
archive: Archive
domain_history: Domain history
contact_history: Contact history
zones: Zones
blocked_domains: Blocked domains
reserved_domains: Reserved domains
epp_log: EPP log

View file

@ -104,7 +104,6 @@ en:
less_than_or_equal_to: 'Nameservers count must be less than or equal to %{count}'
greater_than_or_equal_to: 'Nameservers count must be greater than or equal to %{count}'
period:
out_of_range: 'Period must add up to 1, 2 or 3 years'
not_a_number: 'Period is not a number'
not_an_integer: 'Period must be an integer'
auth_info:
@ -232,14 +231,6 @@ en:
protocol: 'Protocol'
alg: 'Algorithm'
public_key: 'Public key'
zonefile_setting:
ttl: 'TTL'
refresh: 'Refresh'
retry: 'Retry'
expire: 'Expire'
minimum_ttl: 'Minimum TTL'
email: 'E-Mail'
registrar:
billing_email: 'Billing e-mail'
phone: 'Contact phone'
@ -305,7 +296,6 @@ en:
description: 'Description'
delete: 'Delete'
are_you_sure: 'Are you sure?'
are_you_sure_destroy: 'You are going to delete, are you sure?'
back: 'Back'
new_domain: 'New domain'
registrar_name: 'Registrar name'
@ -436,7 +426,6 @@ en:
transfer_requested: 'Transfer requested.'
message_was_not_found: 'Message was not found'
host_obj_is_not_allowed: 'hostObj object is not allowed'
generate_zonefile: 'Generate zonefile'
zonefile: 'Zonefile'
only_one_parameter_allowed: 'Only one parameter allowed: %{param_1} or %{param_2}'
exactly_one_parameter_required: 'Exactly one parameter required: %{params}'
@ -450,7 +439,6 @@ en:
ds_data_with_key_allowed: 'Allow DS data with key'
key_data_allowed: 'Allow key data'
ds_digest_type: 'DS digest type'
zonefile_settings: 'Zonefile settings'
background_jobs: Background jobs
domains_history: Domains history
role: 'Role'
@ -666,6 +654,7 @@ en:
amount: 'Amount'
please_pay_the_following_invoice: 'Please pay the following invoice'
invoice_no: 'Invoice no. %{no}'
invoice_number: Invoice no.
seller: 'Seller'
prepayment: 'Prepayment'
vat: 'VAT (%{vat_prc}%)'
@ -835,10 +824,7 @@ en:
webserver_missing_client_cert_directive: 'Webserver missing client cert directive'
webserver_client_cert_directive_should_be_required: 'Webserver client cert directive should be required'
tech: Tech contact
pricelists: Pricelists
new_pricelist: New Pricelist
valid: Valid
category: Zone
object_is_not_eligible_for_renewal: 'Object is not eligible for renewal'
domain_expiring: 'Domain expiring'
domain_validation_rules: 'Domain validation rules'
@ -893,10 +879,6 @@ en:
result_count: '%{count} results'
failed_to_generate_invoice_invoice_number_limit_reached: 'Failed to generate invoice - invoice number limit reached'
is_too_small_minimum_deposit_is: 'is too small. Minimum deposit is %{amount} %{currency}'
a4_records: 'AAAA records'
new_zone: 'New zone'
edit_zone: 'Edit zone'
there_are_count_domains_in_this_zone: 'There are %{count} domains in this zone'
poll_pending_update_confirmed_by_registrant: 'Registrant confirmed domain update'
poll_pending_update_rejected_by_registrant: 'Registrant rejected domain update'
poll_pending_delete_rejected_by_registrant: 'Registrant rejected domain deletion'
@ -934,3 +916,12 @@ en:
cant_match_version: 'Impossible match version with request'
user_not_authenticated: "user not authenticated"
actions: Actions
number:
currency:
format:
format: "%n %u"
separator: ","
delimiter: " "
precision: 2
unit:

View file

@ -170,10 +170,10 @@ Rails.application.routes.draw do
namespace :admin do
resources :keyrelays
resources :zonefiles
resources :zonefile_settings
resources :zones, controller: 'dns/zones', except: %i[show]
resources :legal_documents
resources :keyrelays
resources :pricelists
resources :prices, controller: 'billing/prices', except: %i[show]
resources :mail_templates
resources :account_activities

View file

@ -14,7 +14,7 @@ set :output, 'log/cron.log'
if @cron_group == 'registry'
every 10.minutes do
runner 'ZonefileSetting.generate_zonefiles'
runner 'DNS::Zone.generate_zonefiles'
end
every 6.months, at: '12:01am' do

View file

@ -0,0 +1,5 @@
class RenameZonefileSettingsToZones < ActiveRecord::Migration
def change
rename_table :zonefile_settings, :zones
end
end

View file

@ -0,0 +1,5 @@
class RemoveLogZonefileSettings < ActiveRecord::Migration
def change
drop_table :log_zonefile_settings
end
end

View file

@ -1,9 +1,9 @@
namespace :zonefile do
desc 'Replace procedure'
task replace_procedure: :environment do
ActiveRecord::Base.connection.execute <<-SQL
CREATE OR REPLACE FUNCTION generate_zonefile(i_origin varchar)
RETURNS text AS $$
class RenameZonefileSettingsInGenerateZonefile < ActiveRecord::Migration
def change
execute <<-SQL
CREATE OR REPLACE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
LANGUAGE plpgsql
AS $_$
DECLARE
zone_header text := concat('$ORIGIN ', i_origin, '.');
serial_num varchar;
@ -16,14 +16,14 @@ namespace :zonefile do
include_filter = '%.' || i_origin;
-- for %.%.%
IF i_origin ~ '\\.' THEN
IF i_origin ~ '.' THEN
exclude_filter := '';
-- for %.%
ELSE
exclude_filter := '%.%.' || i_origin;
END IF;
SELECT (extract(epoch from now() at time zone 'utc'))::int INTO serial_num;
SELECT ROUND(extract(epoch from now() at time zone 'utc')) INTO serial_num;
-- zonefile header
SELECT concat(
@ -36,22 +36,22 @@ namespace :zonefile do
format('%-17s', ''), format('%-12s', zf.expire), '; expire, seconds', chr(10),
format('%-17s', ''), format('%-12s', zf.minimum_ttl), '; minimum TTL, seconds', chr(10),
format('%-17s', ''), ')'
) FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
) FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
ret = concat(tmp_var, chr(10), chr(10));
-- origin ns records
SELECT ns_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
SELECT ns_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10));
-- ns records
SELECT array_to_string(
array(
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
SELECT concat(d.name_puny, '. IN NS ', coalesce(ns.hostname_puny, ns.hostname), '.')
FROM domains d
JOIN nameservers ns ON ns.domain_id = d.id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
AND NOT ('{serverHold,clientHold}' && d.statuses)
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
ORDER BY d.name
),
chr(10)
@ -60,40 +60,40 @@ namespace :zonefile do
ret := concat(ret, tmp_var, chr(10), chr(10));
-- origin a glue records
SELECT a_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
SELECT a_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
ret := concat(ret, '; Zone A Records', chr(10), tmp_var, chr(10));
-- a glue records for other nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN A ', unnest(ns.ipv4))
SELECT concat(coalesce(ns.hostname_puny, ns.hostname), '. IN A ', unnest(ns.ipv4))
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
AND ns.hostname LIKE '%.' || d.name
AND d.name <> i_origin
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> '{}'
AND NOT ('{serverHold,clientHold}' && d.statuses)
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
), chr(10)
) INTO tmp_var;
ret := concat(ret, tmp_var, chr(10), chr(10));
-- origin aaaa glue records
SELECT a4_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
SELECT a4_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var, chr(10));
-- aaaa glue records for other nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN AAAA ', unnest(ns.ipv6))
SELECT concat(coalesce(ns.hostname_puny, ns.hostname), '. IN AAAA ', unnest(ns.ipv6))
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
AND ns.hostname LIKE '%.' || d.name
AND d.name <> i_origin
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> '{}'
AND NOT ('{serverHold,clientHold}' && d.statuses)
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
), chr(10)
) INTO tmp_var;
@ -109,7 +109,7 @@ namespace :zonefile do
FROM domains d
JOIN dnskeys dk ON dk.domain_id = d.id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter AND dk.flags = 257
AND NOT ('{serverHold,clientHold}' && d.statuses)
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
),
chr(10)
) INTO tmp_var;
@ -118,8 +118,7 @@ namespace :zonefile do
RETURN ret;
END;
$$
LANGUAGE plpgsql;
$_$;
SQL
end
end

View file

@ -0,0 +1,7 @@
class ChangePricelistDurationTypeToInterval < ActiveRecord::Migration
def change
execute <<-SQL
ALTER TABLE pricelists ALTER COLUMN duration TYPE interval USING (trim(duration)::interval)
SQL
end
end

View file

@ -0,0 +1,5 @@
class RenamePricelistsToPrices < ActiveRecord::Migration
def change
rename_table :pricelists, :prices
end
end

View file

@ -0,0 +1,5 @@
class ChangePricePriceCentsTypeToInteger < ActiveRecord::Migration
def change
change_column :prices, :price_cents, 'integer USING CAST(price_cents AS integer)'
end
end

View file

@ -0,0 +1,5 @@
class RemovePricePriceCurrency < ActiveRecord::Migration
def change
remove_column :prices, :price_currency, :string
end
end

View file

@ -0,0 +1,5 @@
class RemovePricePriceCentsDefault < ActiveRecord::Migration
def change
change_column_default :prices, :price_cents, nil
end
end

View file

@ -0,0 +1,23 @@
class AddZoneToPrices < ActiveRecord::Migration
def up
add_reference :prices, :zone, index: true
add_foreign_key :prices, :zones
assign_zone_to_current_prices
change_column :prices, :zone_id, :integer, null: false
remove_column :prices, :category, :string
end
def down
raise ActiveRecord::IrreversibleMigration
end
private
def assign_zone_to_current_prices
Billing::Price.all.each do |price|
zone = DNS::Zone.find_by!(origin: price.category)
price.zone = zone
price.save!
end
end
end

View file

@ -0,0 +1,13 @@
class AddUniqueIndexToZoneOrigin < ActiveRecord::Migration
def up
execute <<-SQL
ALTER TABLE zones ADD CONSTRAINT unique_zone_origin UNIQUE (origin)
SQL
end
def down
execute <<-SQL
ALTER TABLE zones DROP CONSTRAINT unique_zone_origin
SQL
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170422130054) do
ActiveRecord::Schema.define(version: 20170424115801) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -914,22 +914,6 @@ ActiveRecord::Schema.define(version: 20170422130054) do
t.string "uuid"
end
create_table "log_zonefile_settings", force: :cascade do |t|
t.string "item_type", null: false
t.integer "item_id", null: false
t.string "event", null: false
t.string "whodunnit"
t.json "object"
t.json "object_changes"
t.datetime "created_at"
t.string "session"
t.json "children"
t.string "uuid"
end
add_index "log_zonefile_settings", ["item_type", "item_id"], name: "index_log_zonefile_settings_on_item_type_and_item_id", using: :btree
add_index "log_zonefile_settings", ["whodunnit"], name: "index_log_zonefile_settings_on_whodunnit", using: :btree
create_table "mail_templates", force: :cascade do |t|
t.string "name", null: false
t.string "subject"
@ -989,11 +973,9 @@ ActiveRecord::Schema.define(version: 20170422130054) do
add_index "people", ["email"], name: "index_people_on_email", unique: true, using: :btree
add_index "people", ["reset_password_token"], name: "index_people_on_reset_password_token", unique: true, using: :btree
create_table "pricelists", force: :cascade do |t|
create_table "prices", force: :cascade do |t|
t.string "desc"
t.string "category"
t.decimal "price_cents", precision: 10, scale: 2, default: 0.0, null: false
t.string "price_currency", default: "EUR", null: false
t.integer "price_cents", null: false
t.datetime "valid_from"
t.datetime "valid_to"
t.string "creator_str"
@ -1002,8 +984,11 @@ ActiveRecord::Schema.define(version: 20170422130054) do
t.datetime "updated_at", null: false
t.string "duration"
t.string "operation_category"
t.integer "zone_id", null: false
end
add_index "prices", ["zone_id"], name: "index_prices_on_zone_id", using: :btree
create_table "que_jobs", id: false, force: :cascade do |t|
t.integer "priority", limit: 2, default: 100, null: false
t.datetime "run_at", default: "now()", null: false
@ -1141,7 +1126,7 @@ ActiveRecord::Schema.define(version: 20170422130054) do
add_index "whois_records", ["domain_id"], name: "index_whois_records_on_domain_id", using: :btree
add_index "whois_records", ["registrar_id"], name: "index_whois_records_on_registrar_id", using: :btree
create_table "zonefile_settings", force: :cascade do |t|
create_table "zones", force: :cascade do |t|
t.string "origin"
t.integer "ttl"
t.integer "refresh"
@ -1159,4 +1144,7 @@ ActiveRecord::Schema.define(version: 20170422130054) do
t.text "a4_records"
end
add_index "zones", ["origin"], name: "unique_zone_origin", unique: true, using: :btree
add_foreign_key "prices", "zones"
end

View file

@ -1,116 +1,36 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
registrar1 = Registrar.where(
name: 'Registrar First AS',
reg_no: '10300220',
street: 'Pärnu mnt 2',
city: 'Tallinn',
state: 'Harju maakond',
zip: '11415',
email: 'registrar1@example.com',
country_code: 'EE',
code: 'REG1'
).first_or_create!
ActiveRecord::Base.transaction do
registrar = Registrar.create!(
name: 'Test',
reg_no: '1234',
street: 'test',
city: 'test',
state: 'test',
zip: '1234',
email: 'test@domain.tld',
country_code: 'US',
code: 'US1'
)
@api_user1 = ApiUser.where(
username: 'registrar1',
).first_or_create!(
password: 'password',
registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
ApiUser.create!(
username: 'test',
password: 'testtest',
identity_code: '51001091072',
active: true,
registrar: registrar1,
registrar: registrar,
roles: ['super']
)
registrar2 = Registrar.where(
name: 'Registrar Second AS',
reg_no: '10529229',
street: 'Vabaduse pst 32',
city: 'Tallinn',
state: 'Harju maakond',
zip: '11315',
email: 'registrar2@example.com',
country_code: 'EE',
code: 'REG2'
).first_or_create!
@api_user2 = ApiUser.where(
username: 'registrar2',
).first_or_create!(
password: 'password',
identity_code: '11412090004',
active: true,
registrar: registrar2,
roles: ['super']
AdminUser.create!(
username: 'test',
email: 'test@domain.tld',
password: 'testtest',
password_confirmation: 'testtest',
country_code: 'US',
roles: ['admin']
)
Registrar.all.each do |x|
x.accounts.where(account_type: Account::CASH, currency: 'EUR').first_or_create!
end
admin1 = {
username: 'user1',
email: 'user1@example.ee',
identity_code: '37810013855',
country_code: 'EE'
}
admin2 = {
username: 'user2',
email: 'user2@example.ee',
identity_code: '37810010085',
country_code: 'EE'
}
admin3 = {
username: 'user3',
email: 'user3@example.ee',
identity_code: '37810010727',
country_code: 'EE'
}
[admin1, admin2, admin3].each do |at|
admin = AdminUser.where(at)
next if admin.present?
admin = AdminUser.new(at.merge({ password_confirmation: 'testtest', password: 'testtest' }))
admin.roles = ['admin']
admin.save
end
ZonefileSetting.where({
origin: 'ee',
ttl: 43200,
refresh: 3600,
retry: 900,
expire: 1209600,
minimum_ttl: 3600,
email: 'hostmaster.eestiinternet.ee',
master_nameserver: 'ns.tld.ee'
}).first_or_create!
ZonefileSetting.where({
origin: 'pri.ee',
ttl: 43200,
refresh: 3600,
retry: 900,
expire: 1209600,
minimum_ttl: 3600,
email: 'hostmaster.eestiinternet.ee',
master_nameserver: 'ns.tld.ee'
}).first_or_create!
# Registrar.where(
# name: 'EIS',
# reg_no: '90010019',
# phone: '+3727271000',
# country_code: 'EE',
# vat_no: 'EE101286464',
# email: 'info@internet.ee',
# state: 'Harjumaa',
# city: 'Tallinn',
# street: 'Paldiski mnt 80',
# zip: '10617',
# url: 'www.internet.ee',
# code: 'EIS'
# ).first_or_create!

View file

@ -192,12 +192,12 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
format('%-17s', ''), format('%-12s', zf.expire), '; expire, seconds', chr(10),
format('%-17s', ''), format('%-12s', zf.minimum_ttl), '; minimum TTL, seconds', chr(10),
format('%-17s', ''), ')'
) FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
) FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
ret = concat(tmp_var, chr(10), chr(10));
-- origin ns records
SELECT ns_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
SELECT ns_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10));
-- ns records
@ -216,7 +216,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
ret := concat(ret, tmp_var, chr(10), chr(10));
-- origin a glue records
SELECT a_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
SELECT a_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
ret := concat(ret, '; Zone A Records', chr(10), tmp_var, chr(10));
-- a glue records for other nameservers
@ -236,7 +236,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
ret := concat(ret, tmp_var, chr(10), chr(10));
-- origin aaaa glue records
SELECT a4_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
SELECT a4_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var, chr(10));
-- aaaa glue records for other nameservers
@ -2374,44 +2374,6 @@ CREATE SEQUENCE log_white_ips_id_seq
ALTER SEQUENCE log_white_ips_id_seq OWNED BY log_white_ips.id;
--
-- Name: log_zonefile_settings; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE log_zonefile_settings (
id integer NOT NULL,
item_type character varying NOT NULL,
item_id integer NOT NULL,
event character varying NOT NULL,
whodunnit character varying,
object json,
object_changes json,
created_at timestamp without time zone,
session character varying,
children json,
uuid character varying
);
--
-- Name: log_zonefile_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE log_zonefile_settings_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: log_zonefile_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE log_zonefile_settings_id_seq OWNED BY log_zonefile_settings.id;
--
-- Name: mail_templates; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
@ -2565,31 +2527,30 @@ ALTER SEQUENCE people_id_seq OWNED BY people.id;
--
-- Name: pricelists; Type: TABLE; Schema: public; Owner: -; Tablespace:
-- Name: prices; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE pricelists (
CREATE TABLE prices (
id integer NOT NULL,
"desc" character varying,
category character varying,
price_cents numeric(10,2) DEFAULT 0.0 NOT NULL,
price_currency character varying DEFAULT 'EUR'::character varying NOT NULL,
price_cents integer NOT NULL,
valid_from timestamp without time zone,
valid_to timestamp without time zone,
creator_str character varying,
updator_str character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
duration character varying,
operation_category character varying
duration interval,
operation_category character varying,
zone_id integer NOT NULL
);
--
-- Name: pricelists_id_seq; Type: SEQUENCE; Schema: public; Owner: -
-- Name: prices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE pricelists_id_seq
CREATE SEQUENCE prices_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@ -2598,10 +2559,10 @@ CREATE SEQUENCE pricelists_id_seq
--
-- Name: pricelists_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
-- Name: prices_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE pricelists_id_seq OWNED BY pricelists.id;
ALTER SEQUENCE prices_id_seq OWNED BY prices.id;
--
@ -2968,10 +2929,10 @@ ALTER SEQUENCE whois_records_id_seq OWNED BY whois_records.id;
--
-- Name: zonefile_settings; Type: TABLE; Schema: public; Owner: -; Tablespace:
-- Name: zones; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE zonefile_settings (
CREATE TABLE zones (
id integer NOT NULL,
origin character varying,
ttl integer,
@ -2992,10 +2953,10 @@ CREATE TABLE zonefile_settings (
--
-- Name: zonefile_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
-- Name: zones_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE zonefile_settings_id_seq
CREATE SEQUENCE zones_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@ -3004,10 +2965,10 @@ CREATE SEQUENCE zonefile_settings_id_seq
--
-- Name: zonefile_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
-- Name: zones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE zonefile_settings_id_seq OWNED BY zonefile_settings.id;
ALTER SEQUENCE zones_id_seq OWNED BY zones.id;
--
@ -3381,13 +3342,6 @@ ALTER TABLE ONLY log_users ALTER COLUMN id SET DEFAULT nextval('log_users_id_seq
ALTER TABLE ONLY log_white_ips ALTER COLUMN id SET DEFAULT nextval('log_white_ips_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY log_zonefile_settings ALTER COLUMN id SET DEFAULT nextval('log_zonefile_settings_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
@ -3420,7 +3374,7 @@ ALTER TABLE ONLY people ALTER COLUMN id SET DEFAULT nextval('people_id_seq'::reg
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY pricelists ALTER COLUMN id SET DEFAULT nextval('pricelists_id_seq'::regclass);
ALTER TABLE ONLY prices ALTER COLUMN id SET DEFAULT nextval('prices_id_seq'::regclass);
--
@ -3490,7 +3444,7 @@ ALTER TABLE ONLY whois_records ALTER COLUMN id SET DEFAULT nextval('whois_record
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY zonefile_settings ALTER COLUMN id SET DEFAULT nextval('zonefile_settings_id_seq'::regclass);
ALTER TABLE ONLY zones ALTER COLUMN id SET DEFAULT nextval('zones_id_seq'::regclass);
--
@ -3917,14 +3871,6 @@ ALTER TABLE ONLY log_white_ips
ADD CONSTRAINT log_white_ips_pkey PRIMARY KEY (id);
--
-- Name: log_zonefile_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY log_zonefile_settings
ADD CONSTRAINT log_zonefile_settings_pkey PRIMARY KEY (id);
--
-- Name: mail_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@ -3958,11 +3904,11 @@ ALTER TABLE ONLY people
--
-- Name: pricelists_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
-- Name: prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY pricelists
ADD CONSTRAINT pricelists_pkey PRIMARY KEY (id);
ALTER TABLE ONLY prices
ADD CONSTRAINT prices_pkey PRIMARY KEY (id);
--
@ -4005,6 +3951,14 @@ ALTER TABLE ONLY settings
ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
--
-- Name: unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY zones
ADD CONSTRAINT unique_zone_origin UNIQUE (origin);
--
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@ -4038,11 +3992,11 @@ ALTER TABLE ONLY whois_records
--
-- Name: zonefile_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
-- Name: zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY zonefile_settings
ADD CONSTRAINT zonefile_settings_pkey PRIMARY KEY (id);
ALTER TABLE ONLY zones
ADD CONSTRAINT zones_pkey PRIMARY KEY (id);
--
@ -4675,20 +4629,6 @@ CREATE INDEX index_log_users_on_item_type_and_item_id ON log_users USING btree (
CREATE INDEX index_log_users_on_whodunnit ON log_users USING btree (whodunnit);
--
-- Name: index_log_zonefile_settings_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_log_zonefile_settings_on_item_type_and_item_id ON log_zonefile_settings USING btree (item_type, item_id);
--
-- Name: index_log_zonefile_settings_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_log_zonefile_settings_on_whodunnit ON log_zonefile_settings USING btree (whodunnit);
--
-- Name: index_messages_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@ -4717,6 +4657,13 @@ CREATE UNIQUE INDEX index_people_on_email ON people USING btree (email);
CREATE UNIQUE INDEX index_people_on_reset_password_token ON people USING btree (reset_password_token);
--
-- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_prices_on_zone_id ON prices USING btree (zone_id);
--
-- Name: index_registrant_verifications_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@ -4822,6 +4769,14 @@ CREATE UNIQUE INDEX unique_data_migrations ON data_migrations USING btree (versi
CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
--
-- Name: fk_rails_78c376257f; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY prices
ADD CONSTRAINT fk_rails_78c376257f FOREIGN KEY (zone_id) REFERENCES zones(id);
--
-- PostgreSQL database dump complete
--
@ -5280,5 +5235,25 @@ INSERT INTO schema_migrations (version) VALUES ('20161227193500');
INSERT INTO schema_migrations (version) VALUES ('20170221115548');
INSERT INTO schema_migrations (version) VALUES ('20170419120048');
INSERT INTO schema_migrations (version) VALUES ('20170420125200');
INSERT INTO schema_migrations (version) VALUES ('20170422130054');
INSERT INTO schema_migrations (version) VALUES ('20170422142116');
INSERT INTO schema_migrations (version) VALUES ('20170422162824');
INSERT INTO schema_migrations (version) VALUES ('20170423151046');
INSERT INTO schema_migrations (version) VALUES ('20170423210622');
INSERT INTO schema_migrations (version) VALUES ('20170423214500');
INSERT INTO schema_migrations (version) VALUES ('20170423222302');
INSERT INTO schema_migrations (version) VALUES ('20170423225333');
INSERT INTO schema_migrations (version) VALUES ('20170424115801');

View file

@ -122,13 +122,6 @@ Crontab can be setup after deploy. Jobs can be viewed [here](/config/schedule.rb
mina pr cron:setup # to update the crontab.
mina pr cron:clear # to clear crontab.
### Zonefile procedure
Zonefile procedure must be set up in server after deploy. The same command must be run whenever procedure is updated (see changelog).
bundle exec rake zonefile:replace_procedure
### Application settings
Application settings locate at [config/application-example.yml](/config/application-example.yml)

View file

@ -77,11 +77,6 @@
<ellipse fill="none" stroke="black" cx="-215" cy="306" rx="109.381" ry="18"/>
<text text-anchor="middle" x="-215" y="309.7" font-family="Times,serif" font-size="14.00">Admin::WhiteIpsController</text>
</g>
<!-- Admin::PricelistsController -->
<g id="node14" class="node"><title>Admin::PricelistsController</title>
<ellipse fill="none" stroke="black" cx="193" cy="-354" rx="108.581" ry="18"/>
<text text-anchor="middle" x="193" y="-350.3" font-family="Times,serif" font-size="14.00">Admin::PricelistsController</text>
</g>
<!-- Admin::ZonefilesController -->
<g id="node15" class="node"><title>Admin::ZonefilesController</title>
<ellipse fill="none" stroke="black" cx="-46" cy="-390" rx="109.681" ry="18"/>
@ -142,11 +137,6 @@
<ellipse fill="none" stroke="black" cx="118" cy="246" rx="118.079" ry="18"/>
<text text-anchor="middle" x="118" y="249.7" font-family="Times,serif" font-size="14.00">Admin::DashboardsController</text>
</g>
<!-- Admin::ZonefileSettingsController -->
<g id="node27" class="node"><title>Admin::ZonefileSettingsController</title>
<ellipse fill="none" stroke="black" cx="135" cy="186" rx="134.576" ry="18"/>
<text text-anchor="middle" x="135" y="189.7" font-family="Times,serif" font-size="14.00">Admin::ZonefileSettingsController</text>
</g>
<!-- Admin::RegistrarsController -->
<g id="node28" class="node"><title>Admin::RegistrarsController</title>
<ellipse fill="none" stroke="black" cx="412" cy="186" rx="112.38" ry="18"/>

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

View file

@ -199,22 +199,6 @@
<text text-anchor="start" x="-492" y="216.2" font-family="Times,serif" font-size="14.00">set_registrar</text>
<text text-anchor="start" x="-492" y="231.2" font-family="Times,serif" font-size="14.00">white_ip_params</text>
</g>
<!-- Admin::PricelistsController -->
<g id="node14" class="node"><title>Admin::PricelistsController</title>
<path fill="none" stroke="black" d="M-488.5,-260.5C-488.5,-260.5 -345.5,-260.5 -345.5,-260.5 -339.5,-260.5 -333.5,-266.5 -333.5,-272.5 -333.5,-272.5 -333.5,-431.5 -333.5,-431.5 -333.5,-437.5 -339.5,-443.5 -345.5,-443.5 -345.5,-443.5 -488.5,-443.5 -488.5,-443.5 -494.5,-443.5 -500.5,-437.5 -500.5,-431.5 -500.5,-431.5 -500.5,-272.5 -500.5,-272.5 -500.5,-266.5 -494.5,-260.5 -488.5,-260.5"/>
<text text-anchor="middle" x="-417" y="-428.3" font-family="Times,serif" font-size="14.00">Admin::PricelistsController</text>
<polyline fill="none" stroke="black" points="-500.5,-420.5 -333.5,-420.5 "/>
<text text-anchor="start" x="-492.5" y="-405.3" font-family="Times,serif" font-size="14.00">create</text>
<text text-anchor="start" x="-492.5" y="-390.3" font-family="Times,serif" font-size="14.00">edit</text>
<text text-anchor="start" x="-492.5" y="-375.3" font-family="Times,serif" font-size="14.00">index</text>
<text text-anchor="start" x="-492.5" y="-360.3" font-family="Times,serif" font-size="14.00">new</text>
<text text-anchor="start" x="-492.5" y="-345.3" font-family="Times,serif" font-size="14.00">update</text>
<polyline fill="none" stroke="black" points="-500.5,-337.5 -333.5,-337.5 "/>
<polyline fill="none" stroke="black" points="-500.5,-313.5 -333.5,-313.5 "/>
<text text-anchor="start" x="-492.5" y="-298.3" font-family="Times,serif" font-size="14.00">_layout</text>
<text text-anchor="start" x="-492.5" y="-283.3" font-family="Times,serif" font-size="14.00">pricelist_params</text>
<text text-anchor="start" x="-492.5" y="-268.3" font-family="Times,serif" font-size="14.00">set_pricelist</text>
</g>
<!-- Admin::ZonefilesController -->
<g id="node15" class="node"><title>Admin::ZonefilesController</title>
<path fill="none" stroke="black" d="M-688.5,-240.5C-688.5,-240.5 -543.5,-240.5 -543.5,-240.5 -537.5,-240.5 -531.5,-246.5 -531.5,-252.5 -531.5,-252.5 -531.5,-321.5 -531.5,-321.5 -531.5,-327.5 -537.5,-333.5 -543.5,-333.5 -543.5,-333.5 -688.5,-333.5 -688.5,-333.5 -694.5,-333.5 -700.5,-327.5 -700.5,-321.5 -700.5,-321.5 -700.5,-252.5 -700.5,-252.5 -700.5,-246.5 -694.5,-240.5 -688.5,-240.5"/>
@ -377,20 +361,6 @@
<polyline fill="none" stroke="black" points="-720,16.5 -538,16.5 "/>
<text text-anchor="start" x="-712" y="31.7" font-family="Times,serif" font-size="14.00">_layout</text>
</g>
<!-- Admin::ZonefileSettingsController -->
<g id="node27" class="node"><title>Admin::ZonefileSettingsController</title>
<path fill="none" stroke="black" d="M532.5,279.5C532.5,279.5 715.5,279.5 715.5,279.5 721.5,279.5 727.5,273.5 727.5,267.5 727.5,267.5 727.5,138.5 727.5,138.5 727.5,132.5 721.5,126.5 715.5,126.5 715.5,126.5 532.5,126.5 532.5,126.5 526.5,126.5 520.5,132.5 520.5,138.5 520.5,138.5 520.5,267.5 520.5,267.5 520.5,273.5 526.5,279.5 532.5,279.5"/>
<text text-anchor="middle" x="624" y="141.7" font-family="Times,serif" font-size="14.00">Admin::ZonefileSettingsController</text>
<polyline fill="none" stroke="black" points="520.5,149.5 727.5,149.5 "/>
<text text-anchor="start" x="528.5" y="164.7" font-family="Times,serif" font-size="14.00">edit</text>
<text text-anchor="start" x="528.5" y="179.7" font-family="Times,serif" font-size="14.00">index</text>
<text text-anchor="start" x="528.5" y="194.7" font-family="Times,serif" font-size="14.00">update</text>
<polyline fill="none" stroke="black" points="520.5,202.5 727.5,202.5 "/>
<polyline fill="none" stroke="black" points="520.5,226.5 727.5,226.5 "/>
<text text-anchor="start" x="528.5" y="241.7" font-family="Times,serif" font-size="14.00">_layout</text>
<text text-anchor="start" x="528.5" y="256.7" font-family="Times,serif" font-size="14.00">set_zonefile_setting</text>
<text text-anchor="start" x="528.5" y="271.7" font-family="Times,serif" font-size="14.00">zonefile_setting_params</text>
</g>
<!-- Admin::RegistrarsController -->
<g id="node28" class="node"><title>Admin::RegistrarsController</title>
<path fill="none" stroke="black" d="M-67.5,479.5C-67.5,479.5 81.5,479.5 81.5,479.5 87.5,479.5 93.5,473.5 93.5,467.5 93.5,467.5 93.5,278.5 93.5,278.5 93.5,272.5 87.5,266.5 81.5,266.5 81.5,266.5 -67.5,266.5 -67.5,266.5 -73.5,266.5 -79.5,272.5 -79.5,278.5 -79.5,278.5 -79.5,467.5 -79.5,467.5 -79.5,473.5 -73.5,479.5 -67.5,479.5"/>

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Before After
Before After

View file

@ -16,7 +16,7 @@ Domain name mapping protocol short version:
<domain:create> 1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
<domain:name> 1 Domain name. Can contain unicode characters.
<domain:period> 0-1 Registration period for domain.
Must add up to 1 / 2 / 3 years.
Must add up to 3m, 6m, 9m, 1y, 2y, 3y, 4y, 5y, 6y, 7y, 8y, 9y, 10y.
Attribute: unit="y/m/d"
Default is 1 year.
<domain:ns> 0-1
@ -129,7 +129,8 @@ Domain name mapping protocol short version:
<domain:name> 1 Domain name. Can contain unicode characters.
<domain:curExpDate> 1 Current expiry date (ISO8601 format)
<domain:period> 0-1 Registration period for domain.
Must add up to 1 / 2 / 3 years. Attribute: unit="y/m/d"
Must add up to 3m, 6m, 9m, 1y, 2y, 3y, 4y, 5y, 6y, 7y, 8y, 9y, 10y.
Attribute: unit="y/m/d"
Default value is 1 year.
<extension> 0-1
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"

View file

@ -337,17 +337,6 @@
<ellipse fill="none" stroke="#d1286a" cx="3516.25" cy="-77.2469" rx="4.00001" ry="4.00001"/>
<polygon fill="#d1286a" stroke="#d1286a" points="1658.36,-20.9371 1648.46,-16.2185 1653.36,-20.8273 1648.36,-20.7174 1648.36,-20.7174 1648.36,-20.7174 1653.36,-20.8273 1648.26,-25.2164 1658.36,-20.9371 1658.36,-20.9371"/>
</g>
<!-- ZonefileSettingVersion -->
<g id="node31" class="node"><title>ZonefileSettingVersion</title>
<ellipse fill="none" stroke="black" cx="3746.99" cy="-91" rx="92.8835" ry="18"/>
<text text-anchor="middle" x="3746.99" y="-87.3" font-family="Times,serif" font-size="14.00">ZonefileSettingVersion</text>
</g>
<!-- ZonefileSettingVersion&#45;&gt;VersionAssociation -->
<g id="edge29" class="edge"><title>ZonefileSettingVersion&#45;&gt;VersionAssociation</title>
<path fill="none" stroke="#fb178f" d="M3674.74,-76.7667C3664.77,-75.2902 3654.65,-73.9712 3644.99,-73 3407.38,-49.0969 3346.71,-60.9372 3107.99,-54 2557.18,-37.9931 1895.3,-25.0664 1658.57,-20.6418"/>
<ellipse fill="none" stroke="#fb178f" cx="3678.73" cy="-77.3767" rx="4.00001" ry="4.00001"/>
<polygon fill="#fb178f" stroke="#fb178f" points="1658.29,-20.6367 1648.38,-15.9509 1653.29,-20.5434 1648.3,-20.4501 1648.3,-20.4501 1648.3,-20.4501 1653.29,-20.5434 1648.21,-24.9493 1658.29,-20.6367 1658.29,-20.6367"/>
</g>
<!-- DomainVersion -->
<g id="node32" class="node"><title>DomainVersion</title>
<ellipse fill="none" stroke="black" cx="1244.99" cy="-307" rx="67.6881" ry="18"/>
@ -1219,18 +1208,6 @@
<ellipse fill="none" stroke="black" cx="4032.99" cy="-523" rx="89.0842" ry="18"/>
<text text-anchor="middle" x="4032.99" y="-519.3" font-family="Times,serif" font-size="14.00">RegistrantVerification</text>
</g>
<!-- ZonefileSetting -->
<g id="node49" class="node"><title>ZonefileSetting</title>
<ellipse fill="none" stroke="black" cx="3746.99" cy="-199" rx="65.7887" ry="18"/>
<text text-anchor="middle" x="3746.99" y="-195.3" font-family="Times,serif" font-size="14.00">ZonefileSetting</text>
</g>
<!-- ZonefileSetting&#45;&gt;ZonefileSettingVersion -->
<g id="edge74" class="edge"><title>ZonefileSetting&#45;&gt;ZonefileSettingVersion</title>
<path fill="none" stroke="#881b39" d="M3746.99,-172.795C3746.99,-156.735 3746.99,-135.927 3746.99,-119.45"/>
<ellipse fill="none" stroke="#881b39" cx="3746.99" cy="-176.969" rx="4" ry="4"/>
<polygon fill="#881b39" stroke="#881b39" points="3746.99,-119.341 3751.49,-109.341 3746.99,-114.341 3746.99,-109.341 3746.99,-109.341 3746.99,-109.341 3746.99,-114.341 3742.49,-109.341 3746.99,-119.341 3746.99,-119.341"/>
<text text-anchor="middle" x="3769.99" y="-141.3" font-family="Times,serif" font-size="14.00">versions</text>
</g>
<!-- TechDomainContact&#45;&gt;DomainContactVersion -->
<g id="edge75" class="edge"><title>TechDomainContact&#45;&gt;DomainContactVersion</title>
<path fill="none" stroke="#727588" d="M1971.52,-284.313C1929.46,-250.063 1844.49,-181.719 1769.99,-127 1764.3,-122.814 1758.15,-118.466 1752.18,-114.317"/>
@ -1263,11 +1240,6 @@
<ellipse fill="none" stroke="black" cx="4191.99" cy="-523" rx="51.9908" ry="18"/>
<text text-anchor="middle" x="4191.99" y="-519.3" font-family="Times,serif" font-size="14.00">EppSession</text>
</g>
<!-- Pricelist -->
<g id="node54" class="node"><title>Pricelist</title>
<ellipse fill="none" stroke="black" cx="3258.99" cy="-199" rx="39.7935" ry="18"/>
<text text-anchor="middle" x="3258.99" y="-195.3" font-family="Times,serif" font-size="14.00">Pricelist</text>
</g>
<!-- Pricelist&#45;&gt;PricelistVersion -->
<g id="edge79" class="edge"><title>Pricelist&#45;&gt;PricelistVersion</title>
<path fill="none" stroke="#499b9a" d="M3250.87,-173.392C3244.19,-157.303 3233,-137.406 3215.99,-127 3168.48,-97.9313 3021.11,-117.025 2965.99,-109 2959.86,-108.107 2953.49,-106.998 2947.15,-105.777"/>

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Before After
Before After

View file

@ -665,28 +665,6 @@
<ellipse fill="none" stroke="#9131a9" cx="3586.29" cy="-75.9354" rx="4.00002" ry="4.00002"/>
<polygon fill="#9131a9" stroke="#9131a9" points="1845.79,-21.5158 1835.92,-16.7338 1840.79,-21.3739 1835.79,-21.232 1835.79,-21.232 1835.79,-21.232 1840.79,-21.3739 1835.67,-25.7301 1845.79,-21.5158 1845.79,-21.5158"/>
</g>
<!-- ZonefileSettingVersion -->
<g id="node31" class="node"><title>ZonefileSettingVersion</title>
<path fill="none" stroke="black" d="M3937.5,-73.5C3937.5,-73.5 4056.5,-73.5 4056.5,-73.5 4062.5,-73.5 4068.5,-79.5 4068.5,-85.5 4068.5,-85.5 4068.5,-242.5 4068.5,-242.5 4068.5,-248.5 4062.5,-254.5 4056.5,-254.5 4056.5,-254.5 3937.5,-254.5 3937.5,-254.5 3931.5,-254.5 3925.5,-248.5 3925.5,-242.5 3925.5,-242.5 3925.5,-85.5 3925.5,-85.5 3925.5,-79.5 3931.5,-73.5 3937.5,-73.5"/>
<text text-anchor="middle" x="3997" y="-239.3" font-family="Times,serif" font-size="14.00">ZonefileSettingVersion</text>
<polyline fill="none" stroke="black" points="3925.5,-231.5 4068.5,-231.5 "/>
<text text-anchor="start" x="3933.5" y="-216.3" font-family="Times,serif" font-size="14.00">id :integer</text>
<text text-anchor="start" x="3933.5" y="-201.3" font-family="Times,serif" font-size="14.00">item_type :string</text>
<text text-anchor="start" x="3933.5" y="-186.3" font-family="Times,serif" font-size="14.00">item_id :integer</text>
<text text-anchor="start" x="3933.5" y="-171.3" font-family="Times,serif" font-size="14.00">event :string</text>
<text text-anchor="start" x="3933.5" y="-156.3" font-family="Times,serif" font-size="14.00">whodunnit :string</text>
<text text-anchor="start" x="3933.5" y="-141.3" font-family="Times,serif" font-size="14.00">object :json</text>
<text text-anchor="start" x="3933.5" y="-126.3" font-family="Times,serif" font-size="14.00">object_changes :json</text>
<text text-anchor="start" x="3933.5" y="-111.3" font-family="Times,serif" font-size="14.00">created_at :datetime</text>
<text text-anchor="start" x="3933.5" y="-96.3" font-family="Times,serif" font-size="14.00">session :string</text>
<text text-anchor="start" x="3933.5" y="-81.3" font-family="Times,serif" font-size="14.00">children :json</text>
</g>
<!-- ZonefileSettingVersion&#45;&gt;VersionAssociation -->
<g id="edge29" class="edge"><title>ZonefileSettingVersion&#45;&gt;VersionAssociation</title>
<path fill="none" stroke="#cc510c" d="M3917.83,-129.497C3865.31,-109.014 3794.29,-84.5899 3729,-73 3542.63,-39.9179 2207.66,-23.7038 1846.75,-19.8943"/>
<ellipse fill="none" stroke="#cc510c" cx="3921.72" cy="-131.026" rx="4.00001" ry="4.00001"/>
<polygon fill="#cc510c" stroke="#cc510c" points="1846.61,-19.8929 1836.66,-15.2881 1841.61,-19.8404 1836.61,-19.7879 1836.61,-19.7879 1836.61,-19.7879 1841.61,-19.8404 1836.57,-24.2876 1846.61,-19.8929 1846.61,-19.8929"/>
</g>
<!-- DomainVersion -->
<g id="node32" class="node"><title>DomainVersion</title>
<path fill="none" stroke="black" d="M1277.5,-1158.5C1277.5,-1158.5 1400.5,-1158.5 1400.5,-1158.5 1406.5,-1158.5 1412.5,-1164.5 1412.5,-1170.5 1412.5,-1170.5 1412.5,-1372.5 1412.5,-1372.5 1412.5,-1378.5 1406.5,-1384.5 1400.5,-1384.5 1400.5,-1384.5 1277.5,-1384.5 1277.5,-1384.5 1271.5,-1384.5 1265.5,-1378.5 1265.5,-1372.5 1265.5,-1372.5 1265.5,-1170.5 1265.5,-1170.5 1265.5,-1164.5 1271.5,-1158.5 1277.5,-1158.5"/>
@ -1981,32 +1959,6 @@
<text text-anchor="start" x="4134" y="-2436.8" font-family="Times,serif" font-size="14.00">domain_id :integer</text>
<text text-anchor="start" x="4134" y="-2421.8" font-family="Times,serif" font-size="14.00">action_type :string</text>
</g>
<!-- ZonefileSetting -->
<g id="node49" class="node"><title>ZonefileSetting</title>
<path fill="none" stroke="black" d="M4115.5,-481C4115.5,-481 4252.5,-481 4252.5,-481 4258.5,-481 4264.5,-487 4264.5,-493 4264.5,-493 4264.5,-695 4264.5,-695 4264.5,-701 4258.5,-707 4252.5,-707 4252.5,-707 4115.5,-707 4115.5,-707 4109.5,-707 4103.5,-701 4103.5,-695 4103.5,-695 4103.5,-493 4103.5,-493 4103.5,-487 4109.5,-481 4115.5,-481"/>
<text text-anchor="middle" x="4184" y="-691.8" font-family="Times,serif" font-size="14.00">ZonefileSetting</text>
<polyline fill="none" stroke="black" points="4103.5,-684 4264.5,-684 "/>
<text text-anchor="start" x="4111.5" y="-668.8" font-family="Times,serif" font-size="14.00">id :integer</text>
<text text-anchor="start" x="4111.5" y="-653.8" font-family="Times,serif" font-size="14.00">origin :string</text>
<text text-anchor="start" x="4111.5" y="-638.8" font-family="Times,serif" font-size="14.00">ttl :integer</text>
<text text-anchor="start" x="4111.5" y="-623.8" font-family="Times,serif" font-size="14.00">refresh :integer</text>
<text text-anchor="start" x="4111.5" y="-608.8" font-family="Times,serif" font-size="14.00">retry :integer</text>
<text text-anchor="start" x="4111.5" y="-593.8" font-family="Times,serif" font-size="14.00">expire :integer</text>
<text text-anchor="start" x="4111.5" y="-578.8" font-family="Times,serif" font-size="14.00">minimum_ttl :integer</text>
<text text-anchor="start" x="4111.5" y="-563.8" font-family="Times,serif" font-size="14.00">email :string</text>
<text text-anchor="start" x="4111.5" y="-548.8" font-family="Times,serif" font-size="14.00">master_nameserver :string</text>
<text text-anchor="start" x="4111.5" y="-533.8" font-family="Times,serif" font-size="14.00">created_at :datetime</text>
<text text-anchor="start" x="4111.5" y="-518.8" font-family="Times,serif" font-size="14.00">updated_at :datetime</text>
<text text-anchor="start" x="4111.5" y="-503.8" font-family="Times,serif" font-size="14.00">creator_str :string</text>
<text text-anchor="start" x="4111.5" y="-488.8" font-family="Times,serif" font-size="14.00">updator_str :string</text>
</g>
<!-- ZonefileSetting&#45;&gt;ZonefileSettingVersion -->
<g id="edge74" class="edge"><title>ZonefileSetting&#45;&gt;ZonefileSettingVersion</title>
<path fill="none" stroke="#afb253" d="M4139.2,-472.941C4115.67,-412.317 4085.46,-338.025 4055,-273 4053.6,-270.013 4052.16,-266.991 4050.68,-263.95"/>
<ellipse fill="none" stroke="#afb253" cx="4140.74" cy="-476.912" rx="4.00001" ry="4.00001"/>
<polygon fill="#afb253" stroke="#afb253" points="4050.59,-263.757 4050.21,-252.798 4048.38,-259.272 4046.17,-254.786 4046.17,-254.786 4046.17,-254.786 4048.38,-259.272 4042.13,-256.775 4050.59,-263.757 4050.59,-263.757"/>
<text text-anchor="middle" x="4154" y="-360.3" font-family="Times,serif" font-size="14.00">versions</text>
</g>
<!-- TechDomainContact&#45;&gt;DomainContactVersion -->
<g id="edge75" class="edge"><title>TechDomainContact&#45;&gt;DomainContactVersion</title>
<path fill="none" stroke="#5e4961" d="M2208.23,-1157.73C2184.3,-1002.55 2136.91,-714.902 2080,-473 2058.81,-382.908 2056.36,-358.939 2022,-273 2020.78,-269.96 2019.51,-266.893 2018.19,-263.812"/>
@ -2046,25 +1998,6 @@
<text text-anchor="start" x="4306.5" y="-2451.8" font-family="Times,serif" font-size="14.00">updated_at :datetime</text>
<text text-anchor="start" x="4306.5" y="-2436.8" font-family="Times,serif" font-size="14.00">registrar_id :integer</text>
</g>
<!-- Pricelist -->
<g id="node54" class="node"><title>Pricelist</title>
<path fill="none" stroke="black" d="M3610.5,-481C3610.5,-481 3745.5,-481 3745.5,-481 3751.5,-481 3757.5,-487 3757.5,-493 3757.5,-493 3757.5,-695 3757.5,-695 3757.5,-701 3751.5,-707 3745.5,-707 3745.5,-707 3610.5,-707 3610.5,-707 3604.5,-707 3598.5,-701 3598.5,-695 3598.5,-695 3598.5,-493 3598.5,-493 3598.5,-487 3604.5,-481 3610.5,-481"/>
<text text-anchor="middle" x="3678" y="-691.8" font-family="Times,serif" font-size="14.00">Pricelist</text>
<polyline fill="none" stroke="black" points="3598.5,-684 3757.5,-684 "/>
<text text-anchor="start" x="3606.5" y="-668.8" font-family="Times,serif" font-size="14.00">id :integer</text>
<text text-anchor="start" x="3606.5" y="-653.8" font-family="Times,serif" font-size="14.00">desc :string</text>
<text text-anchor="start" x="3606.5" y="-638.8" font-family="Times,serif" font-size="14.00">category :string</text>
<text text-anchor="start" x="3606.5" y="-623.8" font-family="Times,serif" font-size="14.00">price_cents :decimal</text>
<text text-anchor="start" x="3606.5" y="-608.8" font-family="Times,serif" font-size="14.00">price_currency :string</text>
<text text-anchor="start" x="3606.5" y="-593.8" font-family="Times,serif" font-size="14.00">valid_from :datetime</text>
<text text-anchor="start" x="3606.5" y="-578.8" font-family="Times,serif" font-size="14.00">valid_to :datetime</text>
<text text-anchor="start" x="3606.5" y="-563.8" font-family="Times,serif" font-size="14.00">creator_str :string</text>
<text text-anchor="start" x="3606.5" y="-548.8" font-family="Times,serif" font-size="14.00">updator_str :string</text>
<text text-anchor="start" x="3606.5" y="-533.8" font-family="Times,serif" font-size="14.00">created_at :datetime</text>
<text text-anchor="start" x="3606.5" y="-518.8" font-family="Times,serif" font-size="14.00">updated_at :datetime</text>
<text text-anchor="start" x="3606.5" y="-503.8" font-family="Times,serif" font-size="14.00">duration :string</text>
<text text-anchor="start" x="3606.5" y="-488.8" font-family="Times,serif" font-size="14.00">operation_category :string</text>
</g>
<!-- Pricelist&#45;&gt;PricelistVersion -->
<g id="edge79" class="edge"><title>Pricelist&#45;&gt;PricelistVersion</title>
<path fill="none" stroke="#7416af" d="M3665.06,-472.647C3650.73,-402.404 3620.54,-318.837 3557,-273 3516.96,-244.115 3157.21,-276.99 3113,-255 3111.44,-254.226 3109.91,-253.402 3108.39,-252.533"/>

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 244 KiB

Before After
Before After

View file

@ -58,7 +58,6 @@ namespace :db do
puts "\n---------------------------- Import seed ----------------------------------------\n"
Rake::Task['db:seed'].invoke
# Rake::Task['zonefile:replace_procedure'].invoke # not needed any more
puts "\n All done!\n\n"
end

View file

@ -57,7 +57,6 @@ namespace :import do
Rake::Task['import:reserved'].invoke
Rake::Task['import:domains'].invoke
Rake::Task['import:zones'].invoke
Rake::Task['zonefile:replace_procedure'].invoke
end
desc 'Import registrars'
@ -605,7 +604,7 @@ namespace :import do
ns_records, a_records, a4_records = parse_zone_ns_data('ee', 1)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'ee',
ttl: 43200,
refresh: 3600,
@ -622,7 +621,7 @@ namespace :import do
# edu.ee
ns_records, a_records, a4_records = parse_zone_ns_data('edu.ee', 6)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'edu.ee',
ttl: 43200,
refresh: 3600,
@ -639,7 +638,7 @@ namespace :import do
# aip.ee
ns_records, a_records, a4_records = parse_zone_ns_data('aip.ee', 9)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'aip.ee',
ttl: 43200,
refresh: 3600,
@ -656,7 +655,7 @@ namespace :import do
# org.ee
ns_records, a_records, a4_records = parse_zone_ns_data('org.ee', 10)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'org.ee',
ttl: 43200,
refresh: 3600,
@ -673,7 +672,7 @@ namespace :import do
# pri.ee
ns_records, a_records, a4_records = parse_zone_ns_data('pri.ee', 2)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'pri.ee',
ttl: 43200,
refresh: 3600,
@ -690,7 +689,7 @@ namespace :import do
# med.ee
ns_records, a_records, a4_records = parse_zone_ns_data('med.ee', 3)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'med.ee',
ttl: 43200,
refresh: 3600,
@ -707,7 +706,7 @@ namespace :import do
# fie.ee
ns_records, a_records, a4_records = parse_zone_ns_data('fie.ee', 4)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'fie.ee',
ttl: 43200,
refresh: 3600,
@ -724,7 +723,7 @@ namespace :import do
# com.ee
ns_records, a_records, a4_records = parse_zone_ns_data('com.ee', 5)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'com.ee',
ttl: 43200,
refresh: 3600,
@ -741,7 +740,7 @@ namespace :import do
# gov.ee
ns_records, a_records, a4_records = parse_zone_ns_data('gov.ee', 7)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'gov.ee',
ttl: 43200,
refresh: 3600,
@ -758,7 +757,7 @@ namespace :import do
# riik.ee
ns_records, a_records, a4_records = parse_zone_ns_data('riik.ee', 8)
ZonefileSetting.create!({
DNS::Zone.create!({
origin: 'riik.ee',
ttl: 43200,
refresh: 3600,

View file

@ -1,8 +0,0 @@
Fabricator(:pricelist) do
valid_from 1.year.ago
valid_to 1.year.since
category 'ee'
duration '1year'
operation_category 'create'
price 10
end

View file

@ -1,4 +1,4 @@
Fabricator(:zonefile_setting) do
Fabricator(:zone, from: 'DNS::Zone') do
origin 'ee'
ttl 43200
refresh 3600

View file

@ -0,0 +1,10 @@
FactoryGirl.define do
factory :price, class: Billing::Price do
price Money.from_amount(1)
valid_from Time.zone.parse('05.07.2010')
valid_to Time.zone.parse('05.07.2010')
duration '1 year'
operation_category Billing::Price.operation_categories.first
zone
end
end

View file

@ -0,0 +1,12 @@
FactoryGirl.define do
factory :zone, class: DNS::Zone do
sequence(:origin) { |n| "test#{n}" }
ttl 1
refresh 1
add_attribute :retry, 1
expire 1
minimum_ttl 1
email 'test.test'
master_nameserver 'test.test'
end
end

Some files were not shown because too many files have changed in this diff Show more