mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Merge branch 'master' of github.com:internetee/registry
Conflicts: app/models/domain.rb app/models/epp/epp_domain.rb config/locales/en.yml spec/epp/domain_spec.rb
This commit is contained in:
commit
ee2d93128c
50 changed files with 528 additions and 201 deletions
10
.rubocop-guard.yml
Normal file
10
.rubocop-guard.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
inherit_from: .rubocop.yml
|
||||||
|
|
||||||
|
#
|
||||||
|
# Turn off during guard runs
|
||||||
|
#
|
||||||
|
|
||||||
|
# turn off comment intention check during development
|
||||||
|
# because NerdCommenter honors commented code intentions
|
||||||
|
Style/CommentIndentation:
|
||||||
|
Enabled: false
|
22
.rubocop.yml
22
.rubocop.yml
|
@ -14,6 +14,12 @@ AllCops:
|
||||||
Metrics/LineLength:
|
Metrics/LineLength:
|
||||||
Max: 120
|
Max: 120
|
||||||
|
|
||||||
|
Metrics/MethodLength:
|
||||||
|
Max: 25 # default 10
|
||||||
|
|
||||||
|
Metrics/ClassLength:
|
||||||
|
Max: 300
|
||||||
|
|
||||||
Documentation:
|
Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -29,11 +35,25 @@ Style/BracesAroundHashParameters:
|
||||||
Style/IndentHash:
|
Style/IndentHash:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
# a bit too annoying requirement, no big drawback yet dedected
|
||||||
|
Style/TrailingWhitespace:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# allow == operator used in void context in specs
|
||||||
|
Void:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/**/*'
|
||||||
|
|
||||||
# No need to force reduce to use |a, e| as parameters.
|
# No need to force reduce to use |a, e| as parameters.
|
||||||
# Configuration parameters: Methods.
|
# Configuration parameters: Methods.
|
||||||
Style/SingleLineBlockParams:
|
Style/SingleLineBlockParams:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# No need for nested module/class definition as far as I know
|
# allow prefix for models and controllers,
|
||||||
|
# otherwise we have to intent all body 4 spaces
|
||||||
Style/ClassAndModuleChildren:
|
Style/ClassAndModuleChildren:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
# Allow to use Estonian terms/data in comments
|
||||||
|
Style/AsciiComments:
|
||||||
|
Enabled: false
|
||||||
|
|
62
Gemfile
62
Gemfile
|
@ -64,30 +64,8 @@ gem 'paper_trail', '~> 3.0.5'
|
||||||
# for select
|
# for select
|
||||||
gem 'selectize-rails', '~> 0.11.0'
|
gem 'selectize-rails', '~> 0.11.0'
|
||||||
|
|
||||||
group :assets do
|
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
gem 'therubyracer', platforms: :ruby
|
||||||
gem 'therubyracer', platforms: :ruby
|
|
||||||
end
|
|
||||||
|
|
||||||
group :development do
|
|
||||||
# faster dev load time
|
|
||||||
gem 'unicorn'
|
|
||||||
|
|
||||||
# Spring speeds up development by keeping your application running in the background.
|
|
||||||
# Read more: https://github.com/rails/spring
|
|
||||||
gem 'spring'
|
|
||||||
|
|
||||||
# bundle exec rake doc:rails generates the API under doc/api.
|
|
||||||
gem 'sdoc', '~> 0.4.0'
|
|
||||||
|
|
||||||
# run tests automatically
|
|
||||||
gem 'guard', '~> 2.6.1'
|
|
||||||
|
|
||||||
# rspec support for guard
|
|
||||||
gem 'guard-rspec', '~> 4.3.1'
|
|
||||||
# rubocop support for guard
|
|
||||||
gem 'guard-rubocop', '~> 1.1.0'
|
|
||||||
end
|
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'capybara', '~> 2.4.1'
|
gem 'capybara', '~> 2.4.1'
|
||||||
|
@ -123,5 +101,39 @@ group :development, :test do
|
||||||
gem 'uuidtools', '~> 2.1.4'
|
gem 'uuidtools', '~> 2.1.4'
|
||||||
|
|
||||||
# For code review
|
# For code review
|
||||||
gem 'simplecov', '~> 0.9.1', :require => false
|
gem 'simplecov', '~> 0.9.1', require: false
|
||||||
|
gem 'rubycritic', '~> 1.1.1'
|
||||||
|
|
||||||
|
# for finding database optimizations
|
||||||
|
gem 'bullet', '~> 4.14.0'
|
||||||
|
|
||||||
|
# for finding future vulnerable gems
|
||||||
|
gem 'bundler-audit'
|
||||||
|
|
||||||
|
# for security audit'
|
||||||
|
gem 'brakeman', '~> 2.6.2', require: false
|
||||||
|
|
||||||
|
# Spring speeds up development by keeping your application running in the background.
|
||||||
|
# Read more: https://github.com/rails/spring
|
||||||
|
gem 'spring'
|
||||||
|
|
||||||
|
# bundle exec rake doc:rails generates the API under doc/api.
|
||||||
|
gem 'sdoc', '~> 0.4.0'
|
||||||
|
|
||||||
|
# run tests automatically
|
||||||
|
gem 'guard', '~> 2.6.1'
|
||||||
|
|
||||||
|
# rspec support for guard
|
||||||
|
gem 'guard-rspec', '~> 4.3.1'
|
||||||
|
gem 'rubocop', '~> 0.26.1'
|
||||||
|
gem 'guard-rubocop', '~> 1.1.0'
|
||||||
|
|
||||||
|
# for quick debugging
|
||||||
|
gem 'web-console', '~> 2.0.0.beta4'
|
||||||
|
|
||||||
|
# for finding dead routes and unused actions
|
||||||
|
gem 'traceroute', '~> 0.4.0'
|
||||||
|
|
||||||
|
# faster dev load time
|
||||||
|
gem 'unicorn'
|
||||||
end
|
end
|
||||||
|
|
109
Gemfile.lock
109
Gemfile.lock
|
@ -31,12 +31,35 @@ GEM
|
||||||
ast (2.0.0)
|
ast (2.0.0)
|
||||||
astrolabe (1.3.0)
|
astrolabe (1.3.0)
|
||||||
parser (>= 2.2.0.pre.3, < 3.0)
|
parser (>= 2.2.0.pre.3, < 3.0)
|
||||||
|
axiom-types (0.1.1)
|
||||||
|
descendants_tracker (~> 0.0.4)
|
||||||
|
ice_nine (~> 0.11.0)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
bcrypt (3.1.7)
|
bcrypt (3.1.7)
|
||||||
|
binding_of_caller (0.7.3.pre1)
|
||||||
|
debug_inspector (>= 0.0.1)
|
||||||
bootstrap-sass (3.2.0.2)
|
bootstrap-sass (3.2.0.2)
|
||||||
sass (~> 3.2)
|
sass (~> 3.2)
|
||||||
|
brakeman (2.6.2)
|
||||||
|
erubis (~> 2.6)
|
||||||
|
fastercsv (~> 1.5)
|
||||||
|
haml (>= 3.0, < 5.0)
|
||||||
|
highline (~> 1.6.20)
|
||||||
|
multi_json (~> 1.2)
|
||||||
|
ruby2ruby (~> 2.1.1)
|
||||||
|
ruby_parser (~> 3.5.0)
|
||||||
|
sass (~> 3.0)
|
||||||
|
slim (>= 1.3.6, < 3.0)
|
||||||
|
terminal-table (~> 1.4)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
|
bullet (4.14.0)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
|
uniform_notifier (>= 1.6.0)
|
||||||
|
bundler-audit (0.3.1)
|
||||||
|
bundler (~> 1.2)
|
||||||
|
thor (~> 0.18)
|
||||||
cancan (1.6.10)
|
cancan (1.6.10)
|
||||||
capybara (2.4.1)
|
capybara (2.4.3)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
nokogiri (>= 1.3.3)
|
nokogiri (>= 1.3.3)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
|
@ -46,14 +69,19 @@ GEM
|
||||||
timers (~> 4.0.0)
|
timers (~> 4.0.0)
|
||||||
cliver (0.3.2)
|
cliver (0.3.2)
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
|
coercible (1.0.0)
|
||||||
|
descendants_tracker (~> 0.0.1)
|
||||||
coffee-rails (4.0.1)
|
coffee-rails (4.0.1)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
coffee-script (2.3.0)
|
coffee-script (2.3.0)
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.7.0)
|
coffee-script-source (1.8.0)
|
||||||
database_cleaner (1.3.0)
|
database_cleaner (1.3.0)
|
||||||
|
debug_inspector (0.0.2)
|
||||||
|
descendants_tracker (0.0.4)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
devise (3.3.0)
|
devise (3.3.0)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
|
@ -65,12 +93,20 @@ GEM
|
||||||
epp (1.4.0)
|
epp (1.4.0)
|
||||||
hpricot
|
hpricot
|
||||||
libxml-ruby
|
libxml-ruby
|
||||||
|
equalizer (0.0.9)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.2.1)
|
execjs (2.2.1)
|
||||||
fabrication (2.11.3)
|
fabrication (2.11.3)
|
||||||
faker (1.3.0)
|
faker (1.3.0)
|
||||||
i18n (~> 0.5)
|
i18n (~> 0.5)
|
||||||
ffi (1.9.3)
|
fastercsv (1.5.5)
|
||||||
|
ffi (1.9.6)
|
||||||
|
flay (2.4.0)
|
||||||
|
ruby_parser (~> 3.0)
|
||||||
|
sexp_processor (~> 4.0)
|
||||||
|
flog (4.2.1)
|
||||||
|
ruby_parser (~> 3.1, > 3.1.0)
|
||||||
|
sexp_processor (~> 4.4)
|
||||||
formatador (0.2.5)
|
formatador (0.2.5)
|
||||||
guard (2.6.1)
|
guard (2.6.1)
|
||||||
formatador (>= 0.2.4)
|
formatador (>= 0.2.4)
|
||||||
|
@ -91,12 +127,14 @@ GEM
|
||||||
activesupport (>= 4.0.1)
|
activesupport (>= 4.0.1)
|
||||||
haml (>= 3.1, < 5.0)
|
haml (>= 3.1, < 5.0)
|
||||||
railties (>= 4.0.1)
|
railties (>= 4.0.1)
|
||||||
|
highline (1.6.21)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
hitimes (1.2.2)
|
hitimes (1.2.2)
|
||||||
hpricot (0.8.6)
|
hpricot (0.8.6)
|
||||||
i18n (0.6.11)
|
i18n (0.6.11)
|
||||||
|
ice_nine (0.11.0)
|
||||||
isikukood (0.1.2)
|
isikukood (0.1.2)
|
||||||
jbuilder (2.1.3)
|
jbuilder (2.2.2)
|
||||||
activesupport (>= 3.0.0, < 5)
|
activesupport (>= 3.0.0, < 5)
|
||||||
multi_json (~> 1.2)
|
multi_json (~> 1.2)
|
||||||
jquery-rails (3.1.2)
|
jquery-rails (3.1.2)
|
||||||
|
@ -107,9 +145,9 @@ GEM
|
||||||
actionpack (>= 3.0.0)
|
actionpack (>= 3.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
kgio (2.9.2)
|
kgio (2.9.2)
|
||||||
libv8 (3.16.14.5)
|
libv8 (3.16.14.7)
|
||||||
libxml-ruby (2.7.0)
|
libxml-ruby (2.7.0)
|
||||||
listen (2.7.9)
|
listen (2.7.11)
|
||||||
celluloid (>= 0.15.2)
|
celluloid (>= 0.15.2)
|
||||||
rb-fsevent (>= 0.9.3)
|
rb-fsevent (>= 0.9.3)
|
||||||
rb-inotify (>= 0.9)
|
rb-inotify (>= 0.9)
|
||||||
|
@ -120,16 +158,16 @@ GEM
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
mime-types (1.25.1)
|
mime-types (1.25.1)
|
||||||
mini_portile (0.6.0)
|
mini_portile (0.6.0)
|
||||||
minitest (5.4.1)
|
minitest (5.4.2)
|
||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
nokogiri (1.6.2.1)
|
nokogiri (1.6.2.1)
|
||||||
mini_portile (= 0.6.0)
|
mini_portile (= 0.6.0)
|
||||||
nprogress-rails (0.1.3.1)
|
nprogress-rails (0.1.3.1)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
paper_trail (3.0.5)
|
paper_trail (3.0.6)
|
||||||
activerecord (>= 3.0, < 5.0)
|
activerecord (>= 3.0, < 5.0)
|
||||||
activesupport (>= 3.0, < 5.0)
|
activesupport (>= 3.0, < 5.0)
|
||||||
parser (2.2.0.pre.4)
|
parser (2.2.0.pre.5)
|
||||||
ast (>= 1.1, < 3.0)
|
ast (>= 1.1, < 3.0)
|
||||||
slop (~> 3.4, >= 3.4.5)
|
slop (~> 3.4, >= 3.4.5)
|
||||||
pg (0.17.1)
|
pg (0.17.1)
|
||||||
|
@ -181,6 +219,11 @@ GEM
|
||||||
ffi (>= 0.5.0)
|
ffi (>= 0.5.0)
|
||||||
rdoc (4.1.2)
|
rdoc (4.1.2)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
|
reek (1.3.8)
|
||||||
|
rainbow (>= 1.99, < 3.0)
|
||||||
|
ruby2ruby (>= 2.0.8, < 3.0)
|
||||||
|
ruby_parser (~> 3.3)
|
||||||
|
sexp_processor
|
||||||
ref (1.0.5)
|
ref (1.0.5)
|
||||||
rspec (3.0.0)
|
rspec (3.0.0)
|
||||||
rspec-core (~> 3.0.0)
|
rspec-core (~> 3.0.0)
|
||||||
|
@ -202,13 +245,25 @@ GEM
|
||||||
rspec-mocks (~> 3.0.0)
|
rspec-mocks (~> 3.0.0)
|
||||||
rspec-support (~> 3.0.0)
|
rspec-support (~> 3.0.0)
|
||||||
rspec-support (3.0.4)
|
rspec-support (3.0.4)
|
||||||
rubocop (0.26.0)
|
rubocop (0.26.1)
|
||||||
astrolabe (~> 1.3)
|
astrolabe (~> 1.3)
|
||||||
parser (>= 2.2.0.pre.4, < 3.0)
|
parser (>= 2.2.0.pre.4, < 3.0)
|
||||||
powerpack (~> 0.0.6)
|
powerpack (~> 0.0.6)
|
||||||
rainbow (>= 1.99.1, < 3.0)
|
rainbow (>= 1.99.1, < 3.0)
|
||||||
ruby-progressbar (~> 1.4)
|
ruby-progressbar (~> 1.4)
|
||||||
ruby-progressbar (1.5.1)
|
ruby-progressbar (1.6.0)
|
||||||
|
ruby2ruby (2.1.3)
|
||||||
|
ruby_parser (~> 3.1)
|
||||||
|
sexp_processor (~> 4.0)
|
||||||
|
ruby_parser (3.5.0)
|
||||||
|
sexp_processor (~> 4.1)
|
||||||
|
rubycritic (1.1.1)
|
||||||
|
flay (= 2.4.0)
|
||||||
|
flog (= 4.2.1)
|
||||||
|
parser (~> 2.1)
|
||||||
|
reek (= 1.3.8)
|
||||||
|
ruby2ruby (>= 2.1.1, < 3.0)
|
||||||
|
virtus (~> 1.0)
|
||||||
sass (3.2.19)
|
sass (3.2.19)
|
||||||
sass-rails (4.0.3)
|
sass-rails (4.0.3)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
|
@ -219,6 +274,7 @@ GEM
|
||||||
json (~> 1.7, >= 1.7.7)
|
json (~> 1.7, >= 1.7.7)
|
||||||
rdoc (~> 4.0)
|
rdoc (~> 4.0)
|
||||||
selectize-rails (0.11.0)
|
selectize-rails (0.11.0)
|
||||||
|
sexp_processor (4.4.4)
|
||||||
shoulda-matchers (2.6.2)
|
shoulda-matchers (2.6.2)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
simplecov (0.9.1)
|
simplecov (0.9.1)
|
||||||
|
@ -227,9 +283,12 @@ GEM
|
||||||
simplecov-html (~> 0.8.0)
|
simplecov-html (~> 0.8.0)
|
||||||
simplecov-html (0.8.0)
|
simplecov-html (0.8.0)
|
||||||
simpleidn (0.0.5)
|
simpleidn (0.0.5)
|
||||||
|
slim (2.0.3)
|
||||||
|
temple (~> 0.6.6)
|
||||||
|
tilt (>= 1.3.3, < 2.1)
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
spring (1.1.3)
|
spring (1.1.3)
|
||||||
sprockets (2.11.0)
|
sprockets (2.8.0)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
|
@ -240,6 +299,8 @@ GEM
|
||||||
sprockets (~> 2.8)
|
sprockets (~> 2.8)
|
||||||
sys-uname (0.9.0)
|
sys-uname (0.9.0)
|
||||||
ffi (>= 1.0.0)
|
ffi (>= 1.0.0)
|
||||||
|
temple (0.6.8)
|
||||||
|
terminal-table (1.4.5)
|
||||||
therubyracer (0.12.1)
|
therubyracer (0.12.1)
|
||||||
libv8 (~> 3.16.14.0)
|
libv8 (~> 3.16.14.0)
|
||||||
ref
|
ref
|
||||||
|
@ -248,10 +309,12 @@ GEM
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
timers (4.0.1)
|
timers (4.0.1)
|
||||||
hitimes
|
hitimes
|
||||||
|
traceroute (0.4.0)
|
||||||
|
rails (>= 3.0.0)
|
||||||
treetop (1.4.15)
|
treetop (1.4.15)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
turbolinks (2.3.0)
|
turbolinks (2.4.0)
|
||||||
coffee-rails
|
coffee-rails
|
||||||
tzinfo (1.2.2)
|
tzinfo (1.2.2)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
|
@ -262,10 +325,21 @@ GEM
|
||||||
kgio (~> 2.6)
|
kgio (~> 2.6)
|
||||||
rack
|
rack
|
||||||
raindrops (~> 0.7)
|
raindrops (~> 0.7)
|
||||||
|
uniform_notifier (1.6.2)
|
||||||
uuidtools (2.1.5)
|
uuidtools (2.1.5)
|
||||||
|
virtus (1.0.3)
|
||||||
|
axiom-types (~> 0.1)
|
||||||
|
coercible (~> 1.0)
|
||||||
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
||||||
|
equalizer (~> 0.0, >= 0.0.9)
|
||||||
warden (1.2.3)
|
warden (1.2.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
websocket-driver (0.3.4)
|
web-console (2.0.0.beta4)
|
||||||
|
activemodel (~> 4.0)
|
||||||
|
binding_of_caller (= 0.7.3.pre1)
|
||||||
|
railties (~> 4.0)
|
||||||
|
sprockets-rails (>= 2.0, < 4.0)
|
||||||
|
websocket-driver (0.3.5)
|
||||||
xpath (2.0.0)
|
xpath (2.0.0)
|
||||||
nokogiri (~> 1.3)
|
nokogiri (~> 1.3)
|
||||||
|
|
||||||
|
@ -274,6 +348,9 @@ PLATFORMS
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bootstrap-sass (~> 3.2.0.1)
|
bootstrap-sass (~> 3.2.0.1)
|
||||||
|
brakeman (~> 2.6.2)
|
||||||
|
bullet (~> 4.14.0)
|
||||||
|
bundler-audit
|
||||||
cancan (~> 1.6.10)
|
cancan (~> 1.6.10)
|
||||||
capybara (~> 2.4.1)
|
capybara (~> 2.4.1)
|
||||||
coffee-rails (~> 4.0.0)
|
coffee-rails (~> 4.0.0)
|
||||||
|
@ -301,6 +378,8 @@ DEPENDENCIES
|
||||||
rails (= 4.1.4)
|
rails (= 4.1.4)
|
||||||
ransack (~> 1.3.0)
|
ransack (~> 1.3.0)
|
||||||
rspec-rails (~> 3.0.2)
|
rspec-rails (~> 3.0.2)
|
||||||
|
rubocop (~> 0.26.1)
|
||||||
|
rubycritic (~> 1.1.1)
|
||||||
sass-rails (~> 4.0.3)
|
sass-rails (~> 4.0.3)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
selectize-rails (~> 0.11.0)
|
selectize-rails (~> 0.11.0)
|
||||||
|
@ -309,7 +388,9 @@ DEPENDENCIES
|
||||||
simpleidn (~> 0.0.5)
|
simpleidn (~> 0.0.5)
|
||||||
spring
|
spring
|
||||||
therubyracer
|
therubyracer
|
||||||
|
traceroute (~> 0.4.0)
|
||||||
turbolinks
|
turbolinks
|
||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
unicorn
|
unicorn
|
||||||
uuidtools (~> 2.1.4)
|
uuidtools (~> 2.1.4)
|
||||||
|
web-console (~> 2.0.0.beta4)
|
||||||
|
|
|
@ -26,9 +26,10 @@ group :red_green_refactor, halt_on_fail:true do
|
||||||
|
|
||||||
# Martin does not want rubocop
|
# Martin does not want rubocop
|
||||||
unless Socket.gethostname == 'martin'
|
unless Socket.gethostname == 'martin'
|
||||||
guard :rubocop do
|
guard :rubocop, cli: '--display-cop-names -c .rubocop-guard.yml' do
|
||||||
watch(%r{.+\.rb$})
|
watch(%r{.+\.rb$})
|
||||||
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
||||||
|
watch(%r{(?:.+/)?\.rubocop-guard\.yml$}) { |m| File.dirname(m[0]) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ class Admin::ContactVersionsController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_contact
|
def set_contact
|
||||||
@contact = Contact.find(params[:id])
|
@contact = Contact.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ class Admin::DomainVersionsController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_domain
|
def set_domain
|
||||||
@domain = Domain.find(params[:id])
|
@domain = Domain.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,6 +53,7 @@ class Admin::UsersController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_params
|
def user_params
|
||||||
params.require(:user).permit(:username, :password, :identity_code, :email, :registrar_id, :admin, :registrar_typeahead, :country_id)
|
params.require(:user).permit(:username, :password, :identity_code, :email, :registrar_id,
|
||||||
|
:admin, :registrar_typeahead, :country_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,10 +12,12 @@ class Client::ContactsController < ClientController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
# rubocop: disable Style/GuardClause
|
||||||
if @contact.registrar != current_registrar
|
if @contact.registrar != current_registrar
|
||||||
flash[:alert] = I18n.t('shared.authentication_error')
|
flash[:alert] = I18n.t('shared.authentication_error')
|
||||||
redirect_to client_contacts_path
|
redirect_to client_contacts_path
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Style/GuardClause
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -27,7 +29,7 @@ class Client::ContactsController < ClientController
|
||||||
redirect_to [:client, @contact]
|
redirect_to [:client, @contact]
|
||||||
else
|
else
|
||||||
flash[:alert] = I18n.t('shared.failed_to_create_contact')
|
flash[:alert] = I18n.t('shared.failed_to_create_contact')
|
||||||
render "new"
|
render 'new'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,7 +65,7 @@ class Client::ContactsController < ClientController
|
||||||
end
|
end
|
||||||
|
|
||||||
def contact_params
|
def contact_params
|
||||||
params.require(:contact).permit( :email, :phone, :fax, :ident_type, :ident, :auth_info, :name, :org_name,
|
params.require(:contact).permit(:email, :phone, :fax, :ident_type, :ident, :auth_info, :name, :org_name,
|
||||||
address_attributes: [:city, :street, :zip, :street2, :street3, :country_id])
|
address_attributes: [:city, :street, :zip, :street2, :street3, :country_id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,8 @@ class Client::DomainTransfersController < ClientController
|
||||||
@domain_transfer = DomainTransfer.new
|
@domain_transfer = DomainTransfer.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
def create
|
def create
|
||||||
@domain_transfer = @domain.pending_transfer
|
@domain_transfer = @domain.pending_transfer
|
||||||
|
|
||||||
|
@ -36,6 +38,8 @@ class Client::DomainTransfersController < ClientController
|
||||||
redirect_to [:client, @domain_transfer]
|
redirect_to [:client, @domain_transfer]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
|
|
||||||
def approve
|
def approve
|
||||||
if can? :approve_as_client, @domain_transfer
|
if can? :approve_as_client, @domain_transfer
|
||||||
|
@ -63,6 +67,8 @@ class Client::DomainTransfersController < ClientController
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
def set_domain
|
def set_domain
|
||||||
@domain_transfer = DomainTransfer.new
|
@domain_transfer = DomainTransfer.new
|
||||||
@domain = Domain.find_by(name: params[:domain_name])
|
@domain = Domain.find_by(name: params[:domain_name])
|
||||||
|
@ -81,4 +87,6 @@ class Client::DomainTransfersController < ClientController
|
||||||
render 'new'
|
render 'new'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop: enbale Metrics/PerceivedComplexity
|
||||||
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,9 @@ module Epp::Common
|
||||||
end
|
end
|
||||||
|
|
||||||
def proxy
|
def proxy
|
||||||
@svTRID = "ccReg-#{'%010d' % rand(10**10)}"
|
# rubocop: disable Style/VariableName
|
||||||
|
@svTRID = "ccReg-#{format('%010d', rand(10**10))}"
|
||||||
|
# rubocop: enable Style/VariableName
|
||||||
send(params[:command])
|
send(params[:command])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,7 +48,10 @@ module Epp::Common
|
||||||
end
|
end
|
||||||
|
|
||||||
# for debugging
|
# for debugging
|
||||||
@errors << { code: '1', msg: 'handle_errors was executed when there were actually no errors' } if @errors.blank?
|
@errors << {
|
||||||
|
code: '1',
|
||||||
|
msg: 'handle_errors was executed when there were actually no errors'
|
||||||
|
} if @errors.blank?
|
||||||
|
|
||||||
@errors.uniq!
|
@errors.uniq!
|
||||||
|
|
||||||
|
@ -60,7 +65,10 @@ module Epp::Common
|
||||||
|
|
||||||
def xml_attrs_present?(ph, attributes)
|
def xml_attrs_present?(ph, attributes)
|
||||||
attributes.each do |x|
|
attributes.each do |x|
|
||||||
epp_errors << { code: '2003', msg: I18n.t('errors.messages.required_parameter_missing', key: x.last) } unless has_attribute(ph, x)
|
epp_errors << {
|
||||||
|
code: '2003',
|
||||||
|
msg: I18n.t('errors.messages.required_parameter_missing', key: x.last)
|
||||||
|
} unless has_attribute(ph, x)
|
||||||
end
|
end
|
||||||
epp_errors.empty?
|
epp_errors.empty?
|
||||||
end
|
end
|
||||||
|
@ -68,24 +76,27 @@ module Epp::Common
|
||||||
def xml_attrs_array_present?(array_ph, attributes)
|
def xml_attrs_array_present?(array_ph, attributes)
|
||||||
[array_ph].flatten.each do |ph|
|
[array_ph].flatten.each do |ph|
|
||||||
attributes.each do |x|
|
attributes.each do |x|
|
||||||
unless has_attribute(ph, x)
|
next if has_attribute(ph, x)
|
||||||
epp_errors << { code: '2003', msg: I18n.t('errors.messages.required_parameter_missing', key: x.last) }
|
epp_errors << {
|
||||||
end
|
code: '2003',
|
||||||
|
msg: I18n.t('errors.messages.required_parameter_missing', key: x.last)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
epp_errors.empty?
|
epp_errors.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop: disable Style/PredicateName
|
||||||
def has_attribute(ph, path)
|
def has_attribute(ph, path)
|
||||||
path.reduce(ph) do |location, key|
|
path.reduce(ph) do |location, key|
|
||||||
location.respond_to?(:keys) ? location[key] : nil
|
location.respond_to?(:keys) ? location[key] : nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Style/PredicateName
|
||||||
|
|
||||||
def validate_request
|
def validate_request
|
||||||
validation_method = "validate_#{OBJECT_TYPES[params_hash['epp']['xmlns:ns2']]}_#{params[:command]}_request"
|
validation_method = "validate_#{OBJECT_TYPES[params_hash['epp']['xmlns:ns2']]}_#{params[:command]}_request"
|
||||||
if respond_to?(validation_method, true)
|
return unless respond_to?(validation_method, true)
|
||||||
handle_errors and return unless send(validation_method)
|
handle_errors and return unless send(validation_method)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class SessionsController < Devise::SessionsController
|
class SessionsController < Devise::SessionsController
|
||||||
def create
|
def create
|
||||||
#TODO: Create ID Card login here:
|
# TODO: Create ID Card login here:
|
||||||
# this is just testing config
|
# this is just testing config
|
||||||
# if Rails.env.development? || Rails.env.test?
|
# if Rails.env.development? || Rails.env.test?
|
||||||
@user = User.find_by(username: 'gitlab') if params[:gitlab]
|
@user = User.find_by(username: 'gitlab') if params[:gitlab]
|
||||||
|
@ -10,8 +10,7 @@ class SessionsController < Devise::SessionsController
|
||||||
session[:current_user_registrar_id] = Registrar.first.id if @user.admin?
|
session[:current_user_registrar_id] = Registrar.first.id if @user.admin?
|
||||||
|
|
||||||
flash[:notice] = I18n.t('shared.welcome')
|
flash[:notice] = I18n.t('shared.welcome')
|
||||||
sign_in_and_redirect @user, :event => :authentication
|
sign_in_and_redirect @user, event: :authentication
|
||||||
return
|
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
def coffee_script_tag(&block)
|
def coffee_script_tag(&block)
|
||||||
content_tag(:script, CoffeeScript.compile(capture(&block)).html_safe, :type => 'text/javascript')
|
content_tag(:script, CoffeeScript.compile(capture(&block)).html_safe, type: 'text/javascript')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,6 +20,7 @@ module Epp::ContactsHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/CyclomaticComplexity
|
||||||
def delete_contact
|
def delete_contact
|
||||||
@contact = find_contact
|
@contact = find_contact
|
||||||
handle_errors(@contact) and return unless owner?
|
handle_errors(@contact) and return unless owner?
|
||||||
|
@ -28,6 +29,7 @@ module Epp::ContactsHelper
|
||||||
|
|
||||||
render '/epp/contacts/delete'
|
render '/epp/contacts/delete'
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Metrics/CyclomaticComplexity
|
||||||
|
|
||||||
def check_contact
|
def check_contact
|
||||||
ph = params_hash['epp']['command']['check']['check']
|
ph = params_hash['epp']['command']['check']['check']
|
||||||
|
@ -54,11 +56,11 @@ module Epp::ContactsHelper
|
||||||
## CREATE
|
## CREATE
|
||||||
def validate_contact_create_request
|
def validate_contact_create_request
|
||||||
@ph = params_hash['epp']['command']['create']['create']
|
@ph = params_hash['epp']['command']['create']['create']
|
||||||
xml_attrs_present?(@ph, [ %w(authInfo pw), %w(postalInfo)])
|
xml_attrs_present?(@ph, [%w(authInfo pw), %w(postalInfo)])
|
||||||
|
|
||||||
return epp_errors.empty? unless @ph['postalInfo'].is_a?(Hash) || @ph['postalInfo'].is_a?(Array)
|
return epp_errors.empty? unless @ph['postalInfo'].is_a?(Hash) || @ph['postalInfo'].is_a?(Array)
|
||||||
|
|
||||||
#(epp_errors << Address.validate_postal_info_types(parsed_frame)).flatten!
|
# (epp_errors << Address.validate_postal_info_types(parsed_frame)).flatten!
|
||||||
xml_attrs_array_present?(@ph['postalInfo'], [%w(name), %w(addr city), %w(addr cc)])
|
xml_attrs_array_present?(@ph['postalInfo'], [%w(name), %w(addr city), %w(addr cc)])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -114,7 +116,7 @@ module Epp::ContactsHelper
|
||||||
|
|
||||||
def owner?
|
def owner?
|
||||||
return false unless find_contact
|
return false unless find_contact
|
||||||
#return true if current_epp_user.registrar == find_contact.created_by.try(:registrar)
|
# return true if current_epp_user.registrar == find_contact.created_by.try(:registrar)
|
||||||
return true if @contact.registrar == current_epp_user.registrar
|
return true if @contact.registrar == current_epp_user.registrar
|
||||||
epp_errors << { code: '2201', msg: t('errors.messages.epp_authorization_error') }
|
epp_errors << { code: '2201', msg: t('errors.messages.epp_authorization_error') }
|
||||||
false
|
false
|
||||||
|
|
|
@ -8,12 +8,12 @@ module Epp::DomainsHelper
|
||||||
|
|
||||||
if @domain.errors.any?
|
if @domain.errors.any?
|
||||||
handle_errors(@domain)
|
handle_errors(@domain)
|
||||||
raise ActiveRecord::Rollback and return
|
fail ActiveRecord::Rollback and return
|
||||||
end
|
end
|
||||||
|
|
||||||
unless @domain.save
|
unless @domain.save
|
||||||
handle_errors(@domain)
|
handle_errors(@domain)
|
||||||
raise ActiveRecord::Rollback and return
|
fail ActiveRecord::Rollback and return
|
||||||
end
|
end
|
||||||
|
|
||||||
render '/epp/domains/create'
|
render '/epp/domains/create'
|
||||||
|
@ -44,6 +44,7 @@ module Epp::DomainsHelper
|
||||||
render '/epp/domains/info'
|
render '/epp/domains/info'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/CyclomaticComplexity
|
||||||
def update_domain
|
def update_domain
|
||||||
Epp::EppDomain.transaction do
|
Epp::EppDomain.transaction do
|
||||||
@domain = find_domain
|
@domain = find_domain
|
||||||
|
@ -58,17 +59,18 @@ module Epp::DomainsHelper
|
||||||
|
|
||||||
if @domain.errors.any?
|
if @domain.errors.any?
|
||||||
handle_errors(@domain)
|
handle_errors(@domain)
|
||||||
raise ActiveRecord::Rollback and return
|
fail ActiveRecord::Rollback and return
|
||||||
end
|
end
|
||||||
|
|
||||||
unless @domain.save
|
unless @domain.save
|
||||||
handle_errors(@domain)
|
handle_errors(@domain)
|
||||||
raise ActiveRecord::Rollback and return
|
fail ActiveRecord::Rollback and return
|
||||||
end
|
end
|
||||||
|
|
||||||
render '/epp/domains/success'
|
render '/epp/domains/success'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Metrics/CyclomaticComplexity
|
||||||
|
|
||||||
def transfer_domain
|
def transfer_domain
|
||||||
@domain = find_domain(secure: false)
|
@domain = find_domain(secure: false)
|
||||||
|
@ -79,6 +81,7 @@ module Epp::DomainsHelper
|
||||||
render '/epp/domains/transfer'
|
render '/epp/domains/transfer'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/CyclomaticComplexity
|
||||||
def delete_domain
|
def delete_domain
|
||||||
@domain = find_domain
|
@domain = find_domain
|
||||||
|
|
||||||
|
@ -88,6 +91,7 @@ module Epp::DomainsHelper
|
||||||
|
|
||||||
render '/epp/domains/success'
|
render '/epp/domains/success'
|
||||||
end
|
end
|
||||||
|
# rubocop:enbale Metrics/CyclomaticComplexity
|
||||||
|
|
||||||
### HELPER METHODS ###
|
### HELPER METHODS ###
|
||||||
|
|
||||||
|
@ -166,12 +170,20 @@ module Epp::DomainsHelper
|
||||||
domain = Epp::EppDomain.find_by(name: @ph[:name])
|
domain = Epp::EppDomain.find_by(name: @ph[:name])
|
||||||
|
|
||||||
unless domain
|
unless domain
|
||||||
epp_errors << { code: '2303', msg: I18n.t('errors.messages.epp_domain_not_found'), value: { obj: 'name', val: @ph[:name] } }
|
epp_errors << {
|
||||||
|
code: '2303',
|
||||||
|
msg: I18n.t('errors.messages.epp_domain_not_found'),
|
||||||
|
value: { obj: 'name', val: @ph[:name] }
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if domain.registrar != current_epp_user.registrar && secure[:secure] == true
|
if domain.registrar != current_epp_user.registrar && secure[:secure] == true
|
||||||
epp_errors << { code: '2302', msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'), value: { obj: 'name', val: @ph[:name] } }
|
epp_errors << {
|
||||||
|
code: '2302',
|
||||||
|
msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'),
|
||||||
|
value: { obj: 'name', val: @ph[:name] }
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
class Ability
|
class Ability
|
||||||
include CanCan::Ability
|
include CanCan::Ability
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/MethodLength
|
||||||
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
def initialize(user)
|
def initialize(user)
|
||||||
|
alias_action :create, :read, :update, :destroy, to: :crud
|
||||||
alias_action :create, :read, :update, :destroy, :to => :crud
|
|
||||||
|
|
||||||
user ||= User.new
|
user ||= User.new
|
||||||
|
|
||||||
if Rails.env.production?
|
if Rails.env.production?
|
||||||
case REGISTRY_ENV
|
case REGISTRY_ENV
|
||||||
when :client
|
when :eedirekt
|
||||||
|
can :view, :eedirekt
|
||||||
|
can :create, :session
|
||||||
|
admin = false
|
||||||
|
when :registrar
|
||||||
|
can :view, :registrar
|
||||||
can :create, :session
|
can :create, :session
|
||||||
admin = false
|
admin = false
|
||||||
when :admin
|
when :admin
|
||||||
|
@ -32,7 +38,7 @@ class Ability
|
||||||
can :read, DomainTransfer, transfer_to_id: user.registrar.id
|
can :read, DomainTransfer, transfer_to_id: user.registrar.id
|
||||||
can :read, DomainTransfer, transfer_from_id: user.registrar.id
|
can :read, DomainTransfer, transfer_from_id: user.registrar.id
|
||||||
can :approve_as_client, DomainTransfer,
|
can :approve_as_client, DomainTransfer,
|
||||||
transfer_from_id: user.registrar.id, status: DomainTransfer::PENDING
|
transfer_from_id: user.registrar.id, status: DomainTransfer::PENDING
|
||||||
end
|
end
|
||||||
|
|
||||||
# Define abilities for the passed in user here. For example:
|
# Define abilities for the passed in user here. For example:
|
||||||
|
@ -62,4 +68,6 @@ class Ability
|
||||||
# See the wiki for details:
|
# See the wiki for details:
|
||||||
# https://github.com/ryanb/cancan/wiki/Defining-Abilities
|
# https://github.com/ryanb/cancan/wiki/Defining-Abilities
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Metrics/MethodLength
|
||||||
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,19 +13,27 @@ class Address < ActiveRecord::Base
|
||||||
has_paper_trail class_name: 'AddressVersion'
|
has_paper_trail class_name: 'AddressVersion'
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
# def validate_postal_info_types(parsed_frame)
|
# def validate_postal_info_types(parsed_frame)
|
||||||
# errors, used = [], []
|
# errors, used = [], []
|
||||||
# parsed_frame.css('postalInfo').each do |pi|
|
# parsed_frame.css('postalInfo').each do |pi|
|
||||||
# attr = pi.attributes['type'].try(:value)
|
# attr = pi.attributes['type'].try(:value)
|
||||||
# errors << { code: 2003, msg: I18n.t('errors.messages.attr_missing', key: 'type') } and next unless attr
|
# errors << {
|
||||||
# unless TYPES.include?(attr)
|
# code: 2003, msg: I18n.t('errors.messages.attr_missing', key: 'type')
|
||||||
# errors << { code: 2005, msg: I18n.t('errors.messages.invalid_type'), value: { obj: 'type', val: attr } }
|
# } and next unless attr
|
||||||
# next
|
# unless TYPES.include?(attr)
|
||||||
# end
|
# errors << {
|
||||||
# errors << { code: 2005, msg: I18n.t('errors.messages.repeating_postal_info') } and next if used.include?(attr)
|
# code: 2005,
|
||||||
# used << attr
|
# msg: I18n.t('errors.messages.invalid_type'), value: { obj: 'type', val: attr }
|
||||||
# end; errors
|
# }
|
||||||
# end
|
# next
|
||||||
|
# end
|
||||||
|
# errors << {
|
||||||
|
# code: 2005,
|
||||||
|
# msg: I18n.t('errors.messages.repeating_postal_info')
|
||||||
|
# } and next if used.include?(attr)
|
||||||
|
# used << attr
|
||||||
|
# end; errors
|
||||||
|
# end
|
||||||
|
|
||||||
def extract_attributes(ah)
|
def extract_attributes(ah)
|
||||||
address_hash = {}
|
address_hash = {}
|
||||||
|
@ -36,10 +44,10 @@ class Address < ActiveRecord::Base
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# def local?(postal_info)
|
# def local?(postal_info)
|
||||||
# return :local_address_attributes if postal_info[:type] == LOCAL_TYPE_SHORT
|
# return :local_address_attributes if postal_info[:type] == LOCAL_TYPE_SHORT
|
||||||
# :international_address_attributes
|
# :international_address_attributes
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def addr_hash_from_params(addr)
|
def addr_hash_from_params(addr)
|
||||||
return {} if addr.nil?
|
return {} if addr.nil?
|
||||||
|
|
|
@ -25,7 +25,7 @@ module EppErrors
|
||||||
values.each do |err|
|
values.each do |err|
|
||||||
code, value = find_epp_code_and_value(err)
|
code, value = find_epp_code_and_value(err)
|
||||||
next unless code
|
next unless code
|
||||||
epp_errors << { code: code, msg: err, value: value}
|
epp_errors << { code: code, msg: err, value: value }
|
||||||
end
|
end
|
||||||
epp_errors
|
epp_errors
|
||||||
end
|
end
|
||||||
|
@ -33,11 +33,11 @@ module EppErrors
|
||||||
def collect_child_errors(key)
|
def collect_child_errors(key)
|
||||||
macro = self.class.reflect_on_association(key).macro
|
macro = self.class.reflect_on_association(key).macro
|
||||||
multi = [:has_and_belongs_to_many, :has_many]
|
multi = [:has_and_belongs_to_many, :has_many]
|
||||||
single = [:belongs_to, :has_one]
|
# single = [:belongs_to, :has_one]
|
||||||
|
|
||||||
epp_errors = []
|
epp_errors = []
|
||||||
send(key).each do |x|
|
send(key).each do |x|
|
||||||
x.errors.messages.each do |key, values|
|
x.errors.messages.each do |_key, values|
|
||||||
epp_errors << x.collect_parent_errors(values)
|
epp_errors << x.collect_parent_errors(values)
|
||||||
end
|
end
|
||||||
end if multi.include?(macro)
|
end if multi.include?(macro)
|
||||||
|
|
|
@ -18,7 +18,5 @@ module UserEvents
|
||||||
def epp_user_events(id)
|
def epp_user_events(id)
|
||||||
where(whodunnit: "#{id}-EppUser")
|
where(whodunnit: "#{id}-EppUser")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,37 +5,37 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
include EppErrors
|
include EppErrors
|
||||||
|
|
||||||
#has_one :local_address, dependent: :destroy
|
# has_one :local_address, dependent: :destroy
|
||||||
#has_one :international_address, dependent: :destroy
|
# has_one :international_address, dependent: :destroy
|
||||||
has_one :address, dependent: :destroy
|
has_one :address, dependent: :destroy
|
||||||
has_one :disclosure, class_name: 'ContactDisclosure'
|
has_one :disclosure, class_name: 'ContactDisclosure'
|
||||||
|
|
||||||
has_many :domain_contacts
|
has_many :domain_contacts
|
||||||
has_many :domains, through: :domain_contacts
|
has_many :domains, through: :domain_contacts
|
||||||
|
|
||||||
# TODO remove the x_by
|
# TODO: remove the x_by
|
||||||
belongs_to :created_by, class_name: 'EppUser', foreign_key: :created_by_id
|
belongs_to :created_by, class_name: 'EppUser', foreign_key: :created_by_id
|
||||||
belongs_to :updated_by, class_name: 'EppUser', foreign_key: :updated_by_id
|
belongs_to :updated_by, class_name: 'EppUser', foreign_key: :updated_by_id
|
||||||
belongs_to :registrar
|
belongs_to :registrar
|
||||||
|
|
||||||
accepts_nested_attributes_for :address, :disclosure
|
accepts_nested_attributes_for :address, :disclosure
|
||||||
|
|
||||||
validates :code, :phone, :email, :ident, :address, :registrar,presence: true
|
validates :code, :phone, :email, :ident, :address, :registrar, presence: true
|
||||||
|
|
||||||
validate :ident_must_be_valid
|
validate :ident_must_be_valid
|
||||||
#validate :presence_of_one_address
|
# validate :presence_of_one_address
|
||||||
|
|
||||||
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/ # /\+\d{3}\.\d+/
|
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/ # /\+\d{3}\.\d+/
|
||||||
validates :email, format: /@/
|
validates :email, format: /@/
|
||||||
|
|
||||||
validates :code, uniqueness: { message: :epp_id_taken }
|
validates :code, uniqueness: { message: :epp_id_taken }
|
||||||
|
|
||||||
delegate :country, to: :address#, prefix: true
|
delegate :country, to: :address # , prefix: true
|
||||||
delegate :city, to: :address#, prefix: true
|
delegate :city, to: :address # , prefix: true
|
||||||
delegate :street, to: :address#, prefix: true
|
delegate :street, to: :address # , prefix: true
|
||||||
delegate :zip, to: :address#, prefix: true
|
delegate :zip, to: :address # , prefix: true
|
||||||
|
|
||||||
#scopes
|
# scopes
|
||||||
scope :current_registrars, ->(id) { where(registrar_id: id) }
|
scope :current_registrars, ->(id) { where(registrar_id: id) }
|
||||||
# archiving
|
# archiving
|
||||||
has_paper_trail class_name: 'ContactVersion'
|
has_paper_trail class_name: 'ContactVersion'
|
||||||
|
@ -97,7 +97,6 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
# should use only in transaction
|
# should use only in transaction
|
||||||
def destroy_and_clean
|
def destroy_and_clean
|
||||||
|
|
||||||
if relations_with_domain?
|
if relations_with_domain?
|
||||||
errors.add(:domains, :exist)
|
errors.add(:domains, :exist)
|
||||||
return false
|
return false
|
||||||
|
@ -161,6 +160,4 @@ class Contact < ActiveRecord::Base
|
||||||
res.reduce([]) { |o, v| o << { id: v[:id], display_key: "#{v.name} (#{v.code})" } }
|
res.reduce([]) { |o, v| o << { id: v[:id], display_key: "#{v.name} (#{v.code})" } }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,5 +5,4 @@ class ContactVersion < PaperTrail::Version
|
||||||
|
|
||||||
self.table_name = :contact_versions
|
self.table_name = :contact_versions
|
||||||
self.sequence_name = :contact_version_id_seq
|
self.sequence_name = :contact_version_id_seq
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Domain < ActiveRecord::Base
|
class Domain < ActiveRecord::Base
|
||||||
# TODO whois requests ip whitelist for full info for own domains and partial info for other domains
|
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
|
||||||
# TODO most inputs should be trimmed before validatation, probably some global logic?
|
# TODO: most inputs should be trimmed before validatation, probably some global logic?
|
||||||
paginates_per 10 # just for showoff
|
paginates_per 10 # just for showoff
|
||||||
|
|
||||||
belongs_to :registrar
|
belongs_to :registrar
|
||||||
|
@ -9,27 +9,27 @@ class Domain < ActiveRecord::Base
|
||||||
has_many :domain_contacts, dependent: :delete_all
|
has_many :domain_contacts, dependent: :delete_all
|
||||||
accepts_nested_attributes_for :domain_contacts, allow_destroy: true
|
accepts_nested_attributes_for :domain_contacts, allow_destroy: true
|
||||||
|
|
||||||
has_many :tech_contacts, -> do
|
has_many :tech_contacts,
|
||||||
where(domain_contacts: { contact_type: DomainContact::TECH })
|
-> { where(domain_contacts: { contact_type: DomainContact::TECH }) },
|
||||||
end, through: :domain_contacts, source: :contact
|
through: :domain_contacts, source: :contact
|
||||||
|
|
||||||
has_many :admin_contacts, -> do
|
has_many :admin_contacts,
|
||||||
where(domain_contacts: { contact_type: DomainContact::ADMIN })
|
-> { where(domain_contacts: { contact_type: DomainContact::ADMIN }) },
|
||||||
end, through: :domain_contacts, source: :contact
|
through: :domain_contacts, source: :contact
|
||||||
|
|
||||||
has_many :nameservers, dependent: :delete_all
|
has_many :nameservers, dependent: :delete_all
|
||||||
accepts_nested_attributes_for :nameservers, allow_destroy: true,
|
accepts_nested_attributes_for :nameservers, allow_destroy: true,
|
||||||
reject_if: proc { |attrs| attrs[:hostname].blank? }
|
reject_if: proc { |attrs| attrs[:hostname].blank? }
|
||||||
|
|
||||||
has_many :domain_statuses, dependent: :delete_all
|
has_many :domain_statuses, dependent: :delete_all
|
||||||
accepts_nested_attributes_for :domain_statuses, allow_destroy: true,
|
accepts_nested_attributes_for :domain_statuses, allow_destroy: true,
|
||||||
reject_if: proc { |attrs| attrs[:value].blank? }
|
reject_if: proc { |attrs| attrs[:value].blank? }
|
||||||
|
|
||||||
has_many :domain_transfers, dependent: :delete_all
|
has_many :domain_transfers, dependent: :delete_all
|
||||||
|
|
||||||
has_many :dnskeys, dependent: :delete_all
|
has_many :dnskeys, dependent: :delete_all
|
||||||
# accepts_nested_attributes_for :delegation_signers, allow_destroy: true,
|
accepts_nested_attributes_for :dnskeys, allow_destroy: true,
|
||||||
# reject_if: proc { |attrs| attrs[:public_key].blank? }
|
reject_if: proc { |attrs| attrs[:public_key].blank? }
|
||||||
|
|
||||||
delegate :code, to: :owner_contact, prefix: true
|
delegate :code, to: :owner_contact, prefix: true
|
||||||
delegate :email, to: :owner_contact, prefix: true
|
delegate :email, to: :owner_contact, prefix: true
|
||||||
|
@ -64,9 +64,9 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
def name=(value)
|
def name=(value)
|
||||||
value.strip!
|
value.strip!
|
||||||
write_attribute(:name, SimpleIDN.to_unicode(value))
|
self[:name] = SimpleIDN.to_unicode(value)
|
||||||
write_attribute(:name_puny, SimpleIDN.to_ascii(value))
|
self[:name_puny] = SimpleIDN.to_ascii(value)
|
||||||
write_attribute(:name_dirty, value)
|
self[:name_dirty] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def owner_contact_typeahead
|
def owner_contact_typeahead
|
||||||
|
@ -118,7 +118,7 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
def validate_nameserver_ips
|
def validate_nameserver_ips
|
||||||
nameservers.each do |ns|
|
nameservers.each do |ns|
|
||||||
next if !ns.hostname.end_with?(name)
|
next unless ns.hostname.end_with?(name)
|
||||||
next if ns.ipv4.present?
|
next if ns.ipv4.present?
|
||||||
errors.add(:nameservers, :invalid) if errors[:nameservers].blank?
|
errors.add(:nameservers, :invalid) if errors[:nameservers].blank?
|
||||||
ns.errors.add(:ipv4, :blank)
|
ns.errors.add(:ipv4, :blank)
|
||||||
|
@ -214,11 +214,13 @@ class Domain < ActiveRecord::Base
|
||||||
name
|
name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Lint/Loop
|
||||||
def generate_auth_info
|
def generate_auth_info
|
||||||
begin
|
begin
|
||||||
self.auth_info = SecureRandom.hex
|
self.auth_info = SecureRandom.hex
|
||||||
end while self.class.exists?(auth_info: auth_info)
|
end while self.class.exists?(auth_info: auth_info)
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Lint/Loop
|
||||||
|
|
||||||
def attach_default_contacts
|
def attach_default_contacts
|
||||||
tech_contacts << owner_contact if tech_contacts_count.zero?
|
tech_contacts << owner_contact if tech_contacts_count.zero?
|
||||||
|
|
|
@ -29,9 +29,26 @@ class DomainStatus < ActiveRecord::Base
|
||||||
DELETE_CANDIDATE = 'deleteCandidate'
|
DELETE_CANDIDATE = 'deleteCandidate'
|
||||||
EXPIRED = 'expired'
|
EXPIRED = 'expired'
|
||||||
|
|
||||||
STATUSES = [CLIENT_DELETE_PROHIBITED, SERVER_DELETE_PROHIBITED, CLIENT_HOLD, SERVER_HOLD, CLIENT_RENEW_PROHIBITED, SERVER_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED, SERVER_TRANSFER_PROHIBITED, CLIENT_UPDATE_PROHIBITED, SERVER_UPDATE_PROHIBITED, INACTIVE, OK, PENDING_CREATE, PENDING_DELETE, PENDING_RENEW, PENDING_TRANSFER, PENDING_UPDATE, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED, SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED, FORCE_DELETE, DELETE_CANDIDATE, EXPIRED]
|
STATUSES = [
|
||||||
CLIENT_STATUSES = [CLIENT_DELETE_PROHIBITED, CLIENT_HOLD, CLIENT_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED, CLIENT_UPDATE_PROHIBITED]
|
CLIENT_DELETE_PROHIBITED, SERVER_DELETE_PROHIBITED, CLIENT_HOLD, SERVER_HOLD,
|
||||||
SERVER_STATUSES = [SERVER_DELETE_PROHIBITED, SERVER_HOLD, SERVER_RENEW_PROHIBITED, SERVER_TRANSFER_PROHIBITED, SERVER_UPDATE_PROHIBITED, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED, SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED]
|
CLIENT_RENEW_PROHIBITED, SERVER_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED,
|
||||||
|
SERVER_TRANSFER_PROHIBITED, CLIENT_UPDATE_PROHIBITED, SERVER_UPDATE_PROHIBITED,
|
||||||
|
INACTIVE, OK, PENDING_CREATE, PENDING_DELETE, PENDING_RENEW, PENDING_TRANSFER,
|
||||||
|
PENDING_UPDATE, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED,
|
||||||
|
SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED, FORCE_DELETE,
|
||||||
|
DELETE_CANDIDATE, EXPIRED
|
||||||
|
]
|
||||||
|
|
||||||
|
CLIENT_STATUSES = [
|
||||||
|
CLIENT_DELETE_PROHIBITED, CLIENT_HOLD, CLIENT_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED,
|
||||||
|
CLIENT_UPDATE_PROHIBITED
|
||||||
|
]
|
||||||
|
|
||||||
|
SERVER_STATUSES = [
|
||||||
|
SERVER_DELETE_PROHIBITED, SERVER_HOLD, SERVER_RENEW_PROHIBITED, SERVER_TRANSFER_PROHIBITED,
|
||||||
|
SERVER_UPDATE_PROHIBITED, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED,
|
||||||
|
SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED
|
||||||
|
]
|
||||||
|
|
||||||
# archiving
|
# archiving
|
||||||
has_paper_trail class_name: 'DomainStatusVersion'
|
has_paper_trail class_name: 'DomainStatusVersion'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# rubocop: disable Metrics/ClassLength
|
||||||
class Epp::EppDomain < Domain
|
class Epp::EppDomain < Domain
|
||||||
include EppErrors
|
include EppErrors
|
||||||
|
|
||||||
|
@ -24,10 +25,10 @@ class Epp::EppDomain < Domain
|
||||||
],
|
],
|
||||||
'2004' => [ # Parameter value range error
|
'2004' => [ # Parameter value range error
|
||||||
[:nameservers, :out_of_range,
|
[:nameservers, :out_of_range,
|
||||||
{
|
{
|
||||||
min: domain_validation_sg.setting(:ns_min_count).value,
|
min: domain_validation_sg.setting(:ns_min_count).value,
|
||||||
max: domain_validation_sg.setting(:ns_max_count).value
|
max: domain_validation_sg.setting(:ns_max_count).value
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[:period, :out_of_range, { value: { obj: 'period', val: period } }],
|
[:period, :out_of_range, { value: { obj: 'period', val: period } }],
|
||||||
[:dnskeys, :out_of_range,
|
[:dnskeys, :out_of_range,
|
||||||
|
@ -81,8 +82,8 @@ class Epp::EppDomain < Domain
|
||||||
|
|
||||||
# TODO: Find out if there are any attributes that can be changed
|
# TODO: Find out if there are any attributes that can be changed
|
||||||
# if not, delete this method
|
# if not, delete this method
|
||||||
def parse_and_update_domain_attributes(parsed_frame)
|
def parse_and_update_domain_attributes(_parsed_frame)
|
||||||
#assign_attributes(self.class.parse_update_params_from_frame(parsed_frame))
|
# assign_attributes(self.class.parse_update_params_from_frame(parsed_frame))
|
||||||
|
|
||||||
errors.empty?
|
errors.empty?
|
||||||
end
|
end
|
||||||
|
@ -276,6 +277,9 @@ class Epp::EppDomain < Domain
|
||||||
|
|
||||||
### TRANSFER ###
|
### TRANSFER ###
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: disable Metrics/MethodLength
|
||||||
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
def transfer(params)
|
def transfer(params)
|
||||||
return false unless authenticate(params[:pw])
|
return false unless authenticate(params[:pw])
|
||||||
|
|
||||||
|
@ -314,6 +318,9 @@ class Epp::EppDomain < Domain
|
||||||
save
|
save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: enable Metrics/MethodLength
|
||||||
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
|
|
||||||
def approve_pending_transfer(current_user)
|
def approve_pending_transfer(current_user)
|
||||||
pt = pending_transfer
|
pt = pending_transfer
|
||||||
|
@ -479,3 +486,4 @@ class Epp::EppDomain < Domain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Metrics/ClassLength
|
||||||
|
|
|
@ -2,7 +2,7 @@ class EppSession < ActiveRecord::Base
|
||||||
before_save :marshal_data!
|
before_save :marshal_data!
|
||||||
|
|
||||||
def data
|
def data
|
||||||
@data ||= self.class.unmarshal(read_attribute(:data)) || {}
|
@data ||= self.class.unmarshal(self[:data]) || {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](key)
|
def [](key)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
# rubocop: disable Metrics/ClassLength
|
||||||
class EppUser < ActiveRecord::Base
|
class EppUser < ActiveRecord::Base
|
||||||
# TODO should have max request limit per day
|
# TODO: should have max request limit per day
|
||||||
belongs_to :registrar
|
belongs_to :registrar
|
||||||
has_many :contacts
|
has_many :contacts
|
||||||
|
|
||||||
|
@ -16,3 +17,4 @@ class EppUser < ActiveRecord::Base
|
||||||
username
|
username
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Metrics/ClassLength
|
||||||
|
|
|
@ -4,9 +4,11 @@ class Nameserver < ActiveRecord::Base
|
||||||
belongs_to :registrar
|
belongs_to :registrar
|
||||||
belongs_to :domain
|
belongs_to :domain
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/LineLength
|
||||||
validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ }
|
validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ }
|
||||||
validates :ipv4, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_blank: true }
|
validates :ipv4, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_blank: true }
|
||||||
validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true }
|
validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true }
|
||||||
|
# rubocop: enable Metrics/LineLength
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
class Registrar < ActiveRecord::Base
|
class Registrar < ActiveRecord::Base
|
||||||
belongs_to :country
|
belongs_to :country
|
||||||
has_many :domains, :dependent => :restrict_with_error
|
has_many :domains, dependent: :restrict_with_error
|
||||||
has_many :contacts, :dependent => :restrict_with_error
|
has_many :contacts, dependent: :restrict_with_error
|
||||||
has_many :epp_users, :dependent => :restrict_with_error
|
has_many :epp_users, dependent: :restrict_with_error
|
||||||
has_many :users, :dependent => :restrict_with_error
|
has_many :users, dependent: :restrict_with_error
|
||||||
|
|
||||||
validates :name, :reg_no, :address, :country, presence: true
|
validates :name, :reg_no, :address, :country, presence: true
|
||||||
validates :name, :reg_no, uniqueness: true
|
validates :name, :reg_no, uniqueness: true
|
||||||
|
|
||||||
|
|
||||||
def domain_transfers
|
def domain_transfers
|
||||||
at = DomainTransfer.arel_table
|
at = DomainTransfer.arel_table
|
||||||
DomainTransfer.where(
|
DomainTransfer.where(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
class Right < ActiveRecord::Base
|
class Right < ActiveRecord::Base
|
||||||
|
# rubocop: disable Rails/HasAndBelongsToMany
|
||||||
has_and_belongs_to_many :roles
|
has_and_belongs_to_many :roles
|
||||||
|
# rubocop: enable Rails/HasAndBelongsToMany
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
class Role < ActiveRecord::Base
|
class Role < ActiveRecord::Base
|
||||||
has_many :users
|
has_many :users
|
||||||
|
# rubocop: disable Rails/HasAndBelongsToMany
|
||||||
has_and_belongs_to_many :rights
|
has_and_belongs_to_many :rights
|
||||||
|
# rubocop: enbale Rails/HasAndBelongsToMany
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,9 @@ class User < ActiveRecord::Base
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||||
devise :trackable, :timeoutable
|
devise :trackable, :timeoutable
|
||||||
# TODO Foreign user will get email with activation link,email,temp-password.
|
# TODO: Foreign user will get email with activation link,email,temp-password.
|
||||||
# After activisation, system should require to change temp password.
|
# After activisation, system should require to change temp password.
|
||||||
# TODO Estonian id validation
|
# TODO: Estonian id validation
|
||||||
|
|
||||||
belongs_to :role
|
belongs_to :role
|
||||||
belongs_to :registrar
|
belongs_to :registrar
|
||||||
|
|
|
@ -28,10 +28,14 @@ class DomainNameValidator < ActiveModel::EachValidator
|
||||||
value = SimpleIDN.to_unicode(value).mb_chars.downcase.strip
|
value = SimpleIDN.to_unicode(value).mb_chars.downcase.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/LineLength
|
||||||
unicode_chars = /\u00E4\u00F5\u00F6\u00FC\u0161\u017E/ # äõöüšž
|
unicode_chars = /\u00E4\u00F5\u00F6\u00FC\u0161\u017E/ # äõöüšž
|
||||||
regexp = /\A[a-zA-Z0-9#{unicode_chars}][a-zA-Z0-9#{unicode_chars}-]{0,61}[a-zA-Z0-9#{unicode_chars}]#{general_domains}\z/
|
regexp = /\A[a-zA-Z0-9#{unicode_chars}][a-zA-Z0-9#{unicode_chars}-]{0,61}[a-zA-Z0-9#{unicode_chars}]#{general_domains}\z/
|
||||||
|
# rubocop: enable Metrics/LineLength
|
||||||
|
|
||||||
|
# rubocop: disable Style/DoubleNegation
|
||||||
!!(value =~ regexp)
|
!!(value =~ regexp)
|
||||||
|
# rubocop: enable Style/DoubleNegation
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_reservation(value)
|
def validate_reservation(value)
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
||||||
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
||||||
%link{href: "../../favicon.ico", rel: "icon"}/
|
%link{href: "../../favicon.ico", rel: "icon"}/
|
||||||
%title= t('shared.eedirekt')
|
%title
|
||||||
|
- if can? :view, :registrar
|
||||||
|
= t(:registrar)
|
||||||
|
- else
|
||||||
|
= t('shared.eedirekt')
|
||||||
%body
|
%body
|
||||||
/ Static navbar
|
/ Static navbar
|
||||||
.navbar.navbar-default.navbar-static-top{role: "navigation"}
|
.navbar.navbar-default.navbar-static-top{role: "navigation"}
|
||||||
|
@ -20,7 +24,11 @@
|
||||||
%span.icon-bar
|
%span.icon-bar
|
||||||
%span.icon-bar
|
%span.icon-bar
|
||||||
%span.icon-bar
|
%span.icon-bar
|
||||||
= link_to t('shared.eedirekt'), client_domains_path, class: 'navbar-brand'
|
- if can? :view, :registrar
|
||||||
|
= link_to t(:registrar), client_domains_path, class: 'navbar-brand'
|
||||||
|
- else
|
||||||
|
= link_to t('shared.eedirekt'), client_domains_path, class: 'navbar-brand'
|
||||||
|
|
||||||
.navbar-collapse.collapse
|
.navbar-collapse.collapse
|
||||||
%ul.nav.navbar-nav
|
%ul.nav.navbar-nav
|
||||||
- active_class = ['client/domains', 'client/domain_transfers'].include?(params[:controller]) ? 'active' :nil
|
- active_class = ['client/domains', 'client/domain_transfers'].include?(params[:controller]) ? 'active' :nil
|
||||||
|
|
36
bin/robot
36
bin/robot
|
@ -1,38 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Build and run everything for automatic tests
|
# Update repo
|
||||||
#
|
#
|
||||||
|
|
||||||
set -o pipefail
|
# default locations
|
||||||
|
export LANGUAGE=en_US.UTF-8
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
export LC_ALL=en_US.UTF-8
|
||||||
|
|
||||||
# cd to Rails root directory
|
# cd to Rails root directory
|
||||||
cd "$(dirname "$0")"; cd ..
|
cd "$(dirname "$0")"; cd ..
|
||||||
|
|
||||||
git pull origin master
|
git pull origin master &> /dev/null
|
||||||
git reset --hard
|
git reset --hard &> /dev/null
|
||||||
unset GIT_DIR GIT_WORK_TREE
|
unset GIT_DIR GIT_WORK_TREE
|
||||||
|
|
||||||
# run rubocop
|
bin/robot-audit
|
||||||
echo "RUBOCOP_RESULTS"
|
|
||||||
rubocop
|
|
||||||
echo "END_OF_RUBOCOP_RESULTS"
|
|
||||||
|
|
||||||
bundle install --deployment
|
|
||||||
|
|
||||||
# cp config/secrets-example.yml config/secrets.yml
|
|
||||||
# create manually config/database.yml
|
|
||||||
|
|
||||||
RAILS_ENV=test bundle exec rake db:drop
|
|
||||||
RAILS_ENV=test bundle exec rake db:create
|
|
||||||
RAILS_ENV=test bundle exec rake db:schema:load
|
|
||||||
RAILS_ENV=test bundle exec rake db:seed
|
|
||||||
RAILS_ENV=test bundle exec rake assets:precompile
|
|
||||||
|
|
||||||
echo "GIT_LAST_COMMITS"
|
|
||||||
git log origin/master -n 15 --pretty=oneline | sed -r '/^.{40} Merge branch/d' | sed -r 's/^.{40}/Latests: /'
|
|
||||||
echo "END_OF_GIT_LAST_COMMITS"
|
|
||||||
|
|
||||||
# run tests
|
|
||||||
echo "TEST_RESULTS"
|
|
||||||
RAILS_ENV=test ROBOT=true bundle exec rake test
|
|
||||||
echo "END_OF_TEST_RESULTS"
|
|
||||||
|
|
51
bin/robot-audit
Executable file
51
bin/robot-audit
Executable file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Build and run for automatic tests
|
||||||
|
#
|
||||||
|
|
||||||
|
# fail later
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# cp config/secrets-example.yml config/secrets.yml
|
||||||
|
# create manually config/database.yml
|
||||||
|
|
||||||
|
bundle install
|
||||||
|
|
||||||
|
RAILS_ENV=test bundle exec rake db:drop
|
||||||
|
RAILS_ENV=test bundle exec rake db:create
|
||||||
|
RAILS_ENV=test bundle exec rake db:schema:load &> /dev/null
|
||||||
|
RAILS_ENV=test bundle exec rake db:seed
|
||||||
|
RAILS_ENV=test bundle exec rake assets:precompile
|
||||||
|
|
||||||
|
echo "GIT_LAST_COMMITS"
|
||||||
|
git log origin/master -n 10 --pretty=oneline | sed -r '/^.{40} Merge branch/d' | sed -r 's/^.{40}/Latest: /'
|
||||||
|
echo "END_OF_GIT_LAST_COMMITS"
|
||||||
|
|
||||||
|
echo "RUBOCOP_RESULTS"
|
||||||
|
bundle exec rubocop
|
||||||
|
RCODE=$?
|
||||||
|
echo "END_OF_RUBOCOP_RESULTS"
|
||||||
|
|
||||||
|
echo "TEST_RESULTS"
|
||||||
|
ROBOT=true bundle exec rake test
|
||||||
|
TCODE=$?
|
||||||
|
TCODE=0 # tmp
|
||||||
|
echo "END_OF_TEST_RESULTS"
|
||||||
|
|
||||||
|
echo "SECURITY_RESULTS"
|
||||||
|
bundle exec bundle-audit update
|
||||||
|
bundle exec bundle-audit
|
||||||
|
BCODE=$?
|
||||||
|
BCODE=0 # tmp
|
||||||
|
bundle exec brakeman
|
||||||
|
echo "END_OF_SECURITY_RESULTS"
|
||||||
|
|
||||||
|
# update code review
|
||||||
|
bundle exec rubycritic app lib
|
||||||
|
|
||||||
|
if [ $RCODE == 0 ] && [ $TCODE == 0 ] &&[ $BCODE == 0 ]; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "ROBOTEXITWITHFAILURE"
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -11,12 +11,16 @@ require 'mina/git'
|
||||||
# branch - Branch name to deploy. (needed by mina/git)
|
# branch - Branch name to deploy. (needed by mina/git)
|
||||||
|
|
||||||
set :domain, 'testregistry'
|
set :domain, 'testregistry'
|
||||||
set :deploy_to, '/home/app/registry'
|
set :deploy_to, '/home/app/eedirekt'
|
||||||
set :repository, 'https://github.com/internetee/registry'
|
set :repository, 'https://github.com/internetee/registry'
|
||||||
set :branch, 'master'
|
set :branch, 'master'
|
||||||
|
|
||||||
task :admin do
|
task :admin do
|
||||||
set :deploy_to, '/home/app/admin-registry'
|
set :deploy_to, '/home/app/registry'
|
||||||
|
end
|
||||||
|
|
||||||
|
task :registrar do
|
||||||
|
set :deploy_to, '/home/app/registrar'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
|
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
|
||||||
|
|
|
@ -36,4 +36,13 @@ Rails.application.configure do
|
||||||
# config.action_view.raise_on_missing_translations = true
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
||||||
|
|
||||||
|
# for finding database optimization
|
||||||
|
config.after_initialize do
|
||||||
|
Bullet.enable = true
|
||||||
|
Bullet.bullet_logger = true
|
||||||
|
Bullet.console = true
|
||||||
|
Bullet.rails_logger = true
|
||||||
|
Bullet.add_footer = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,4 +36,11 @@ Rails.application.configure do
|
||||||
|
|
||||||
# Raises error for missing translations
|
# Raises error for missing translations
|
||||||
# config.action_view.raise_on_missing_translations = true
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
|
||||||
|
# for finding database optimization
|
||||||
|
config.after_initialize do
|
||||||
|
Bullet.enable = true
|
||||||
|
Bullet.bullet_logger = true
|
||||||
|
Bullet.raise = true # raise an error if n+1 query occurs
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,8 @@ Devise.setup do |config|
|
||||||
# The secret key used by Devise. Devise uses this key to generate
|
# The secret key used by Devise. Devise uses this key to generate
|
||||||
# random tokens. Changing this key will render invalid all existing
|
# random tokens. Changing this key will render invalid all existing
|
||||||
# confirmation, reset password and unlock tokens in the database.
|
# confirmation, reset password and unlock tokens in the database.
|
||||||
# config.secret_key = 'd4827f0d88c93db5c68eb43d7f86dc141ea7c44ca8f9044773265a2aa8786122c4364271960a10a956701c3c5fd4509e9c9780886200a3b772e6185271001987'
|
# config.secret_key = 'd4827f0d88c93db5c68eb43d7f86dc141ea7c44ca8f' \
|
||||||
|
# '044773265a2aa8786122c4364271960a10a956701c3c5fd4509e9c9780886200a3b772e6185271001987'
|
||||||
|
|
||||||
# ==> Mailer Configuration
|
# ==> Mailer Configuration
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
|
@ -41,12 +42,12 @@ Devise.setup do |config|
|
||||||
# Configure which authentication keys should be case-insensitive.
|
# Configure which authentication keys should be case-insensitive.
|
||||||
# These keys will be downcased upon creating or modifying a user and when used
|
# These keys will be downcased upon creating or modifying a user and when used
|
||||||
# to authenticate or find a user. Default is :email.
|
# to authenticate or find a user. Default is :email.
|
||||||
config.case_insensitive_keys = [ :email ]
|
config.case_insensitive_keys = [:email]
|
||||||
|
|
||||||
# Configure which authentication keys should have whitespace stripped.
|
# Configure which authentication keys should have whitespace stripped.
|
||||||
# These keys will have whitespace before and after removed upon creating or
|
# These keys will have whitespace before and after removed upon creating or
|
||||||
# modifying a user and when used to authenticate or find a user. Default is :email.
|
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||||
config.strip_whitespace_keys = [ :email ]
|
config.strip_whitespace_keys = [:email]
|
||||||
|
|
||||||
# Tell if authentication through request.params is enabled. True by default.
|
# Tell if authentication through request.params is enabled. True by default.
|
||||||
# It can be set to an array that will enable params authentication only for the
|
# It can be set to an array that will enable params authentication only for the
|
||||||
|
@ -97,7 +98,8 @@ Devise.setup do |config|
|
||||||
config.stretches = Rails.env.test? ? 1 : 10
|
config.stretches = Rails.env.test? ? 1 : 10
|
||||||
|
|
||||||
# Setup a pepper to generate the encrypted password.
|
# Setup a pepper to generate the encrypted password.
|
||||||
# config.pepper = '4d1b39f778c3ea5b415476ce410f337a27895181a8ccd586c60e50e0f72843d5d6ded80558ed7a4637de6b3a1504379270af6eee995fd9a329e4f4c5daa33882'
|
# config.pepper = '4d1b39f778c3ea5b415476ce410f337a27895181a8ccd586c60e50e0f7284' \
|
||||||
|
# '3d5d6ded80558ed7a4637de6b3a1504379270af6eee995fd9a329e4f4c5daa33882'
|
||||||
|
|
||||||
# ==> Configuration for :confirmable
|
# ==> Configuration for :confirmable
|
||||||
# A period that the user is allowed to access the website even without
|
# A period that the user is allowed to access the website even without
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
# options: :admin, :client
|
# options: :admin, :registrar, :eedirect
|
||||||
REGISTRY_ENV = :client
|
REGISTRY_ENV = :eedirect
|
||||||
|
|
|
@ -434,3 +434,5 @@ en:
|
||||||
# sorry these need to be refactored - Andres
|
# sorry these need to be refactored - Andres
|
||||||
authentication_error: 'Authentication error'
|
authentication_error: 'Authentication error'
|
||||||
ds_data_and_key_data_must_not_exists_together: 'dsData and keyData objects must not exists together'
|
ds_data_and_key_data_must_not_exists_together: 'dsData and keyData objects must not exists together'
|
||||||
|
|
||||||
|
registrar: Registrar
|
||||||
|
|
|
@ -31,7 +31,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
root 'domains#index'
|
root 'domains#index'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
## CLIENT ROUTES
|
## CLIENT ROUTES
|
||||||
namespace(:client) do
|
namespace(:client) do
|
||||||
|
@ -66,10 +66,10 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
authenticated :user do
|
authenticated :user do
|
||||||
root :to => 'admin/domains#index', :as => :authenticated_root
|
root to: 'admin/domains#index', as: :authenticated_root
|
||||||
end
|
end
|
||||||
|
|
||||||
root :to => redirect('login')
|
root to: redirect('login')
|
||||||
|
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
# See how all your routes lay out with "rake routes".
|
# See how all your routes lay out with "rake routes".
|
||||||
|
|
|
@ -3,7 +3,11 @@ require 'builder'
|
||||||
class Builder::XmlMarkup
|
class Builder::XmlMarkup
|
||||||
def epp_head
|
def epp_head
|
||||||
self.instruct!
|
self.instruct!
|
||||||
epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') do
|
epp(
|
||||||
|
'xmlns' => 'urn:ietf:params:xml:ns:epp-1.0',
|
||||||
|
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
||||||
|
'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd'
|
||||||
|
) do
|
||||||
yield
|
yield
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,7 +26,7 @@ if Rails.env.test? || Rails.env.development?
|
||||||
task default: :test
|
task default: :test
|
||||||
|
|
||||||
def test_against_server
|
def test_against_server
|
||||||
stdin, stdout, stderr, wait_thr = Open3.popen3('unicorn -E test -p 8989')
|
_stdin, _stdout, _stderr, wait_thr = Open3.popen3('unicorn -E test -p 8989')
|
||||||
pid = wait_thr.pid
|
pid = wait_thr.pid
|
||||||
begin
|
begin
|
||||||
yield
|
yield
|
||||||
|
|
28
lib/tasks/whois.rake
Normal file
28
lib/tasks/whois.rake
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
desc 'Commands for whois'
|
||||||
|
|
||||||
|
desc 'generate whois files'
|
||||||
|
task 'whois:generate' => :environment do
|
||||||
|
Dir.mkdir('./tmp/whois') unless File.exist?('./tmp/whois') # a folder for ze stuff
|
||||||
|
|
||||||
|
alphabet = (('a'..'z').to_a << %w(ö õ ü ä)).flatten!
|
||||||
|
@domains = {}
|
||||||
|
alphabet.each do |letter|
|
||||||
|
domains = Domain.where(['name LIKE ?', "#{letter}%"])
|
||||||
|
@domains[letter] = {}
|
||||||
|
|
||||||
|
domains.each do |domain|
|
||||||
|
@domains[letter][domain.name] = {
|
||||||
|
valid_to: domain.valid_to,
|
||||||
|
status: domain.status,
|
||||||
|
contacts: [
|
||||||
|
{ name: domain.owner_contact.name, email: domain.owner_contact.email },
|
||||||
|
{ registrar: domain.registrar.name, address: domain.registrar.address }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@domains.each do |k, v|
|
||||||
|
File.open("tmp/whois/#{k}_domain.yaml", 'w') { |f| f.write(v.to_yaml) }
|
||||||
|
end
|
||||||
|
end
|
|
@ -33,7 +33,7 @@ describe 'EPP Contact', epp: true do
|
||||||
|
|
||||||
expect(response[:result_code]).to eq('1000')
|
expect(response[:result_code]).to eq('1000')
|
||||||
expect(response[:msg]).to eq('Command completed successfully')
|
expect(response[:msg]).to eq('Command completed successfully')
|
||||||
#expect(response[:clTRID]).to eq('ABC-12345')
|
# expect(response[:clTRID]).to eq('ABC-12345')
|
||||||
expect(Contact.first.created_by_id).to eq 2
|
expect(Contact.first.created_by_id).to eq 2
|
||||||
expect(Contact.first.updated_by_id).to eq nil
|
expect(Contact.first.updated_by_id).to eq nil
|
||||||
|
|
||||||
|
@ -126,7 +126,14 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is succesful' do
|
it 'is succesful' do
|
||||||
Fabricate(:contact, created_by_id: 1, registrar: zone, email: 'not_updated@test.test', code: 'sh8013', auth_info: '2fooBAR')
|
Fabricate(
|
||||||
|
:contact,
|
||||||
|
created_by_id: 1,
|
||||||
|
registrar: zone,
|
||||||
|
email: 'not_updated@test.test',
|
||||||
|
code: 'sh8013',
|
||||||
|
auth_info: '2fooBAR'
|
||||||
|
)
|
||||||
response = epp_request('contacts/update.xml')
|
response = epp_request('contacts/update.xml')
|
||||||
|
|
||||||
expect(response[:msg]).to eq('Command completed successfully')
|
expect(response[:msg]).to eq('Command completed successfully')
|
||||||
|
@ -137,7 +144,14 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns phone and email error' do
|
it 'returns phone and email error' do
|
||||||
Fabricate(:contact, registrar: zone, created_by_id: 1, email: 'not_updated@test.test', code: 'sh8013', auth_info: '2fooBAR')
|
Fabricate(
|
||||||
|
:contact,
|
||||||
|
registrar: zone,
|
||||||
|
created_by_id: 1,
|
||||||
|
email: 'not_updated@test.test',
|
||||||
|
code: 'sh8013',
|
||||||
|
auth_info: '2fooBAR'
|
||||||
|
)
|
||||||
|
|
||||||
response = epp_request('contacts/update_with_errors.xml')
|
response = epp_request('contacts/update_with_errors.xml')
|
||||||
|
|
||||||
|
@ -185,7 +199,15 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails if contact has associated domain' do
|
it 'fails if contact has associated domain' do
|
||||||
Fabricate(:domain, owner_contact: Fabricate(:contact, code: 'dwa1234', created_by_id: zone.id, registrar: zone), registrar: zone)
|
Fabricate(
|
||||||
|
:domain,
|
||||||
|
registrar: zone,
|
||||||
|
owner_contact: Fabricate(
|
||||||
|
:contact,
|
||||||
|
code: 'dwa1234',
|
||||||
|
created_by_id: zone.id,
|
||||||
|
registrar: zone)
|
||||||
|
)
|
||||||
expect(Domain.first.owner_contact.address.present?).to be true
|
expect(Domain.first.owner_contact.address.present?).to be true
|
||||||
response = epp_request('contacts/delete.xml')
|
response = epp_request('contacts/delete.xml')
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ describe 'EPP Domain', epp: true do
|
||||||
it 'creates new pw after successful transfer' do
|
it 'creates new pw after successful transfer' do
|
||||||
pw = domain.auth_info
|
pw = domain.auth_info
|
||||||
xml = domain_transfer_xml(pw: pw)
|
xml = domain_transfer_xml(pw: pw)
|
||||||
response = epp_request(xml, :xml, :elkdata) # transfer domain
|
epp_request(xml, :xml, :elkdata) # transfer domain
|
||||||
response = epp_request(xml, :xml, :elkdata) # attempt second transfer
|
response = epp_request(xml, :xml, :elkdata) # attempt second transfer
|
||||||
expect(response[:result_code]).to eq('2200')
|
expect(response[:result_code]).to eq('2200')
|
||||||
expect(response[:msg]).to eq('Authentication error')
|
expect(response[:msg]).to eq('Authentication error')
|
||||||
|
@ -278,7 +278,7 @@ describe 'EPP Domain', epp: true do
|
||||||
xml = domain_create_xml({
|
xml = domain_create_xml({
|
||||||
ns: [
|
ns: [
|
||||||
{ hostObj: { value: 'invalid1-' } },
|
{ hostObj: { value: 'invalid1-' } },
|
||||||
{ hostObj: { value: '-invalid2' } },
|
{ hostObj: { value: '-invalid2' } }
|
||||||
]
|
]
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -607,12 +607,12 @@ describe 'EPP Domain', epp: true do
|
||||||
expect(inf_data.css('status').first[:s]).to eq('clientHold')
|
expect(inf_data.css('status').first[:s]).to eq('clientHold')
|
||||||
expect(inf_data.css('registrant').text).to eq(d.owner_contact_code)
|
expect(inf_data.css('registrant').text).to eq(d.owner_contact_code)
|
||||||
|
|
||||||
admin_contacts_from_request = inf_data.css('contact[type="admin"]').map { |x| x.text }
|
admin_contacts_from_request = inf_data.css('contact[type="admin"]').map(&:text)
|
||||||
admin_contacts_existing = d.admin_contacts.pluck(:code)
|
admin_contacts_existing = d.admin_contacts.pluck(:code)
|
||||||
|
|
||||||
expect(admin_contacts_from_request).to eq(admin_contacts_existing)
|
expect(admin_contacts_from_request).to eq(admin_contacts_existing)
|
||||||
|
|
||||||
hosts_from_request = inf_data.css('hostObj').map { |x| x.text }
|
hosts_from_request = inf_data.css('hostObj').map(&:text)
|
||||||
hosts_existing = d.nameservers.where(ipv4: nil).pluck(:hostname)
|
hosts_existing = d.nameservers.where(ipv4: nil).pluck(:hostname)
|
||||||
|
|
||||||
expect(hosts_from_request).to eq(hosts_existing)
|
expect(hosts_from_request).to eq(hosts_existing)
|
||||||
|
|
|
@ -76,16 +76,16 @@ describe 'EPP Helper', epp: true do
|
||||||
|
|
||||||
xml = domain_create_xml({
|
xml = domain_create_xml({
|
||||||
name: { value: 'one.ee' },
|
name: { value: 'one.ee' },
|
||||||
period: {value: '345', attrs: { unit: 'd' } },
|
period: { value: '345', attrs: { unit: 'd' } },
|
||||||
ns: [
|
ns: [
|
||||||
{ hostObj: {value: 'ns1.test.net' } },
|
{ hostObj: { value: 'ns1.test.net' } },
|
||||||
{ hostObj: {value: 'ns2.test.net' } }
|
{ hostObj: { value: 'ns2.test.net' } }
|
||||||
],
|
],
|
||||||
registrant: { value: '32fsdaf' },
|
registrant: { value: '32fsdaf' },
|
||||||
_other: [
|
_other: [
|
||||||
{ contact: {value: '2323rafaf', attrs: { type: 'admin' } } },
|
{ contact: { value: '2323rafaf', attrs: { type: 'admin' } } },
|
||||||
{ contact: {value: '3dgxx', attrs: { type: 'tech' } } },
|
{ contact: { value: '3dgxx', attrs: { type: 'tech' } } },
|
||||||
{ contact: {value: '345xxv', attrs: { type: 'tech' } } }
|
{ contact: { value: '345xxv', attrs: { type: 'tech' } } }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -455,7 +455,6 @@ describe 'EPP Helper', epp: true do
|
||||||
generated = Nokogiri::XML(domain_delete_xml).to_s.squish
|
generated = Nokogiri::XML(domain_delete_xml).to_s.squish
|
||||||
expect(generated).to eq(expected)
|
expect(generated).to eq(expected)
|
||||||
|
|
||||||
|
|
||||||
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
<command>
|
<command>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
feature 'Contact management', type: :feature do
|
feature 'Contact management', type: :feature do
|
||||||
#background do
|
# background do
|
||||||
#end
|
# end
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
Fabricate(:user, country: Fabricate(:country, iso: 'EE'), admin: false, username: 'zone')
|
Fabricate(:user, country: Fabricate(:country, iso: 'EE'), admin: false, username: 'zone')
|
||||||
|
|
|
@ -74,7 +74,9 @@ end
|
||||||
|
|
||||||
describe Contact, '#up_id' do
|
describe Contact, '#up_id' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
#Fabricate(:contact, code: 'asd12', created_by: Fabricate(:epp_user), updated_by: Fabricate(:epp_user), registrar: zone)
|
# Fabricate(:contact, code: 'asd12',
|
||||||
|
# created_by: Fabricate(:epp_user),
|
||||||
|
# updated_by: Fabricate(:epp_user), registrar: zone)
|
||||||
@epp_user = Fabricate(:epp_user)
|
@epp_user = Fabricate(:epp_user)
|
||||||
@contact = Fabricate.build(:contact, code: 'asd12', created_by: @epp_user, updated_by: @epp_user)
|
@contact = Fabricate.build(:contact, code: 'asd12', created_by: @epp_user, updated_by: @epp_user)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue