Merge branch 'master' into alpha

This commit is contained in:
Priit Tark 2015-07-01 14:19:22 +03:00
commit b79de3abb7
105 changed files with 1272 additions and 772 deletions

View file

@ -60,6 +60,11 @@ Style/NilComparison:
Exclude:
- 'spec/**/*'
# let's save space in spec
Style/AlignHash:
Exclude:
- 'spec/**/*'
# No need to force reduce to use |a, e| as parameters.
# Configuration parameters: Methods.
Style/SingleLineBlockParams:
@ -90,3 +95,23 @@ Style/NumericLiterals:
# Too often suggest wrong syntax in subarray, this should be fix in rubocop first
Style/WordArray:
Enabled: false
# Ok to use parallel assigment such as: var1, var2 = [], []
Style/ParallelAssignment:
Enabled: false
# not working perfectly or not important enough to care
Style/EmptyLinesAroundBlockBody:
Enabled: false
# The ABC size is a calculated magnitude, so this number can be a Fixnum or a Float.
Metrics/AbcSize:
Max: 35
# Very strange intention requirement, disabled for now
Style/FirstParameterIndentation:
Enabled: false
# old school regex // works fine
Style/RegexpLiteral:
Enabled: false

2
.spring.rb Normal file
View file

@ -0,0 +1,2 @@
Spring.watch 'config/application.yml'
eee

View file

@ -1,4 +1,13 @@
01.07.2015
* Added que init script example at doc/que directory, please setup que accornding to doc/que/README.md
26.06.2015
* Added new relic license key ta application-example.yml, please update application.yml
22.06.2015
* Update zonefile
16.06.2015

78
Gemfile
View file

@ -1,7 +1,14 @@
# Use https only for accessing github
# https://github.com/bundler/bundler/pull/3447
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end if Bundler::VERSION < '2'
source 'https://rubygems.org'
# core
gem 'rails', '4.2.1'
gem 'rails', '4.2.3'
gem 'iso8601', '~> 0.8.2' # for dates and times
gem 'hashie-forbidden_attributes', '~> 0.1.1'
@ -12,7 +19,9 @@ gem 'figaro', '~> 1.1.0'
gem 'pg', '~> 0.18.0'
gem 'ransack', '~> 1.5.1' # for searching
# with polymorphic fix
gem 'paper_trail', github: 'airblade/paper_trail', ref: 'a453811226ec4ea59753ba6b827e390ced2fc140'
gem 'paper_trail',
github: 'airblade/paper_trail',
ref: 'a453811226ec4ea59753ba6b827e390ced2fc140'
gem 'rails-settings-cached', '~> 0.4.1' # for settings
# html-xml
@ -21,7 +30,7 @@ gem 'nokogiri', '~> 1.6.6.2' # For XML parsing
# style
gem 'sass-rails', '~> 5.0.3' # sass style
gem 'bootstrap-sass', '~> 3.3.4.1' # bootstrap style
gem 'bootstrap-sass', '~> 3.3.5.1' # bootstrap style
# js
gem 'uglifier', '~> 2.7.1' # minifies js
@ -41,11 +50,11 @@ gem 'select2-rails', '~> 3.5.9.3' # for autocomplete
gem 'bootstrap-datepicker-rails', '~> 1.3.1.1' # datepicker
# rights
gem 'devise', '~> 3.4.1' # authenitcation
gem 'cancancan', '~> 1.9.2' # autharization
gem 'devise', '~> 3.5.1' # authenitcation
gem 'cancancan', '~> 1.11.0' # autharization
# rest api
gem 'grape', '~> 0.10.1'
gem 'grape', '~> 0.12.0'
gem 'jbuilder', '~> 2.2.6' # json api
# registry specfic
@ -60,10 +69,10 @@ gem 'data_migrate',
ref: '35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81'
# monitors
gem 'newrelic_rpm', '~> 3.9.9.275'
gem 'newrelic_rpm', '~> 3.12.0.288'
# country listing
gem 'countries', '~> 0.10.0'
gem 'countries', '~> 0.11.4'
# cloning activerecord objects
gem 'deep_cloneable', '~> 2.1.1'
@ -77,8 +86,9 @@ gem 'epp-xml', '~> 1.0.3' # EIS EPP XMLs
gem 'uuidtools', '~> 2.1.4' # For unique IDs (used by the epp gem)
# que
gem 'que', '~> 0.10.0'
gem 'que-web', '~> 0.4.0'
gem 'que', '~> 0.10.0'
gem 'que-web', '~> 0.4.0'
gem 'daemons-rails', '~> 1.2.1'
# for importing legacy db
gem 'activerecord-import', '~> 0.7.0' # for inserting dummy data
@ -91,18 +101,21 @@ gem 'jquery-ui-rails', '~> 5.0.3'
group :development do
# dev tools
gem 'spring', '~> 1.3.3'
gem 'spring', '~> 1.3.6'
gem 'spring-commands-rspec', '~> 1.0.4'
gem 'guard', '~> 2.6.1' # run tests automatically
gem 'guard-rspec', '~> 4.3.1'
gem 'guard-rails', '~> 0.7.0' # run EPP server automatically
gem 'rubocop', '~> 0.26.1'
gem 'guard-rubocop', '~> 1.1.0'
gem 'spring-watcher-listen', # otherwise spring polls the filesystem on every 0.2 seconds
github: 'jonleighton/spring-watcher-listen',
ref: '7f6003e14f8f9ca178a5194f210c07f54cfb67ec'
gem 'guard', '~> 2.12.6' # run tests automatically
gem 'guard-rspec', '~> 4.5.2'
gem 'guard-rails', '~> 0.7.1' # run EPP server automatically
gem 'rubocop', '~> 0.32.1'
gem 'guard-rubocop', '~> 1.2.0'
# improved errors
gem 'better_errors', '~> 2.0.0'
gem 'better_errors', '~> 2.1.1' # webconsole replacement
gem 'binding_of_caller', '~> 0.7.2'
gem 'traceroute', '~> 0.4.0' # for finding dead routes and unused actions
gem 'traceroute', '~> 0.5.0' # for finding dead routes and unused actions
# deploy
gem 'mina', '~> 0.3.1' # for fast deployment
@ -110,30 +123,33 @@ end
group :development, :test do
# test stack
gem 'rspec-rails', '~> 3.0.2'
gem 'rspec-rails', '~> 3.3.2'
gem 'capybara', '~> 2.4.1'
gem 'phantomjs-binaries', '~> 1.9.2.4'
gem 'poltergeist', '~> 1.5.1' # We are using PhantomJS instead
gem 'phantomjs', '~> 1.9.7.1'
gem 'fabrication', '~> 2.12.2' # Replacement for fixtures
gem 'shoulda-matchers', '~> 2.6.1', require: false # Additional matchers for RSpec
gem 'poltergeist', '~> 1.6.0' # We are using PhantomJS instead
gem 'phantomjs', '~> 1.9.8.0'
gem 'fabrication', '~> 2.13.2' # Replacement for fixtures
gem 'shoulda-matchers', '~> 2.8.0', require: false # Additional matchers for RSpec
gem 'launchy', '~> 2.4.3' # for opening browser automatically
# helper gems
gem 'database_cleaner', '~> 1.3.0' # For cleaning db in feature and epp tests
gem 'faker', '~> 1.3.0' # Library to generate fake data
gem 'database_cleaner', '~> 1.4.1' # For cleaning db in feature and epp tests
gem 'faker', '~> 1.4.3' # Library to generate fake data
# debug
gem 'pry', '~> 0.10.1'
# code review
gem 'simplecov', '~> 0.9.1', require: false
gem 'rubycritic', '~> 1.1.1'
gem 'simplecov', '~> 0.10.0', require: false
gem 'rubycritic', '~> 1.4.0'
gem 'bullet', '~> 4.14.4' # for finding database optimizations
gem 'bundler-audit', '~> 0.3.1' # for finding future vulnerable gems
gem 'brakeman', '~> 2.6.2', require: false # for security audit'
gem 'bundler-audit',
github: 'rubysec/bundler-audit',
ref: 'f89ef7fae1090bbad825ea76812d56d72b417055' # for finding future vulnerable gems
gem 'brakeman', '~> 3.0.5', require: false # for security audit'
# tmp, otherwise conflics with breakman
gem 'html2haml', github: 'haml/html2haml', ref: '6984f50bdbbd6291535027726a5697f28778ee8d'
# gem 'html2haml', github: 'haml/html2haml', ref: '6984f50bdbbd6291535027726a5697f28778ee8d'
gem 'html2haml', '~> 2.0.0'
gem 'sdoc', '~> 0.4.0' # bundle exec rake doc:rails generates the API under doc/api.
gem 'railroady', '~> 1.3.0' # to generate database diagrams
@ -143,5 +159,5 @@ group :development, :test do
# for travis
gem 'rake'
gem "autodoc"
gem 'autodoc'
end

View file

@ -1,5 +1,5 @@
GIT
remote: git://github.com/airblade/paper_trail.git
remote: https://github.com/airblade/paper_trail.git
revision: a453811226ec4ea59753ba6b827e390ced2fc140
ref: a453811226ec4ea59753ba6b827e390ced2fc140
specs:
@ -9,7 +9,7 @@ GIT
request_store (~> 1.1.0)
GIT
remote: git://github.com/gitlabeu/data_migrate.git
remote: https://github.com/gitlabeu/data_migrate.git
revision: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
ref: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
specs:
@ -17,64 +17,75 @@ GIT
rails (>= 4.1.0)
GIT
remote: git://github.com/haml/html2haml.git
revision: 6984f50bdbbd6291535027726a5697f28778ee8d
ref: 6984f50bdbbd6291535027726a5697f28778ee8d
specs:
html2haml (2.0.0.beta.2)
erubis (~> 2.7.0)
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
GIT
remote: git://github.com/internetee/epp.git
remote: https://github.com/internetee/epp.git
revision: 505c3f2739eb1da918e54111aecfb138a822739d
specs:
epp (1.4.2)
hpricot
libxml-ruby
GIT
remote: https://github.com/jonleighton/spring-watcher-listen.git
revision: 7f6003e14f8f9ca178a5194f210c07f54cfb67ec
ref: 7f6003e14f8f9ca178a5194f210c07f54cfb67ec
specs:
spring-watcher-listen (1.0.0)
listen (~> 2.7)
spring (~> 1.2)
GIT
remote: https://github.com/rubysec/bundler-audit.git
revision: f89ef7fae1090bbad825ea76812d56d72b417055
ref: f89ef7fae1090bbad825ea76812d56d72b417055
specs:
bundler-audit (0.4.0)
bundler (~> 1.2)
thor (~> 0.18)
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.1)
actionpack (= 4.2.1)
actionview (= 4.2.1)
activejob (= 4.2.1)
abstract_type (0.0.7)
actionmailer (4.2.3)
actionpack (= 4.2.3)
actionview (= 4.2.3)
activejob (= 4.2.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.1)
actionview (= 4.2.1)
activesupport (= 4.2.1)
actionpack (4.2.3)
actionview (= 4.2.3)
activesupport (= 4.2.3)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.1)
activesupport (= 4.2.1)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.3)
activesupport (= 4.2.3)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.1)
activesupport (= 4.2.1)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.3)
activesupport (= 4.2.3)
globalid (>= 0.3.0)
activemodel (4.2.1)
activesupport (= 4.2.1)
activemodel (4.2.3)
activesupport (= 4.2.3)
builder (~> 3.1)
activerecord (4.2.1)
activemodel (= 4.2.1)
activesupport (= 4.2.1)
activerecord (4.2.3)
activemodel (= 4.2.3)
activesupport (= 4.2.3)
arel (~> 6.0)
activerecord-import (0.7.0)
activerecord (>= 3.0)
activesupport (4.2.1)
activesupport (4.2.3)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
adamantium (0.2.0)
ice_nine (~> 0.11.0)
memoizable (~> 0.4.0)
addressable (2.3.8)
akami (1.3.1)
gyoku (>= 0.4.0)
@ -87,7 +98,7 @@ GEM
actionpack
activesupport (>= 3.0.0)
rspec
autoprefixer-rails (5.2.0.1)
autoprefixer-rails (5.2.1)
execjs
json
axiom-types (0.1.1)
@ -95,7 +106,7 @@ GEM
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
bcrypt (3.1.10)
better_errors (2.0.0)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
@ -103,28 +114,24 @@ GEM
debug_inspector (>= 0.0.1)
bootstrap-datepicker-rails (1.3.1.1)
railties (>= 3.0)
bootstrap-sass (3.3.4.1)
bootstrap-sass (3.3.5.1)
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.2.19)
brakeman (2.6.3)
sass (>= 3.3.0)
brakeman (3.0.5)
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)
ruby_parser (~> 3.7.0)
sass (~> 3.0)
slim (>= 1.3.6, < 3.0)
terminal-table (~> 1.4)
builder (3.2.2)
bullet (4.14.7)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.9.0)
bundler-audit (0.3.1)
bundler (~> 1.2)
thor (~> 0.18)
cancancan (1.9.2)
cancancan (1.11.0)
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@ -145,18 +152,26 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
countries (0.10.0)
concord (0.1.5)
adamantium (~> 0.2.0)
equalizer (~> 0.0.9)
countries (0.11.4)
currencies (~> 0.4.2)
i18n_data (~> 0.7.0)
crack (0.4.2)
safe_yaml (~> 1.0.0)
currencies (0.4.2)
database_cleaner (1.3.0)
daemons (1.2.3)
daemons-rails (1.2.1)
daemons
multi_json (~> 1.0)
database_cleaner (1.4.1)
debug_inspector (0.0.2)
deep_cloneable (2.1.1)
activerecord (>= 3.1.0, < 5.0.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (3.4.1)
devise (3.5.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
@ -177,11 +192,11 @@ GEM
equalizer (0.0.11)
erubis (2.7.0)
execjs (2.5.2)
fabrication (2.12.2)
faker (1.3.0)
fabrication (2.13.2)
faker (1.4.3)
i18n (~> 0.5)
fastercsv (1.5.5)
ffi (1.9.8)
ffi (1.9.9)
figaro (1.1.1)
thor (~> 0.14)
flay (2.4.0)
@ -193,7 +208,7 @@ GEM
formatador (0.2.5)
globalid (0.3.5)
activesupport (>= 4.1.0)
grape (0.10.1)
grape (0.12.0)
activesupport
builder
hashie (>= 2.1.0)
@ -203,18 +218,24 @@ GEM
rack-accept
rack-mount
virtus (>= 1.0.0)
guard (2.6.1)
guard (2.12.7)
formatador (>= 0.2.4)
listen (~> 2.7)
listen (>= 2.7, <= 4.0)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-rails (0.7.0)
guard (~> 2.0)
guard-rspec (4.3.1)
guard-compat (1.2.1)
guard-rails (0.7.1)
guard (~> 2.11)
guard-compat (~> 1.0)
guard-rspec (4.5.2)
guard (~> 2.1)
rspec (>= 2.14, < 4.0)
guard-rubocop (1.1.0)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
guard-rubocop (1.2.0)
guard (~> 2.0)
rubocop (~> 0.20)
gyoku (1.3.1)
@ -233,11 +254,17 @@ GEM
highline (1.6.21)
hitimes (1.2.2)
hpricot (0.8.6)
html5_validators (1.2.0)
html2haml (2.0.0)
erubis (~> 2.7.0)
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
html5_validators (1.2.1)
httpclient (2.6.0.1)
httpi (2.4.1)
rack
i18n (0.7.0)
i18n_data (0.7.0)
ice_nine (0.11.1)
isikukood (0.1.2)
iso8601 (0.8.6)
@ -260,7 +287,7 @@ GEM
kgio (2.9.3)
launchy (2.4.3)
addressable (~> 2.3)
libv8 (3.16.14.7)
libv8 (3.16.14.8)
libxml-ruby (2.8.0)
listen (2.10.1)
celluloid (~> 0.16.0)
@ -271,6 +298,8 @@ GEM
lumberjack (1.0.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
method_source (0.8.2)
mime-types (2.6.1)
mina (0.3.4)
@ -289,28 +318,33 @@ GEM
railties (>= 3.0)
multi_json (1.11.1)
multi_xml (0.5.5)
newrelic_rpm (3.9.9.275)
nenv (0.2.0)
newrelic_rpm (3.12.0.288)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nori (2.6.0)
notiffany (0.0.6)
nenv (~> 0.1)
shellany (~> 0.0)
nprogress-rails (0.1.6.7)
open4 (1.3.4)
orm_adapter (0.5.0)
parser (2.3.0.pre.2)
parser (2.2.2.5)
ast (>= 1.1, < 3.0)
pdfkit (0.6.2)
pg (0.18.2)
phantomjs (1.9.7.1)
phantomjs (1.9.8.0)
phantomjs-binaries (1.9.2.4)
sys-uname (= 0.9.0)
poltergeist (1.5.1)
poltergeist (1.6.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
polyamorous (1.2.0)
activerecord (>= 3.0)
powerpack (0.0.9)
powerpack (0.1.1)
procto (0.0.2)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
@ -330,16 +364,16 @@ GEM
rack-test (0.6.3)
rack (>= 1.0)
railroady (1.3.0)
rails (4.2.1)
actionmailer (= 4.2.1)
actionpack (= 4.2.1)
actionview (= 4.2.1)
activejob (= 4.2.1)
activemodel (= 4.2.1)
activerecord (= 4.2.1)
activesupport (= 4.2.1)
rails (4.2.3)
actionmailer (= 4.2.3)
actionpack (= 4.2.3)
actionview (= 4.2.3)
activejob (= 4.2.3)
activemodel (= 4.2.3)
activerecord (= 4.2.3)
activesupport (= 4.2.3)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.1)
railties (= 4.2.3)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
@ -351,13 +385,13 @@ GEM
loofah (~> 2.0)
rails-settings-cached (0.4.1)
rails (>= 4.0.0)
railties (4.2.1)
actionpack (= 4.2.1)
activesupport (= 4.2.1)
railties (4.2.3)
actionpack (= 4.2.3)
activesupport (= 4.2.3)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
raindrops (0.13.0)
raindrops (0.14.0)
rake (10.4.2)
ransack (1.5.1)
actionpack (>= 3.0)
@ -369,56 +403,55 @@ GEM
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (4.2.0)
reek (1.3.8)
reek (1.6.5)
parser (~> 2.2.0.pre.7)
rainbow (>= 1.99, < 3.0)
ruby2ruby (>= 2.0.8, < 3.0)
ruby_parser (~> 3.3)
sexp_processor
unparser (~> 0.2.2)
ref (1.0.5)
request_store (1.1.0)
responders (2.1.0)
railties (>= 4.2.0, < 5)
rspec (3.0.0)
rspec-core (~> 3.0.0)
rspec-expectations (~> 3.0.0)
rspec-mocks (~> 3.0.0)
rspec-core (3.0.4)
rspec-support (~> 3.0.0)
rspec-expectations (3.0.4)
rspec (3.3.0)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-core (3.3.1)
rspec-support (~> 3.3.0)
rspec-expectations (3.3.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.0.0)
rspec-mocks (3.0.4)
rspec-support (~> 3.0.0)
rspec-rails (3.0.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.0.0)
rspec-expectations (~> 3.0.0)
rspec-mocks (~> 3.0.0)
rspec-support (~> 3.0.0)
rspec-support (3.0.4)
rubocop (0.26.1)
rspec-support (~> 3.3.0)
rspec-mocks (3.3.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0)
rspec-rails (3.3.2)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
rubocop (0.32.1)
astrolabe (~> 1.3)
parser (>= 2.2.0.pre.4, < 3.0)
powerpack (~> 0.0.6)
parser (>= 2.2.2.5, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-progressbar (1.7.5)
ruby2ruby (2.1.4)
ruby_parser (~> 3.1)
sexp_processor (~> 4.0)
ruby_parser (3.5.0)
ruby_parser (3.7.0)
sexp_processor (~> 4.1)
rubycritic (1.1.1)
rubycritic (1.4.0)
flay (= 2.4.0)
flog (= 4.2.1)
parser (~> 2.1)
reek (= 1.3.8)
ruby2ruby (>= 2.1.1, < 3.0)
parser (>= 2.2.0, < 3.0)
reek (= 1.6.5)
virtus (~> 1.0)
safe_yaml (1.0.4)
sass (3.4.14)
sass (3.4.15)
sass-rails (5.0.3)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
@ -440,35 +473,32 @@ GEM
thor (~> 0.14)
selectize-rails (0.12.1)
sexp_processor (4.6.0)
shoulda-matchers (2.6.2)
shellany (0.0.1)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
simplecov (0.9.2)
simplecov (0.10.0)
docile (~> 1.1.0)
multi_json (~> 1.0)
simplecov-html (~> 0.9.0)
simplecov-html (0.9.0)
json (~> 1.8)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
simpleidn (0.0.5)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slim (2.1.0)
temple (~> 0.6.9)
tilt (>= 1.3.3, < 2.1)
slop (3.6.0)
spring (1.3.6)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.2.0)
rack (~> 1.0)
sprockets-rails (2.3.1)
sprockets-rails (2.3.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sys-uname (0.9.0)
ffi (>= 1.0.0)
temple (0.6.10)
terminal-table (1.4.5)
terminal-table (1.5.2)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
@ -477,7 +507,7 @@ GEM
tilt (1.4.1)
timers (4.0.1)
hitimes
traceroute (0.4.0)
traceroute (0.5.0)
rails (>= 3.0.0)
turbolinks (2.5.3)
coffee-rails
@ -491,6 +521,14 @@ GEM
rack
raindrops (~> 0.7)
uniform_notifier (1.9.0)
unparser (0.2.4)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
concord (~> 0.1.5)
diff-lcs (~> 1.2.5)
equalizer (~> 0.0.9)
parser (~> 2.2.2)
procto (~> 0.0.2)
uuidtools (2.1.5)
virtus (1.0.5)
axiom-types (~> 0.1)
@ -516,36 +554,37 @@ PLATFORMS
DEPENDENCIES
activerecord-import (~> 0.7.0)
autodoc
better_errors (~> 2.0.0)
better_errors (~> 2.1.1)
binding_of_caller (~> 0.7.2)
bootstrap-datepicker-rails (~> 1.3.1.1)
bootstrap-sass (~> 3.3.4.1)
brakeman (~> 2.6.2)
bootstrap-sass (~> 3.3.5.1)
brakeman (~> 3.0.5)
bullet (~> 4.14.4)
bundler-audit (~> 0.3.1)
cancancan (~> 1.9.2)
bundler-audit!
cancancan (~> 1.11.0)
capybara (~> 2.4.1)
coderay (~> 1.1.0)
coffee-rails (~> 4.1.0)
countries (~> 0.10.0)
countries (~> 0.11.4)
daemons-rails (~> 1.2.1)
data_migrate!
database_cleaner (~> 1.3.0)
database_cleaner (~> 1.4.1)
deep_cloneable (~> 2.1.1)
devise (~> 3.4.1)
devise (~> 3.5.1)
digidoc_client (~> 0.2.1)
epp (~> 1.4.2)!
epp-xml (~> 1.0.3)
fabrication (~> 2.12.2)
faker (~> 1.3.0)
fabrication (~> 2.13.2)
faker (~> 1.4.3)
figaro (~> 1.1.0)
grape (~> 0.10.1)
guard (~> 2.6.1)
guard-rails (~> 0.7.0)
guard-rspec (~> 4.3.1)
guard-rubocop (~> 1.1.0)
grape (~> 0.12.0)
guard (~> 2.12.6)
guard-rails (~> 0.7.1)
guard-rspec (~> 4.5.2)
guard-rubocop (~> 1.2.0)
haml-rails (~> 0.9.0)
hashie-forbidden_attributes (~> 0.1.1)
html2haml!
html2haml (~> 2.0.0)
html5_validators (~> 1.2.0)
isikukood
iso8601 (~> 0.8.2)
@ -557,37 +596,38 @@ DEPENDENCIES
launchy (~> 2.4.3)
mina (~> 0.3.1)
money-rails (~> 1.4.1)
newrelic_rpm (~> 3.9.9.275)
newrelic_rpm (~> 3.12.0.288)
nokogiri (~> 1.6.6.2)
nprogress-rails (~> 0.1.6.7)
paper_trail!
pdfkit (~> 0.6.2)
pg (~> 0.18.0)
phantomjs (~> 1.9.7.1)
phantomjs (~> 1.9.8.0)
phantomjs-binaries (~> 1.9.2.4)
poltergeist (~> 1.5.1)
poltergeist (~> 1.6.0)
pry (~> 0.10.1)
que (~> 0.10.0)
que-web (~> 0.4.0)
railroady (~> 1.3.0)
rails (= 4.2.1)
rails (= 4.2.3)
rails-settings-cached (~> 0.4.1)
rake
ransack (~> 1.5.1)
rspec-rails (~> 3.0.2)
rubocop (~> 0.26.1)
rubycritic (~> 1.1.1)
rspec-rails (~> 3.3.2)
rubocop (~> 0.32.1)
rubycritic (~> 1.4.0)
sass-rails (~> 5.0.3)
sdoc (~> 0.4.0)
select2-rails (~> 3.5.9.3)
selectize-rails (~> 0.12.1)
shoulda-matchers (~> 2.6.1)
simplecov (~> 0.9.1)
shoulda-matchers (~> 2.8.0)
simplecov (~> 0.10.0)
simpleidn (~> 0.0.5)
spring (~> 1.3.3)
spring (~> 1.3.6)
spring-commands-rspec (~> 1.0.4)
spring-watcher-listen!
therubyracer (~> 0.12.2)
traceroute (~> 0.4.0)
traceroute (~> 0.5.0)
turbolinks (~> 2.5.3)
uglifier (~> 2.7.1)
unicorn

View file

@ -398,7 +398,7 @@ sudo apt-get install libxext-dev libxrender1 fontconfig
### Deployment
* [Application build and update](/doc/application_build_doc.md)
* [Registry que server](/doc/que/README.md)
### Autotesting

View file

@ -22,6 +22,22 @@ class Admin::BankStatementsController < AdminController
def create
@bank_statement = BankStatement.new(bank_statement_params)
if @bank_statement.save
flash[:notice] = I18n.t('record_created')
redirect_to [:admin, @bank_statement]
else
flash.now[:alert] = I18n.t('failed_to_create_record')
render 'new'
end
end
def import
@bank_statement = BankStatement.new
end
def create_from_import
@bank_statement = BankStatement.new(bank_statement_params)
if @bank_statement.import
flash[:notice] = I18n.t('record_created')
redirect_to [:admin, @bank_statement]
@ -53,6 +69,6 @@ class Admin::BankStatementsController < AdminController
end
def bank_statement_params
params.require(:bank_statement).permit(:th6_file)
params.require(:bank_statement).permit(:th6_file, :bank_code, :iban)
end
end

View file

@ -1,6 +1,25 @@
class Admin::BankTransactionsController < AdminController
load_and_authorize_resource
def new
@bank_statement = BankStatement.find(params[:bank_statement_id])
@bank_transaction = BankTransaction.new(currency: 'EUR')
end
def create
@bank_transaction = BankTransaction.new(
bank_transaction_params.merge(bank_statement_id: params[:bank_statement_id])
)
if @bank_transaction.save
flash[:notice] = I18n.t('record_created')
redirect_to [:admin, @bank_transaction]
else
flash.now[:alert] = I18n.t('failed_to_create_record')
render 'new'
end
end
def update
if @bank_transaction.update(bank_transaction_params)
flash[:notice] = I18n.t('record_updated')
@ -24,6 +43,10 @@ class Admin::BankTransactionsController < AdminController
private
def bank_transaction_params
params.require(:bank_transaction).permit(:description, :sum, :reference_no)
params.require(:bank_transaction).permit(
:description, :sum, :reference_no, :document_no,
:bank_reference, :iban, :buyer_bank_code, :buyer_iban,
:buyer_name, :currency, :paid_at
)
end
end

View file

@ -0,0 +1,22 @@
class Admin::BlockedDomainsController < AdminController
load_and_authorize_resource
def index
bd = BlockedDomain.first_or_initialize
@blocked_domains = bd.names.join("\n")
end
def create
names = params[:blocked_domains].split("\r\n").map(&:strip)
bd = BlockedDomain.first_or_create
if bd.update(names: names)
flash[:notice] = I18n.t('record_updated')
else
flash.now[:alert] = I18n.t('failed_to_update_record')
end
redirect_to :back
end
end

View file

@ -1,6 +1,24 @@
class Admin::InvoicesController < AdminController
load_and_authorize_resource
def new
@deposit = Deposit.new
end
def create
r = Registrar.find_by(id: deposit_params[:registrar_id])
@deposit = Deposit.new(deposit_params.merge(registrar: r))
@invoice = @deposit.issue_prepayment_invoice
if @invoice.persisted?
flash[:notice] = t(:record_created)
redirect_to [:admin, @invoice]
else
flash[:alert] = t(:failed_to_create_record)
render 'new'
end
end
def index
@q = Invoice.includes(:account_activity).search(params[:q])
@q.sorts = 'id desc' if @q.sorts.empty?
@ -20,4 +38,10 @@ class Admin::InvoicesController < AdminController
render :show
end
end
private
def deposit_params
params.require(:deposit).permit(:amount, :description, :registrar_id)
end
end

View file

@ -37,13 +37,45 @@ class Admin::SettingsController < AdminController
params.require(:setting_group).permit(settings_attributes: [:value, :id])
end
def casted_settings
def casted_settings # rubocop:disable Metrics/MethodLength
settings = {}
ints = [
:admin_contacts_min_count,
:admin_contacts_max_count,
:tech_contacts_min_count,
:tech_contacts_max_count,
:ds_algorithm,
:dnskeys_min_count,
:dnskeys_max_count,
:ns_min_count,
:ns_max_count,
:transfer_wait_time,
:invoice_number_min,
:invoice_number_max,
:days_to_keep_overdue_invoices_active,
:days_to_renew_domain_before_expire,
:expire_warning_period,
:redemption_grace_period
]
floats = [:registry_vat_prc]
booleans = [
:ds_data_allowed,
:key_data_allowed,
:client_side_status_editing_enabled,
:registrar_ip_whitelist_enabled,
:api_ip_whitelist_enabled
]
params[:settings].each do |k, v|
settings[k] = v.to_i if Setting[k].class == Fixnum
settings[k] = v.to_f if Setting[k].class == Float
settings[k] = (v == 'true' ? true : false) if [TrueClass, FalseClass].include?(Setting[k].class)
settings[k] = v
settings[k] = v.to_i if ints.include?(k.to_sym)
settings[k] = v.to_f if floats.include?(k.to_sym)
settings[k] = (v == 'true' ? true : false) if booleans.include?(k.to_sym)
end
settings
end
end

View file

@ -1,7 +1,6 @@
class Admin::ZonefilesController < ApplicationController
authorize_resource class: false
# TODO: Refactor this
# rubocop:disable Metrics/MethodLength
def create
if ZonefileSetting.pluck(:origin).include?(params[:origin])

View file

@ -29,7 +29,6 @@ class Epp::DomainsController < EppController
end
end
# rubocop:disable Metrics/CyclomaticComplexity
def update
authorize! :update, @domain, @password
@ -44,7 +43,6 @@ class Epp::DomainsController < EppController
end
end
# rubocop:disable Metrics/CyclomaticComplexity
def delete
authorize! :delete, @domain, @password
@ -66,7 +64,6 @@ class Epp::DomainsController < EppController
handle_errors(@domain)
end
end
# rubocop:enbale Metrics/CyclomaticComplexity
def check
authorize! :check, Epp::Domain
@ -88,8 +85,6 @@ class Epp::DomainsController < EppController
render_epp_response '/epp/domains/renew'
end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/MethodLength
def transfer
authorize! :transfer, @domain, @password
action = params[:parsed_frame].css('transfer').first[:op]
@ -102,8 +97,6 @@ class Epp::DomainsController < EppController
handle_errors(@domain)
end
end
# rubocop: enable Metrics/MethodLength
# rubocop: enable Metrics/CyclomaticComplexity
private

View file

@ -1,7 +1,6 @@
class Epp::KeyrelaysController < EppController
skip_authorization_check # TODO: move authorization under ability
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def keyrelay
# keyrelay temp turned off
@ -30,7 +29,6 @@ class Epp::KeyrelaysController < EppController
exactly_one_of 'expiry > relative', 'expiry > absolute'
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def find_domain

View file

@ -7,17 +7,40 @@ class Epp::SessionsController < EppController
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def login
cert_valid = true
success = true
@api_user = ApiUser.find_by(login_params)
if request.ip != ENV['webclient_ip'] && @api_user
unless @api_user.api_pki_ok?(request.env['HTTP_SSL_CLIENT_CERT'], request.env['HTTP_SSL_CLIENT_S_DN_CN'])
cert_valid = false
@msg = 'Authentication error; server closing connection (certificate is not valid)'
success = false
end
end
if @api_user.try(:active) && cert_valid && ip_white? && connection_limit_ok?
if success && !@api_user
@msg = 'Authentication error; server closing connection (API user not found)'
success = false
end
if success && !@api_user.try(:active)
@msg = 'Authentication error; server closing connection (API user is not active)'
success = false
end
if success && !ip_white?
@msg = 'Authentication error; server closing connection (IP is not whitelisted)'
success = false
end
if success && !connection_limit_ok?
@msg = 'Authentication error; server closing connection (connection limit reached)'
success = false
end
if success
if parsed_frame.css('newPW').first
unless @api_user.update(password: parsed_frame.css('newPW').first.text)
response.headers['X-EPP-Returncode'] = '2200'
@ -33,14 +56,15 @@ class Epp::SessionsController < EppController
render_epp_response('login_fail')
end
end
# rubocop: enable Metrics/MethodLength
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def ip_white?
return true if request.ip == ENV['webclient_ip']
if @api_user
unless @api_user.registrar.api_ip_white?(request.ip)
@msg = t('ip_is_not_whitelisted')
return false
end
return false unless @api_user.registrar.api_ip_white?(request.ip)
end
true
end
@ -51,16 +75,10 @@ class Epp::SessionsController < EppController
'registrar_id = ? AND updated_at >= ?', @api_user.registrar_id, Time.zone.now - 5.minutes
).count
if c >= 4
@msg = t('connection_limit_reached')
return false
end
return false if c >= 4
true
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def logout
@api_user = current_user # cache current_user for logging
epp_session.destroy

View file

@ -272,7 +272,6 @@ class EppController < ApplicationController
end
# rubocop: enable Style/PredicateName
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def write_to_epp_log
# return nil if EPP_LOG_ENABLED
@ -295,7 +294,6 @@ class EppController < ApplicationController
ip: request.ip
})
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def iptables_counter_update

View file

@ -9,7 +9,7 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def update
@domain = Domain.find(params[:id])
unless @domain.registrant_delete_confirmable?(params[:token])
@ -39,5 +39,5 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
end

View file

@ -9,7 +9,7 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def update
@domain = Domain.find(params[:id])
unless @domain.registrant_update_confirmable?(params[:token])
@ -39,5 +39,5 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
end

View file

@ -4,6 +4,7 @@ class Registrant::SessionsController < Devise::SessionsController
def login
end
# rubocop: disable Metrics/AbcSize
def id
if Rails.env.development?
sign_in(RegistrantUser.find_or_create_by_idc_data('test'), event: :authentication)
@ -22,12 +23,14 @@ class Registrant::SessionsController < Devise::SessionsController
redirect_to registrant_login_url
end
end
# rubocop: enable Metrics/AbcSize
def login_mid
@user = User.new
end
def mid # rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/MethodLength
def mid
phone = params[:user][:phone]
endpoint = "#{ENV['sk_digi_doc_service_endpoint']}"
client = Digidoc::Client.new(endpoint)
@ -64,8 +67,9 @@ class Registrant::SessionsController < Devise::SessionsController
render json: { message: t(:no_such_user) }, status: :unauthorized
end
end
# rubocop: enable Metrics/MethodLength
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
def mid_status
@ -104,7 +108,7 @@ class Registrant::SessionsController < Devise::SessionsController
render json: { message: t(:internal_error) }, status: :bad_request
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/MethodLength

View file

@ -14,11 +14,9 @@ class Registrar::SessionsController < Devise::SessionsController
# rubocop:disable Metrics/PerceivedComplexity
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def create
@depp_user = Depp::User.new(params[:depp_user].merge(
pki: !(Rails.env.development? || Rails.env.test?)
)
)
@depp_user = Depp::User.new(params[:depp_user].merge(pki: !(Rails.env.development? || Rails.env.test?)))
if @depp_user.pki && request.env['HTTP_SSL_CLIENT_S_DN_CN'].blank?
@depp_user.errors.add(:base, :webserver_missing_user_name_directive)
@ -64,6 +62,7 @@ class Registrar::SessionsController < Devise::SessionsController
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/PerceivedComplexity
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def id
@user = ApiUser.find_by_idc_data(request.env['SSL_CLIENT_S_DN'])
@ -119,9 +118,9 @@ class Registrar::SessionsController < Devise::SessionsController
render json: { message: t(:no_such_user) }, status: :unauthorized
end
end
# rubocop: enable Metrics/MethodLength
# rubocop:enable Metrics/MethodLength
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
def mid_status
@ -159,7 +158,7 @@ class Registrar::SessionsController < Devise::SessionsController
render json: { message: t(:internal_error) }, status: :bad_request
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/MethodLength

View file

@ -1,6 +1,5 @@
class RegistrarController < ApplicationController
before_action :authenticate_user!, :check_ip
# before_action :check_ip
layout 'registrar/application'
include Registrar::ApplicationHelper

View file

@ -3,6 +3,7 @@ class Ability
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/LineLength
# rubocop: disable Metrics/AbcSize
def initialize(user)
alias_action :show, to: :view
alias_action :show, :create, :update, :destroy, to: :crud
@ -105,6 +106,7 @@ class Ability
def admin
customer_service
can :manage, Setting
can :manage, BlockedDomain
can :manage, ZonefileSetting
can :manage, DomainVersion
can :manage, Pricelist

View file

@ -1,9 +1,9 @@
require 'open3'
# rubocop: disable Metrics/ClassLength
class ApiUser < User
include EppErrors
def epp_code_map # rubocop:disable Metrics/MethodLength
def epp_code_map
{
'2306' => [ # Parameter policy error
[:password, :blank]
@ -77,4 +77,3 @@ class ApiUser < User
end
end
end
# rubocop: enable Metrics/ClassLength

View file

@ -4,7 +4,7 @@ class BankStatement < ActiveRecord::Base
attr_accessor :th6_file
validates :bank_code, :iban, :queried_at, presence: true
validates :bank_code, :iban, presence: true
FULLY_BINDED = 'fully_binded'
PARTIALLY_BINDED = 'partially_binded'
@ -27,6 +27,7 @@ class BankStatement < ActiveRecord::Base
File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) }
end
# rubocop: disable Metrics/AbcSize
def parse_th6_row(row)
return parse_th6_header(row) if row[4, 3].strip == '000'
return if row[4, 3].strip == '999' # skip footer
@ -47,6 +48,7 @@ class BankStatement < ActiveRecord::Base
reference_no: row[280, 35].strip
}
end
# rubocop: enable Metrics/AbcSize
def parse_th6_header(row)
self.bank_code = row[7, 3].strip

View file

@ -0,0 +1,5 @@
class BlockedDomain < ActiveRecord::Base
include Versions
after_initialize -> { self.names = [] if names.nil? }
end

View file

@ -76,6 +76,7 @@ class Certificate < ActiveRecord::Base
@cached_status = REVOKED
end
# rubocop: disable Metrics/AbcSize
def sign!
csr_file = Tempfile.new('client_csr')
csr_file.write(csr)
@ -107,6 +108,7 @@ class Certificate < ActiveRecord::Base
return false
end
end
# rubocop: enable Metrics/AbcSize
def revoke!
crt_file = Tempfile.new('client_crt')

View file

@ -4,7 +4,7 @@ class Deposit
extend ActiveModel::Naming
include DisableHtml5Validation
attr_accessor :amount, :description, :registrar
attr_accessor :amount, :description, :registrar, :registrar_id
validates :amount, :registrar, presence: true

View file

@ -20,7 +20,6 @@ module Depp
class << self
attr_reader :epp_xml, :user
# rubocop: disable Metrics/MethodLength
def new_from_params(params)
new(
id: params[:code],
@ -43,8 +42,8 @@ module Depp
country_code: params[:country_code]
)
end
# rubocop: enable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def find_by_id(id)
data = info_xml(id)
@ -77,6 +76,7 @@ module Depp
statuses: data.css('status').map { |s| [s['s'], s.text] }
)
end
# rubocop:enable Metrics/AbcSize
def user=(user)
@user = user
@ -170,7 +170,8 @@ module Depp
handle_errors(data)
end
# rubocop: disable Metrics/MethodLength
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def update_attributes(params)
self.ident_country_code = params[:ident_country_code]
self.ident_type = params[:ident_type]
@ -214,7 +215,8 @@ module Depp
data = Depp::Contact.user.request(update_xml)
handle_errors(data)
end
# rubocop: enable Metrics/MethodLength
# rubocop:enbale Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
def delete
delete_xml = Contact.epp_xml.delete(

View file

@ -130,7 +130,9 @@ module Depp
ret.with_indifferent_access
end
def construct_params_from_server_data(data) # rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def construct_params_from_server_data(data)
ret = default_params
ret[:name] = data.css('name').text
ret[:registrant] = data.css('registrant').text
@ -176,6 +178,8 @@ module Depp
ret
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def construct_custom_params_hash(domain_params)
custom_params = {}
@ -233,7 +237,7 @@ module Depp
host_attr << { hostAddr: { value: v['ipv4'], attrs: { ip: 'v4' } } } if v['ipv4'].present?
host_attr << { hostAddr: { value: v['ipv6'], attrs: { ip: 'v6' } } } if v['ipv6'].present?
ret << { hostAttr: host_attr }
ret << { hostAttr: host_attr }
end
ret
@ -256,11 +260,11 @@ module Depp
domain_params[:dnskeys_attributes].each do |_k, v|
if v['ds_key_tag'].blank?
kd = create_key_data_hash(v)
ret << {
ret << {
keyData: kd
} if kd
else
ret << {
ret << {
dsData: [
keyTag: { value: v['ds_key_tag'] },
alg: { value: v['ds_alg'] },

View file

@ -8,7 +8,7 @@ module Depp
self.epp_xml = EppXml::Keyrelay.new(cl_trid_prefix: current_user.tag)
end
def keyrelay(params) # rubocop:disable Metrics/MethodLength
def keyrelay(params)
custom_params = {}
if params[:legal_document].present?
type = params[:legal_document].original_filename.split('.').last.downcase

View file

@ -36,6 +36,7 @@ module Depp
Nokogiri::XML(e.response_xml.to_s).remove_namespaces!
end
# rubocop:disable Metrics/AbcSize
def repp_request(path, params = {})
client_cert = File.read(ENV['cert_path'])
client_key = File.read(ENV['key_path'])
@ -51,8 +52,7 @@ module Depp
use_ssl: (uri.scheme == 'https'),
verify_mode: OpenSSL::SSL::VERIFY_NONE,
cert: OpenSSL::X509::Certificate.new(client_cert),
key: OpenSSL::PKey::RSA.new(client_key)
) do |http|
key: OpenSSL::PKey::RSA.new(client_key)) do |http|
http.request(req)
end
@ -67,6 +67,7 @@ module Depp
ret
end
# rubocop:enable Metrics/AbcSize
private

View file

@ -114,7 +114,7 @@ class Dnskey < ActiveRecord::Base
end
def bin_to_hex(s)
s.each_byte.map { |b| sprintf('%02X', b) }.join
s.each_byte.map { |b| format('%02X', b) }.join
end
end
end

View file

@ -207,6 +207,7 @@ class Domain < ActiveRecord::Base
STDOUT << "#{Time.zone.now.utc} - Successfully set delete_candidate to #{d.count} domains\n"
end
# rubocop:disable Rails/FindEach
def destroy_delete_candidates
STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test?
@ -223,6 +224,7 @@ class Domain < ActiveRecord::Base
STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" unless Rails.env.test?
end
# rubocop:enable Rails/FindEach
end
def name=(value)
@ -410,8 +412,8 @@ class Domain < ActiveRecord::Base
res = ''
parts = name.split('.')
parts.each do |x|
res += sprintf('%02X', x.length) # length of label in hex
res += x.each_byte.map { |b| sprintf('%02X', b) }.join # label
res += format('%02X', x.length) # length of label in hex
res += x.each_byte.map { |b| format('%02X', b) }.join # label
end
res += '00'

View file

@ -1,4 +1,3 @@
# rubocop: disable Metrics/ClassLength
class Epp::Contact < Contact
include EppErrors
@ -15,6 +14,7 @@ class Epp::Contact < Contact
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def attrs_from(frame, rem = nil)
f = frame
at = {}.with_indifferent_access
@ -53,6 +53,7 @@ class Epp::Contact < Contact
# rubocop: enable Metrics/MethodLength
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def new(frame, registrar)
return super if frame.blank?
@ -149,4 +150,3 @@ class Epp::Contact < Contact
super(at)
end
end
# rubocop: enable Metrics/ClassLength

View file

@ -62,7 +62,8 @@ class Epp::Domain < Domain
],
'2302' => [ # Object exists
[:name_dirty, :taken, { value: { obj: 'name', val: name_dirty } }],
[:name_dirty, :reserved, { value: { obj: 'name', val: name_dirty } }]
[:name_dirty, :reserved, { value: { obj: 'name', val: name_dirty } }],
[:name_dirty, :blocked, { value: { obj: 'name', val: name_dirty } }]
],
'2304' => [ # Object status prohibits operation
[:base, :domain_status_prohibits_operation]
@ -81,13 +82,14 @@ class Epp::Domain < Domain
def attach_default_contacts
return if registrant.blank?
regt = Registrant.find(registrant.id) # temp for bullet
tech_contacts << regt if tech_domain_contacts.blank?
tech_contacts << regt if tech_domain_contacts.blank?
admin_contacts << regt if admin_domain_contacts.blank? && regt.priv?
end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def attrs_from(frame, current_user, action = nil)
at = {}.with_indifferent_access
@ -130,6 +132,7 @@ class Epp::Domain < Domain
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/MethodLength
# rubocop: enable Metrics/AbcSize
def nameservers_attrs(frame, action)
ns_list = nameservers_from(frame)
@ -358,6 +361,7 @@ class Epp::Domain < Domain
}]
end
# rubocop: disable Metrics/AbcSize
def update(frame, current_user, verify = true)
return super if frame.blank?
at = {}.with_indifferent_access
@ -380,6 +384,7 @@ class Epp::Domain < Domain
self.deliver_emails = true # turn on email delivery for epp
errors.empty? && super(at)
end
# rubocop: enable Metrics/AbcSize
def apply_pending_update!
preclean_pendings
@ -524,6 +529,7 @@ class Epp::Domain < Domain
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def query_transfer(frame, current_user)
return false unless can_be_transferred_to?(current_user.registrar)
@ -533,10 +539,10 @@ class Epp::Domain < Domain
transaction do
begin
dt = domain_transfers.create!(
transfer_requested_at: Time.zone.now,
transfer_to: current_user.registrar,
transfer_from: registrar
)
transfer_requested_at: Time.zone.now,
transfer_to: current_user.registrar,
transfer_from: registrar
)
if dt.pending?
registrar.messages.create!(
@ -565,6 +571,7 @@ class Epp::Domain < Domain
end
end
end
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/MethodLength
def approve_transfer(frame, current_user)
@ -621,13 +628,14 @@ class Epp::Domain < Domain
end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def keyrelay(parsed_frame, requester)
if registrar == requester
errors.add(:base, :domain_already_belongs_to_the_querying_registrar) and return false
end
abs_datetime = parsed_frame.css('absolute').text
abs_datetime = DateTime.parse(abs_datetime) if abs_datetime.present?
abs_datetime = DateTime.zone.parse(abs_datetime) if abs_datetime.present?
transaction do
kr = keyrelays.build(
@ -664,6 +672,7 @@ class Epp::Domain < Domain
true
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
### VALIDATIONS ###

View file

@ -15,11 +15,11 @@ class Invoice < ActiveRecord::Base
validates :invoice_type, :due_date, :currency, :seller_name,
:seller_iban, :buyer_name, :invoice_items, :vat_prc, presence: true
before_save :set_invoice_number
before_create :set_invoice_number
def set_invoice_number
last_no = Invoice.order(number: :desc).where('number IS NOT NULL').limit(1).pluck(:number).first
if last_no
if last_no && last_no >= Setting.invoice_number_min.to_i
self.number = last_no + 1
else
self.number = Setting.invoice_number_min.to_i
@ -40,7 +40,7 @@ class Invoice < ActiveRecord::Base
cr_at = Time.zone.now - Setting.days_to_keep_overdue_invoices_active.days
invoices = Invoice.unbinded.where(
'due_date < ? AND created_at < ? AND cancelled_at IS NULL', Time.zone.now, cr_at
'due_date < ? AND cancelled_at IS NULL', cr_at
)
count = invoices.update_all(cancelled_at: Time.zone.now)

View file

@ -15,7 +15,10 @@ class LegalDocument < ActiveRecord::Base
loop do
rand = SecureRandom.random_number.to_s.last(4)
next if rand.to_i == 0 || rand.length < 4
self.path = "#{ENV['legal_documents_dir']}/#{Time.zone.now.to_formatted_s(:number)}_#{rand}.#{document_type}"
dir = "#{ENV['legal_documents_dir']}/#{Time.zone.now.strftime('%Y/%m/%d')}"
FileUtils.mkdir_p(dir)
self.path = "#{dir}/#{Time.zone.now.to_formatted_s(:number)}_#{rand}.#{document_type}"
break unless File.file?(path)
end

View file

@ -47,8 +47,7 @@ class Nameserver < ActiveRecord::Base
def replace_hostname_ends(domains, old_end, new_end)
domains = domains.where('EXISTS(
select 1 from nameservers ns where ns.domain_id = domains.id AND ns.hostname LIKE ?
)', "%#{old_end}"
)
)', "%#{old_end}")
count, success_count = 0.0, 0.0
domains.each do |d|

View file

@ -64,42 +64,35 @@ class Registrar < ActiveRecord::Base
res.reduce([]) { |o, v| o << { id: v[:id], display_key: "#{v[:name]} (#{v[:reg_no]})" } }
end
def eis
find_by(reg_no: '90010019')
end
def ordered
order(name: :asc)
end
end
def issue_prepayment_invoice(amount, description = nil) # rubocop:disable Metrics/MethodLength
# Currently only EIS can issue invoices
eis = self.class.eis
# rubocop:disable Metrics/MethodLength
def issue_prepayment_invoice(amount, description = nil)
invoices.create(
invoice_type: 'DEB',
due_date: Time.zone.now.to_date + 1.day,
payment_term: 'prepayment',
description: description,
currency: 'EUR',
vat_prc: 0.2,
seller_id: eis.id,
seller_name: eis.name,
seller_reg_no: eis.reg_no,
seller_iban: Setting.eis_iban,
seller_bank: Setting.eis_bank,
seller_swift: Setting.eis_swift,
seller_vat_no: eis.vat_no,
seller_country_code: eis.country_code,
seller_state: eis.state,
seller_street: eis.street,
seller_city: eis.city,
seller_zip: eis.zip,
seller_phone: eis.phone,
seller_url: eis.url,
seller_email: eis.email,
seller_contact_name: Setting.eis_invoice_contact,
vat_prc: Setting.registry_vat_prc,
seller_name: Setting.registry_juridical_name,
seller_reg_no: Setting.registry_reg_no,
seller_iban: Setting.registry_iban,
seller_bank: Setting.registry_bank,
seller_swift: Setting.registry_swift,
seller_vat_no: Setting.registry_vat_no,
seller_country_code: Setting.registry_country_code,
seller_state: Setting.registry_state,
seller_street: Setting.registry_street,
seller_city: Setting.registry_city,
seller_zip: Setting.registry_zip,
seller_phone: Setting.registry_phone,
seller_url: Setting.registry_url,
seller_email: Setting.registry_email,
seller_contact_name: Setting.registry_invoice_contact,
buyer_id: id,
buyer_name: name,
buyer_reg_no: reg_no,
@ -122,6 +115,7 @@ class Registrar < ActiveRecord::Base
]
)
end
# rubocop:enable Metrics/MethodLength
def cash_account
accounts.find_by(account_type: Account::CASH)
@ -153,10 +147,12 @@ class Registrar < ActiveRecord::Base
end
def api_ip_white?(ip)
return true unless Setting.api_ip_whitelist_enabled
white_ips.api.pluck(:ipv4, :ipv6).flatten.include?(ip) || global_ip_white?(ip)
end
def registrar_ip_white?(ip)
return true unless Setting.registrar_ip_whitelist_enabled
white_ips.registrar.pluck(:ipv4, :ipv6).flatten.include?(ip) || global_ip_white?(ip)
end

View file

@ -0,0 +1,4 @@
class BlockedDomainVersion < PaperTrail::Version
self.table_name = :log_blocked_domains
self.sequence_name = :log_blocked_domains_id_seq
end

View file

@ -24,6 +24,8 @@ class WhiteIp < ActiveRecord::Base
class << self
def registrar_ip_white?(ip)
return true unless Setting.registrar_ip_whitelist_enabled
at = WhiteIp.arel_table
WhiteIp.where(
at[:interface].eq(REGISTRAR).or(

View file

@ -30,6 +30,7 @@ class WhoisRecord < ActiveRecord::Base
end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def generate_json
h = HashWithIndifferentAccess.new
return h if domain.blank?
@ -108,10 +109,11 @@ More information at http://internet.ee
EOS
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def contacts_body(admins, techs)
admins ||= []
techs ||= []
techs ||= []
out = ''
out << (admins.size > 1 ? "\nAdministrative contacts" : "\nAdministrative contact")

View file

@ -9,7 +9,7 @@ class DateTimeIso8601Validator < ActiveModel::EachValidator
return true if value.empty?
begin
DateTime.parse(value)
DateTime.zone.parse(value)
rescue => _e
return false
end

View file

@ -1,11 +1,17 @@
class DomainNameValidator < ActiveModel::EachValidator
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def validate_each(record, attribute, value)
if !self.class.validate_format(value)
record.errors[attribute] << (options[:message] || record.errors.generate_message(attribute, :invalid))
elsif !self.class.validate_blocked(value)
record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :blocked)))
elsif !self.class.validate_reservation(value)
record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :reserved)))
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
class << self
def validate_format(value)
@ -31,6 +37,11 @@ class DomainNameValidator < ActiveModel::EachValidator
# rubocop: enable Style/DoubleNegation
end
def validate_blocked(value)
return true unless value
BlockedDomain.where("names @> ?::varchar[]", "{#{value}}").count == 0
end
def validate_reservation(value)
return true unless value
!ReservedDomain.exists?(name: value.mb_chars.downcase.strip)

View file

@ -1,7 +1,9 @@
class ObjectCountValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
min, max = options[:min].call, options[:max].call
return if value.reject(&:marked_for_destruction?).length.between?(min, max)
values = value.reject(&:marked_for_destruction?)
return if values.size.between?(min, max)
association = options[:association] || attribute
record.errors.add(association, :out_of_range, { min: min, max: max })
end

View file

@ -0,0 +1,19 @@
= form_for([:admin, @bank_statement], html: { class: 'form-horizontal' }) do |f|
= render 'shared/full_errors', object: @bank_statement
.row
.col-md-8
.form-group
.col-md-4.control-label
= f.label :bank_code
.col-md-8
= f.text_field(:bank_code, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :iban
.col-md-8
= f.text_field(:iban, class: 'form-control')
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-warning')

View file

@ -0,0 +1,20 @@
- content_for :actions do
= link_to(t(:back_to_bank_statements), admin_bank_statements_path, class: 'btn btn-default')
= render 'shared/title', name: t(:import_th6_bank_statement)
= form_for(@bank_statement, url: { action: :create_from_import }, multipart: true) do |f|
= render 'shared/full_errors', object: @bank_statement
.row
.col-md-8
.form-group
.col-md-4.control-label
= f.label :th6_file
.col-md-8
= f.file_field :th6_file
.col-md-4
%p= t(:bank_statement_desc).html_safe
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary')

View file

@ -1,5 +1,6 @@
- content_for :actions do
= link_to(t(:import), new_admin_bank_statement_path, class: 'btn btn-primary')
= link_to(t(:add), new_admin_bank_statement_path, class: 'btn btn-primary')
= link_to(t(:import), import_admin_bank_statements_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:bank_statements)
.row

View file

@ -1,20 +1,6 @@
- content_for :actions do
= link_to(t(:back_to_bank_statements), admin_bank_statements_path, class: 'btn btn-default')
= render 'shared/title', name: t(:import_th6_bank_statement)
= link_to(t(:back), admin_bank_statements_path, class: 'btn btn-default')
= form_for([:admin, @bank_statement], multipart: true) do |f|
= render 'shared/full_errors', object: @bank_statement
= render 'shared/title', name: t(:create_bank_statement)
.row
.col-md-8
.form-group
.col-md-4.control-label
= f.label :th6_file
.col-md-8
= f.file_field :th6_file
.col-md-4
%p= t(:bank_statement_desc).html_safe
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary')
= render 'form'

View file

@ -1,5 +1,5 @@
- content_for :actions do
= link_to(t(:bind_invoices), bind_invoices_admin_bank_statement_path,
= link_to(t(:bind_invoices), bind_invoices_admin_bank_statement_path,
class: 'btn btn-primary', method: :post)
= link_to(t(:back_to_bank_statements), admin_bank_statements_path, class: 'btn btn-default')
= render 'shared/title', name: t(:bank_statement)
@ -23,17 +23,24 @@
- sc = 'text-danger' if @bank_statement.not_binded?
%dd{class: sc}= t(@bank_statement.status)
%dt= t(:queried_at)
%dd= l(@bank_statement.queried_at)
- if @bank_statement.queried_at
%dt= t(:queried_at)
%dd= l(@bank_statement.queried_at)
%dt= t(:imported_at)
%dt= t(:created_at)
%dd= l(@bank_statement.created_at)
- if @bank_statement.import_file_path
%dt= t(:import_file)
%dd= link_to(t(:download), download_import_file_admin_bank_statement_path(@bank_statement))
%h2.text-center-xs= t(:bank_transactions)
.row
.col-sm-6
%h3.text-center-xs
= t(:bank_transactions)
.col-sm-6.text-right
%h3.text-right.text-center-xs
= link_to(t(:add), new_admin_bank_statement_bank_transaction_path(@bank_statement), class: 'btn btn-primary')
%hr
.row
.col-md-12

View file

@ -0,0 +1,71 @@
= form_for([:admin, @bank_statement, @bank_transaction], html: { class: 'form-horizontal' }) do |f|
= render 'shared/full_errors', object: @bank_transaction
.row
.col-md-8
- if @bank_transaction.persisted?
.form-group
= f.label :status, class: 'col-md-4 control-label'
- c = @bank_transaction.binded? ? 'text-success' : 'text-danger'
.col-md-8.form-control-static{class: c}
= @bank_transaction.binded? ? t(:binded) : t(:not_binded)
.form-group
= f.label :description, class: 'col-md-4 control-label required'
.col-md-8
= f.text_field(:description, class: 'form-control', required: true)
.form-group
= f.label :sum, class: 'col-md-4 control-label required'
.col-md-8
= f.text_field(:sum, class: 'form-control', required: true)
.form-group
= f.label :reference_no, class: 'col-md-4 control-label required'
.col-md-8
= f.text_field(:reference_no, class: 'form-control', required: true)
.form-group
= f.label :document_no, class: 'col-md-4 control-label'
.col-md-8
= f.text_field(:document_no, class: 'form-control')
.form-group
= f.label :bank_reference, class: 'col-md-4 control-label'
.col-md-8
= f.text_field(:bank_reference, class: 'form-control')
.form-group
= f.label :iban, class: 'col-md-4 control-label'
.col-md-8
= f.text_field(:iban, class: 'form-control')
.form-group
= f.label :buyer_bank_code, class: 'col-md-4 control-label'
.col-md-8
= f.text_field(:buyer_bank_code, class: 'form-control')
.form-group
= f.label :buyer_iban, class: 'col-md-4 control-label'
.col-md-8
= f.text_field(:buyer_iban, class: 'form-control')
.form-group
= f.label :buyer_name, class: 'col-md-4 control-label'
.col-md-8
= f.text_field(:buyer_name, class: 'form-control')
.form-group
= f.label :currency, class: 'col-md-4 control-label'
.col-md-8
= f.text_field(:currency, class: 'form-control', readonly: true)
.form-group
= f.label :paid_at, class: 'col-md-4 control-label required'
.col-md-8
= f.text_field(:paid_at, class: 'form-control datepicker', required: true)
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-warning')

View file

@ -2,73 +2,4 @@
= link_to(t(:back), admin_bank_transaction_path(@bank_transaction), class: 'btn btn-default')
= render 'shared/title', name: t(:bank_transaction)
= form_for([:admin, @bank_transaction], html: { class: 'form-horizontal' }) do |f|
= render 'shared/full_errors', object: @bank_transaction
.row
.col-md-8
.form-group
= f.label :status, class: 'col-md-2 control-label'
- c = @bank_transaction.binded? ? 'text-success' : 'text-danger'
.col-md-10.form-control-static{class: c}
= @bank_transaction.binded? ? t(:binded) : t(:not_binded)
.form-group
= f.label :description, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:description, class: 'form-control')
.form-group
= f.label :sum, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:sum, class: 'form-control')
.form-group
= f.label :reference_no, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:reference_no, class: 'form-control')
.form-group
= f.label :document_no, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:document_no, class: 'form-control', disabled: :disabled)
.form-group
= f.label :bank_reference, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:bank_reference, class: 'form-control', disabled: :disabled)
.form-group
= f.label :iban, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:iban, class: 'form-control', disabled: :disabled)
.form-group
= f.label :buyer_bank_code, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:buyer_bank_code, class: 'form-control', disabled: :disabled)
.form-group
= f.label :buyer_iban, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:buyer_iban, class: 'form-control', disabled: :disabled)
.form-group
= f.label :buyer_name, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:buyer_name, class: 'form-control', disabled: :disabled)
.form-group
= f.label :currency, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:currency, class: 'form-control', disabled: :disabled)
.form-group
= f.label :paid_at, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:paid_at, class: 'form-control', disabled: :disabled)
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary')
= render 'form'

View file

@ -0,0 +1,6 @@
- content_for :actions do
= link_to(t(:back), admin_bank_statement_path(@bank_statement), class: 'btn btn-default')
= render 'shared/title', name: t(:create_bank_transaction)
= render 'form'

View file

@ -0,0 +1,10 @@
= render 'shared/title', name: t(:blocked_domains)
= form_tag([:admin, :blocked_domains]) do |f|
.row
.col-md-12
= text_area_tag :blocked_domains, @blocked_domains, class: 'form-control', rows: 30
%hr
.row
.col-md-12.text-right
%button.btn.btn-warning=t(:save)

View file

@ -10,7 +10,7 @@
%dd= l(@domain.registered_at)
%dt= t(:registrar)
%dd= link_to(@domain.registrar, root_path)
%dd= link_to(@domain.registrar, admin_registrar_path(@domain.registrar))
%dt= t(:password)
%dd

View file

@ -1,7 +1,7 @@
.row
.col-sm-12
%h2.text-center-xs= t(:invoices)
%hr
- content_for :actions do
= link_to(t(:add), new_admin_invoice_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:invoices)
.row
.col-md-12
.table-responsive

View file

@ -0,0 +1,33 @@
- content_for :actions do
= link_to(t(:back), admin_invoices_path, class: 'btn btn-default')
= render 'shared/title', name: t(:create_new_invoice)
= form_for([:admin, @deposit], url: admin_invoices_path, method: :post, html: { class: 'form-horizontal' }) do |f|
= render 'shared/full_errors', object: @deposit
.row
.col-md-8
.form-group
.col-md-4.control-label
= f.label :registrar_id, class: 'required'
.col-md-8
= f.select :registrar_id, Registrar.all.map { |r| [r.name, r.id] }, { include_blank: true }, class: 'form-control selectize', required: true
.form-group
.col-md-4.control-label
= f.label :amount, class: 'required'
.col-md-8
.input-group
= f.text_field :amount, class: 'form-control', required: true
.input-group-addon
EUR
.form-group
.col-md-4.control-label
= f.label :description
.col-md-8
= f.text_area :description, class: 'form-control'
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-warning')

View file

@ -5,7 +5,7 @@
.col-sm-6
%h1.text-right.text-center-xs
- if !@invoice.cancelled? && !@invoice.binded?
= link_to(t(:cancel), cancel_admin_invoice_path(@invoice), method: :patch, class: 'btn btn-default')
= link_to(t(:cancel), cancel_admin_invoice_path(@invoice), method: :patch, class: 'btn btn-warning')
= link_to(t(:back), admin_invoices_path, class: 'btn btn-default')
%hr
= render 'shared/full_errors', object: @invoice

View file

@ -38,7 +38,7 @@
.panel.panel-default
.panel-heading.clearfix
= t(:billing)
= t(:billing_settings)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
@ -46,13 +46,37 @@
%th{class: 'col-xs-6'}= t(:setting)
%th{class: 'col-xs-6'}= t(:value)
%tbody
= render 'setting_row', var: :eis_iban
= render 'setting_row', var: :eis_bank
= render 'setting_row', var: :eis_swift
= render 'setting_row', var: :eis_invoice_contact
= render 'setting_row', var: :invoice_number_min
= render 'setting_row', var: :invoice_number_max
= render 'setting_row', var: :days_to_keep_overdue_invoices_active
= render 'setting_row', var: :registry_billing_email
= render 'setting_row', var: :registry_invoice_contact
= render 'setting_row', var: :registry_vat_no
= render 'setting_row', var: :registry_vat_prc
= render 'setting_row', var: :registry_bank
= render 'setting_row', var: :registry_iban
= render 'setting_row', var: :registry_swift
.panel.panel-default
.panel-heading.clearfix
= t(:registry_settings)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-6'}= t(:setting)
%th{class: 'col-xs-6'}= t(:value)
%tbody
= render 'setting_row', var: :registry_juridical_name
= render 'setting_row', var: :registry_reg_no
= render 'setting_row', var: :registry_email
= render 'setting_row', var: :registry_phone
= render 'setting_row', var: :registry_url
= render 'setting_row', var: :registry_street
= render 'setting_row', var: :registry_city
= render 'setting_row', var: :registry_state
= render 'setting_row', var: :registry_zip
= render 'setting_row', var: :registry_country_code
.panel.panel-default
.panel-heading.clearfix
@ -67,6 +91,8 @@
= render 'setting_row', var: :transfer_wait_time
= render 'setting_row', var: :ds_algorithm
= render 'setting_row', var: :client_side_status_editing_enabled
= render 'setting_row', var: :api_ip_whitelist_enabled
= render 'setting_row', var: :registrar_ip_whitelist_enabled
.row
.col-md-12.text-right
%button.btn.btn-primary=t(:save)

View file

@ -1,5 +1,5 @@
<%= t(:you_have_a_new_invoice) %>
<br><br>
<%= t(:sincerely) %>,<br>
<%= Setting.eis_invoice_contact %><br>
<%= Setting.registry_invoice_contact %><br>
<%= @invoice.seller_phone %>

View file

@ -1,5 +1,5 @@
<%= t(:you_have_a_new_invoice) %>
<%= t(:sincerely) %>,
<%= Setting.eis_invoice_contact %>
<%= Setting.registry_invoice_contact %>
<%= @invoice.seller_phone %>

View file

@ -59,9 +59,7 @@
%li.dropdown-header= t(:system)
%li= link_to t(:settings), admin_settings_path
%li= link_to t(:zonefile), admin_zonefile_settings_path
%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(:blocked_domains), admin_blocked_domains_path
-# %li= link_to t(:domains_history), admin_domain_versions_path
%li= link_to t(:epp_logs), admin_epp_logs_path
%li= link_to t(:repp_logs), admin_repp_logs_path

View file

@ -23,12 +23,12 @@
= f.search_field :number_lteq, class: 'form-control', placeholder: t(:maximum_invoice_no), autocomplete: 'off'
.col-md-3
.form-group
= f.label t(:due_date_after)
= f.search_field :due_date_gt, value: params[:q][:due_date_gt], class: 'form-control datepicker', placeholder: t(:due_date_after), autocomplete: 'off'
= f.label t(:due_date_from)
= f.search_field :due_date_gteq, value: params[:q][:due_date_gteq], class: 'form-control datepicker', placeholder: t(:due_date_from), autocomplete: 'off'
.col-md-3
.form-group
= f.label t(:due_date_before)
= f.search_field :due_date_lt, value: params[:q][:due_date_lt], class: 'form-control datepicker', placeholder: t(:due_date_before), autocomplete: 'off'
= f.label t(:due_date_until)
= f.search_field :due_date_lteq, value: params[:q][:due_date_lteq], class: 'form-control datepicker', placeholder: t(:due_date_until), autocomplete: 'off'
.row
.col-md-3
.form-group

View file

@ -1,5 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize

View file

@ -9,6 +9,7 @@ time_zone: 'Tallinn' # more zones by rake time:zones:all
# New Relic app name, keep only current mode, remove other names.
# Example: 'Admin, EPP, REPP' will have name 'Admin, EPP, REPP - production' at New Relic.
new_relic_app_name: 'Admin, EPP, REPP, Registrar, Registrant'
new_relic_license_key: '42d1c2ba4ed17a9cf6297c59d80e563a3dd3c4fa'
# You can use `rake secret` to generate a secure secret key.
# Your secret key is used for verifying the integrity of signed cookies.

View file

@ -21,8 +21,8 @@ module Registry
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = ENV['time_zone'] # NB! It should be defined,
# otherwise ActiveRecord usese other class internally.
config.time_zone = ENV['time_zone'] || 'Tallinn' # NB! It should be defined,
# otherwise ActiveRecord usese other class internally.
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]

7
config/daemons.yml Normal file
View file

@ -0,0 +1,7 @@
dir_mode: script
dir: ../../log
multiple: true
backtrace: true
monitor: true
ontop: false
app_name: 'que'

View file

@ -81,3 +81,8 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
# In off mode, queueing a job will simply insert it into the database -
# the current process will make no effort to run it.
# You should use this if you want to use a dedicated process to work tasks
Que.mode = :off

View file

@ -47,3 +47,8 @@ Rails.application.configure do
Bullet.unused_eager_loading_enable = false
end
end
# In this mode, any jobs you queue will be run in the same thread, synchronously
# (that is, MyJob.enqueue runs the job and won't return until it's completed).
# This makes your application's behavior easier to test
Que.mode = :sync

View file

@ -81,3 +81,8 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
# In off mode, queueing a job will simply insert it into the database -
# the current process will make no effort to run it.
# You should use this if you want to use a dedicated process to work tasks
Que.mode = :off

View file

@ -84,3 +84,8 @@ Rails.application.configure do
# TODO: Change this:
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
end
# In off mode, queueing a job will simply insert it into the database -
# the current process will make no effort to run it.
# You should use this if you want to use a dedicated process to work tasks
Que.mode = :off

View file

@ -57,3 +57,8 @@ Rails.application.configure do
Bullet.add_whitelist type: :n_plus_one_query, class_name: 'Contact', association: :registrar
end
end
# In this mode, any jobs you queue will be run in the same thread, synchronously
# (that is, MyJob.enqueue runs the job and won't return until it's completed).
# This makes your application's behavior easier to test
Que.mode = :sync

View file

@ -11,6 +11,7 @@ class ActionView::Helpers::FormBuilder
content = content_or_options
end
# rubocop:disable Style/MultilineOperationIndentation
if object.class.respond_to?(:validators_on) &&
object.class.validators_on(method).map(&:class).include?(ActiveRecord::Validations::PresenceValidator)
@ -20,6 +21,7 @@ class ActionView::Helpers::FormBuilder
options[:class] = ((options[:class] || "") + ' required').split(' ').uniq.join(' ')
end
end
# rubocop:enable Style/MultilineOperationIndentation
orig_label(method, content, options || {}, &block)
end

View file

@ -24,16 +24,33 @@ if con.present? && con.table_exists?('settings')
Setting.save_default(:client_side_status_editing_enabled, false)
Setting.save_default(:eis_iban, 'EE557700771000598731')
Setting.save_default(:eis_bank, 'LHV Pank')
Setting.save_default(:eis_swift, 'LHVBEE22')
Setting.save_default(:eis_invoice_contact, 'Martti Õigus')
Setting.save_default(:invoice_number_min, '131050')
Setting.save_default(:invoice_number_max, '149999')
Setting.save_default(:invoice_number_min, 131050)
Setting.save_default(:invoice_number_max, 149999)
Setting.save_default(:days_to_keep_overdue_invoices_active, 30)
Setting.save_default(:days_to_renew_domain_before_expire, 90)
Setting.save_default(:expire_warning_period, 15)
Setting.save_default(:redemption_grace_period, 30)
Setting.save_default(:registrar_ip_whitelist_enabled, true)
Setting.save_default(:api_ip_whitelist_enabled, true)
Setting.save_default(:registry_juridical_name, 'Eesti Interneti SA')
Setting.save_default(:registry_reg_no, '90010019')
Setting.save_default(:registry_email, 'info@internet.ee')
Setting.save_default(:registry_billing_email, 'info@internet.ee')
Setting.save_default(:registry_phone, '+372 727 1000')
Setting.save_default(:registry_country_code, 'EE')
Setting.save_default(:registry_state, 'Harjumaa')
Setting.save_default(:registry_street, 'Paldiski mnt 80')
Setting.save_default(:registry_city, 'Tallinn')
Setting.save_default(:registry_zip, '10617')
Setting.save_default(:registry_vat_no, 'EE101286464')
Setting.save_default(:registry_url, 'www.internet.ee')
Setting.save_default(:registry_vat_prc, 0.2)
Setting.save_default(:registry_iban, 'EE557700771000598731')
Setting.save_default(:registry_bank, 'LHV Pank')
Setting.save_default(:registry_swift, 'LHVBEE22')
Setting.save_default(:registry_invoice_contact, 'Martti Õigus')
end
# dev only setting

View file

@ -1,7 +1,6 @@
# encoding : utf-8
MoneyRails.configure do |config|
# To set the default currency
#
config.default_currency = :eur

View file

@ -1,4 +0,0 @@
if !Rails.env.test? && ENV['new_relic_app_name'].present?
require 'newrelic'
NewRelic::Agent.config[:app_name] = "#{ENV['new_relic_app_name']} - #{Rails.env}"
end

View file

@ -1 +0,0 @@
Que.mode = :off

View file

@ -62,7 +62,8 @@ en:
key_data_not_allowed: 'keyData object is not allowed'
name_dirty:
invalid: 'Domain name is invalid'
reserved: 'Domain name is reserved or restricted'
reserved: 'Domain name is reserved'
blocked: 'Domain name is blocked'
taken: 'Domain name already exists'
puny_label:
too_long: 'Domain name is too long (maximum is 63 characters)'
@ -753,8 +754,8 @@ en:
cannot_bind_cancelled_invoice: 'Cannot bind cancelled invoice'
minimum_invoice_no: 'Miminum invoice no'
maximum_invoice_no: 'Maximum invoice no'
due_date_after: 'Due date after'
due_date_before: 'Due date before'
due_date_from: 'Due date from'
due_date_until: 'Due date until'
minimum_total: 'Minimum total'
maximum_total: 'Maximum total'
hostname_end: 'Hostname end'
@ -807,10 +808,8 @@ en:
domain_delete_confirmed_body: 'You have successfully submitted delete confirmation. You will receive registry final confirmation to email.'
domain_delete_rejected_title: 'Domain deletion has been rejected successfully'
domain_delete_rejected_body: 'You have rejected domain deletion.'
ip_is_not_whitelisted: 'IP is not whitelisted'
no_permission: 'No permission'
access_denied: 'Access denied'
connection_limit_reached: 'Connection limit reached'
common_name: 'Common name'
md5: 'Md5'
interface: 'Interface'
@ -831,3 +830,27 @@ en:
domain_expiring: 'Domain expiring'
domain_validation_rules: 'Domain validation rules'
bank_statement_desc: 'Import file row will match only when matching following attributes: <b><br>ref number<br>payment amount<br>invoice number (the very first number in comment field)</b>.'
create_bank_statement: 'Create bank statement'
create_bank_transaction: 'Create bank transaction'
create_new_invoice: 'Create new invoice'
ip_is_not_whitelisted: 'IP is not whitelisted'
billing_settings: 'Billing settings'
registry_settings: 'Registry settings'
registry_billing_email: 'Billing e-mail'
registry_invoice_contact: 'Invoice contact'
registry_vat_no: 'VAT no.'
registry_vat_prc: 'VAT prc.'
registry_bank: 'Bank'
registry_iban: 'IBAN'
registry_swift: 'SWIFT'
registry_juridical_name: 'Juridical name'
registry_reg_no: 'Reg no.'
registry_email: 'E-mail'
registry_phone: 'Phone'
registry_url: 'URL'
registry_street: 'Street'
registry_city: 'City'
registry_state: 'State / Province'
registry_zip: 'Postcode'
registry_country_code: 'Country'
blocked_domains: 'Blocked domains'

View file

@ -15,7 +15,7 @@ common: &default_settings
# You must specify the license key associated with your New Relic
# account. This key binds your Agent's data to your account in the
# New Relic service.
license_key: '42d1c2ba4ed17a9cf6297c59d80e563a3dd3c4fa'
license_key: <%= ENV['new_relic_license_key'] || '42d1c2ba4ed17a9cf6297c59d80e563a3dd3c4fa' %>
# Agent Enabled (Ruby/Rails Only)
# Use this setting to force the agent to run or not run.
@ -49,7 +49,7 @@ common: &default_settings
# See https://newrelic.com/docs/site/renaming-applications for more details
# on renaming your New Relic applications.
#
app_name: Registry
app_name: <%= "#{ENV['new_relic_app_name']} - #{Rails.env}" %>
# When "true", the agent collects performance data about your
# application and reports this data to the New Relic service at
@ -192,7 +192,6 @@ development:
<<: *default_settings
# Turn on communication to New Relic service in development mode
monitor_mode: false
app_name: Registry (Development)
# Rails Only - when running in Developer Mode, the New Relic Agent will
# present performance information on the last 100 transactions you have
@ -213,7 +212,6 @@ test:
alpha:
<<: *default_settings
monitor_mode: true
app_name: Registry (Alpha)
# Many applications have a staging environment which behaves
# identically to production. Support for that environment is provided
@ -221,7 +219,6 @@ alpha:
staging:
<<: *default_settings
monitor_mode: true
app_name: Registry (Staging)
# Turn on the agent in production for 24x7 monitoring. NewRelic
# testing shows an average performance impact of < 5 ms per

View file

@ -161,6 +161,12 @@ Rails.application.routes.draw do
resources :pricelists
resources :bank_statements do
resources :bank_transactions
collection do
get 'import'
post 'create_from_import'
end
post 'bind_invoices', on: :member
get 'download_import_file', on: :member
end
@ -183,6 +189,8 @@ Rails.application.routes.draw do
resources :settings
resources :blocked_domains
resources :registrars do
resources :api_users
resources :white_ips

1
config/spring.rb Normal file
View file

@ -0,0 +1 @@
Spring.watch 'config/application.yml'

View file

@ -0,0 +1,25 @@
class CreateBlockedDomains < ActiveRecord::Migration
def change
create_table :blocked_domains do |t|
t.string :names, array: true
t.timestamps
t.string "creator_str"
t.string "updator_str"
end
create_table "log_blocked_domains", 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"
end
add_index "log_blocked_domains", ["item_type", "item_id"], name: "index_log_blocked_domains_on_item_type_and_item_id", using: :btree
add_index "log_blocked_domains", ["whodunnit"], name: "index_log_blocked_domains_on_whodunnit", using: :btree
end
end

View file

@ -119,17 +119,17 @@ ZonefileSetting.where({
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!
# 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

@ -25,167 +25,6 @@ COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
--
-- Name: generate_zonefile(character varying); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
LANGUAGE plpgsql
AS $_$
DECLARE
zone_header text := concat('$ORIGIN ', i_origin, '.');
serial_num varchar;
include_filter varchar := '';
exclude_filter varchar := '';
tmp_var text;
ret text;
BEGIN
-- define filters
include_filter = '%' || i_origin;
-- for %.%.%
IF i_origin ~ '\.' THEN
exclude_filter := '';
-- for %.%
ELSE
exclude_filter := '%.%.' || i_origin;
END IF;
SELECT ROUND(extract(epoch from now() at time zone 'utc')) INTO serial_num;
-- zonefile header
SELECT concat(
format('%-10s', '$ORIGIN .'), chr(10),
format('%-10s', '$TTL'), zf.ttl, chr(10), chr(10),
format('%-10s', i_origin || '.'), 'IN SOA ', zf.master_nameserver, '. ', zf.email, '. (', chr(10),
format('%-17s', ''), format('%-12s', serial_num), '; serial number', chr(10),
format('%-17s', ''), format('%-12s', zf.refresh), '; refresh, seconds', chr(10),
format('%-17s', ''), format('%-12s', zf.retry), '; retry, seconds', chr(10),
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;
ret = concat(tmp_var, chr(10), chr(10));
-- ns records
SELECT array_to_string(
array(
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
FROM domains d
JOIN nameservers ns ON ns.domain_id = d.id
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
ORDER BY d.name
),
chr(10)
) INTO tmp_var;
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10), chr(10));
-- a glue records for origin nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN A ', ns.ipv4)
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name = i_origin
AND ns.hostname LIKE '%.' || d.name
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
), chr(10)
) INTO tmp_var;
ret := concat(ret, '; Zone A Records', chr(10), tmp_var);
-- a glue records for other nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN A ', ns.ipv4)
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name 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 EXISTS ( -- filter out glue records that already appeared in origin glue recrods
SELECT 1 FROM nameservers nsi
JOIN domains di ON nsi.domain_id = di.id
WHERE di.name = i_origin
AND nsi.hostname = ns.hostname
)
), chr(10)
) INTO tmp_var;
-- TODO This is a possible subtitition to the previous query, stress testing is needed to see which is faster
-- SELECT ns.*
-- FROM nameservers ns
-- JOIN domains d ON d.id = ns.domain_id
-- WHERE d.name LIKE '%ee' AND d.name NOT LIKE '%pri.ee'
-- AND ns.hostname LIKE '%.' || d.name
-- AND d.name <> 'ee'
-- AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
-- AND ns.hostname NOT IN (
-- SELECT ns.hostname FROM domains d JOIN nameservers ns ON d.id = ns.domain_id WHERE d.name = 'ee'
-- )
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10));
-- aaaa glue records for origin nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN AAAA ', ns.ipv6)
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name = i_origin
AND ns.hostname LIKE '%.' || d.name
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
), chr(10)
) INTO tmp_var;
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var);
-- aaaa glue records for other nameservers
SELECT array_to_string(
array(
SELECT concat(ns.hostname, '. IN AAAA ', ns.ipv6)
FROM nameservers ns
JOIN domains d ON d.id = ns.domain_id
WHERE d.name 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 EXISTS ( -- filter out glue records that already appeared in origin glue recrods
SELECT 1 FROM nameservers nsi
JOIN domains di ON nsi.domain_id = di.id
WHERE di.name = i_origin
AND nsi.hostname = ns.hostname
)
), chr(10)
) INTO tmp_var;
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10));
-- ds records
SELECT array_to_string(
array(
SELECT concat(
d.name_puny, '. IN DS ', dk.ds_key_tag, ' ',
dk.ds_alg, ' ', dk.ds_digest_type, ' ( ', dk.ds_digest, ' )'
)
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
),
chr(10)
) INTO tmp_var;
ret := concat(ret, '; Zone DS Records', chr(10), tmp_var, chr(10));
RETURN ret;
END;
$_$;
SET default_tablespace = '';
SET default_with_oids = false;
@ -198,7 +37,7 @@ CREATE TABLE account_activities (
id integer NOT NULL,
account_id integer,
invoice_id integer,
sum numeric(10,2),
sum numeric(8,2),
currency character varying,
bank_transaction_id integer,
created_at timestamp without time zone,
@ -236,7 +75,7 @@ CREATE TABLE accounts (
id integer NOT NULL,
registrar_id integer,
account_type character varying,
balance numeric(10,2) DEFAULT 0 NOT NULL,
balance numeric(8,2) DEFAULT 0.0 NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
currency character varying,
@ -394,7 +233,7 @@ CREATE TABLE bank_transactions (
buyer_name character varying,
document_no character varying,
description character varying,
sum numeric(10,2),
sum numeric(8,2),
reference_no character varying,
paid_at timestamp without time zone,
created_at timestamp without time zone,
@ -435,7 +274,7 @@ CREATE TABLE banklink_transactions (
vk_rec_id character varying,
vk_stamp character varying,
vk_t_no character varying,
vk_amount numeric(10,2),
vk_amount numeric(8,2),
vk_curr character varying,
vk_rec_acc character varying,
vk_rec_name character varying,
@ -639,6 +478,15 @@ CREATE SEQUENCE countries_id_seq
ALTER SEQUENCE countries_id_seq OWNED BY countries.id;
--
-- Name: data_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE data_migrations (
version character varying NOT NULL
);
--
-- Name: delegation_signers; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
@ -951,7 +799,7 @@ CREATE TABLE invoice_items (
description character varying NOT NULL,
unit character varying,
amount integer,
price numeric(10,2),
price numeric(8,2),
created_at timestamp without time zone,
updated_at timestamp without time zone,
creator_str character varying,
@ -992,7 +840,7 @@ CREATE TABLE invoices (
currency character varying NOT NULL,
description character varying,
reference_no character varying,
vat_prc numeric(10,2) NOT NULL,
vat_prc numeric(8,2) NOT NULL,
paid_at timestamp without time zone,
seller_id integer,
seller_name character varying NOT NULL,
@ -1025,7 +873,7 @@ CREATE TABLE invoices (
updator_str character varying,
number integer,
cancelled_at timestamp without time zone,
sum_cache numeric(10,2)
sum_cache numeric(8,2)
);
@ -2287,7 +2135,7 @@ CREATE TABLE pricelists (
id integer NOT NULL,
"desc" character varying,
category character varying,
price_cents numeric(8,2) DEFAULT 0 NOT NULL,
price_cents numeric(8,2) DEFAULT 0.0 NOT NULL,
price_currency character varying DEFAULT 'EUR'::character varying NOT NULL,
valid_from timestamp without time zone,
valid_to timestamp without time zone,
@ -2325,8 +2173,8 @@ ALTER SEQUENCE pricelists_id_seq OWNED BY pricelists.id;
CREATE TABLE que_jobs (
priority smallint DEFAULT 100 NOT NULL,
run_at timestamp with time zone DEFAULT now() NOT NULL,
job_id bigint NOT NULL,
run_at timestamp without time zone DEFAULT '2015-06-29 12:38:58.258132'::timestamp without time zone NOT NULL,
job_id bigint DEFAULT 0 NOT NULL,
job_class text NOT NULL,
args json DEFAULT '[]'::json NOT NULL,
error_count integer DEFAULT 0 NOT NULL,
@ -2335,32 +2183,6 @@ CREATE TABLE que_jobs (
);
--
-- Name: TABLE que_jobs; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON TABLE que_jobs IS '3';
--
-- Name: que_jobs_job_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE que_jobs_job_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: que_jobs_job_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE que_jobs_job_id_seq OWNED BY que_jobs.job_id;
--
-- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
@ -2551,7 +2373,7 @@ CREATE TABLE users (
crt text,
type character varying,
registrant_ident character varying,
encrypted_password character varying DEFAULT ''::character varying,
encrypted_password character varying DEFAULT ''::character varying NOT NULL,
remember_created_at timestamp without time zone,
failed_attempts integer DEFAULT 0 NOT NULL,
locked_at timestamp without time zone
@ -3102,13 +2924,6 @@ ALTER TABLE ONLY people ALTER COLUMN id SET DEFAULT nextval('people_id_seq'::reg
ALTER TABLE ONLY pricelists ALTER COLUMN id SET DEFAULT nextval('pricelists_id_seq'::regclass);
--
-- Name: job_id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY que_jobs ALTER COLUMN job_id SET DEFAULT nextval('que_jobs_job_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
@ -3612,14 +3427,6 @@ ALTER TABLE ONLY pricelists
ADD CONSTRAINT pricelists_pkey PRIMARY KEY (id);
--
-- Name: que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY que_jobs
ADD CONSTRAINT que_jobs_pkey PRIMARY KEY (queue, priority, run_at, job_id);
--
-- Name: registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@ -4378,6 +4185,13 @@ CREATE INDEX index_whois_records_on_domain_id ON whois_records USING btree (doma
CREATE INDEX index_whois_records_on_registrar_id ON whois_records USING btree (registrar_id);
--
-- Name: unique_data_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX unique_data_migrations ON data_migrations USING btree (version);
--
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@ -4593,8 +4407,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150227092508');
INSERT INTO schema_migrations (version) VALUES ('20150227113121');
INSERT INTO schema_migrations (version) VALUES ('20150302130224');
INSERT INTO schema_migrations (version) VALUES ('20150302161712');
INSERT INTO schema_migrations (version) VALUES ('20150303130729');
@ -4653,8 +4465,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150417082723');
INSERT INTO schema_migrations (version) VALUES ('20150421134820');
INSERT INTO schema_migrations (version) VALUES ('20150422090645');
INSERT INTO schema_migrations (version) VALUES ('20150422092514');
INSERT INTO schema_migrations (version) VALUES ('20150422132631');
@ -4699,8 +4509,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150519115050');
INSERT INTO schema_migrations (version) VALUES ('20150519140853');
INSERT INTO schema_migrations (version) VALUES ('20150519142542');
INSERT INTO schema_migrations (version) VALUES ('20150519144118');
INSERT INTO schema_migrations (version) VALUES ('20150520163237');
@ -4709,12 +4517,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150520164507');
INSERT INTO schema_migrations (version) VALUES ('20150521120145');
INSERT INTO schema_migrations (version) VALUES ('20150522164020');
INSERT INTO schema_migrations (version) VALUES ('20150525075550');
INSERT INTO schema_migrations (version) VALUES ('20150603141054');
INSERT INTO schema_migrations (version) VALUES ('20150603141549');
INSERT INTO schema_migrations (version) VALUES ('20150603211318');

View file

@ -13213,53 +13213,3 @@ RESPONSE:
</response>
</epp>
```
### EPP Session when connected with valid user fails if new password is not valid
REQUEST:
```xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<login>
<clID>gitlab</clID>
<pw>ghyt9e4fu</pw>
<newPW/>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd</objURI>
<objURI>https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
<svcExtension>
<extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
<extURI>https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd</extURI>
</svcExtension>
</svcs>
</login>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
```
RESPONSE:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<epp schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="2306">
<msg lang="en">Password is missing [password]</msg>
</result>
<trID>
<clTRID>ABC-12345</clTRID>
<svTRID>ccReg-0674363838</svTRID>
</trID>
</response>
</epp>
```

46
doc/que/README.md Normal file
View file

@ -0,0 +1,46 @@
Registry que server
===================
Que server responsibilites:
* handle write type of communication between Registrant and Registry
* handle future jobs for Registry
* handle heavy load jobs for Registry
Installation
------------
Que can deploy either separaetly or along to Registry server depends on real load situation.
In both serarious que requires working Registry deployment and full access to Registry databases.
Installation at deployed server:
cd /home/registry/registry/current
sudo cp doc/que/que-init-example /etc/init.d/que # and edit it
sudo chmod +x /etc/init.d/que
sudo /etc/init.d/que # for help and other commands
sudo /etc/init.d/que start # for manual start
sudo update-rc.d que defaults # for start in server boot
# Debugging
You can run que manually as well:
cd /home/registry/registry/current
For all manual que tasks:
RAILS_ENV=production bundle exec rake -T que # for all que tasks for manual control
rake que:clear # Clear Que's job table
rake que:drop # Drop Que's job table
rake que:migrate # Migrate Que's job table to the most recent version (creating it if it doesn't exist)
rake que:work # Process Que's jobs using a worker pool
For all que daemon tasks what inist script uses
RAILS_ENV=production bundle exec rake -T daemon # for all que daemon tasks what init script uses
rake daemon:que # Start que script
rake daemon:que:restart # Restart que daemon
rake daemon:que:start # Start que daemon
rake daemon:que:status # Status que daemon
rake daemon:que:stop # Stop que daemon

51
doc/que/que-init-example Normal file
View file

@ -0,0 +1,51 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: Registry que server
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enable Registry que server
### END INIT INFO
set -u
set -e
#
# Change these to match your server:
#
# Make sure that all paths are correct.
#
APP_HOME="/home/registry/registry"
APP_ROOT="$APP_HOME/current"
QUE_USER=registry # or use some other unprivileged system user
RAILS_ENV=production
RUBY_BUNDLE_PATH=/home/$QUE_USER/.rbenv/shims/bundle
QUE_INSTANCES=1 # or as many really needed based real load
cd $APP_ROOT || exit 1
case ${1-help} in
status)
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec rake daemon:que:status
;;
start)
echo "$1 que monitor and server"
for i in `seq 1 $QUE_INSTANCES`; do
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec rake daemon:que:start
echo '.'
done
;;
stop)
echo "$1 que monitor and server"
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec rake daemon:que:stop
;;
restart)
echo "$1 que monitor and server"
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec rake daemon:que:restart
;;
*)
echo >&2 "Usage: $0 <status|start|stop|restart>"
exit 1
;;
esac

5
lib/daemons/daemons Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
results = []
Dir[File.dirname(__FILE__) + "/*_ctl"].each {|f| results << `ruby #{f} #{ARGV.first}`}
results.delete_if { |result| result.nil? || result.empty? }
puts results.join unless results.empty?

17
lib/daemons/que.rb Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env ruby
ENV["RAILS_ENV"] ||= "production"
root = File.expand_path(File.dirname(__FILE__))
root = File.dirname(root) until File.exists?(File.join(root, 'config'))
Dir.chdir(root)
require File.join(root, "config", "environment")
$running = true
Signal.trap("TERM") do
$running = false
end
while($running) do
end

6
lib/daemons/que_ctl Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'daemons/rails/config'
config = Daemons::Rails::Config.for_controller(File.expand_path(__FILE__))
Daemons::Rails.run config[:script], config.to_hash

View file

@ -1,9 +1,9 @@
class DeviseCustomFailure < Devise::FailureApp
def redirect_url
return registrant_login_url if request.original_fullpath.to_s.match(/^\/registrant/)
return registrar_login_url if request.original_fullpath.to_s.match(/^\/registrar/)
return registrant_login_url if request.original_fullpath.to_s.match(%r{^\/registrant})
return registrar_login_url if request.original_fullpath.to_s.match(%r{^\/registrar})
return '/admin' if request.original_fullpath.to_s.match(%r{^\/admin\/que})
return admin_login_url if request.original_fullpath.to_s.match(/^\/admin/)
return admin_login_url if request.original_fullpath.to_s.match(%r{^\/admin})
root_url
end

View file

@ -1,4 +1,5 @@
# rubocop: disable Style/SymbolProc
# rubocop: disable Performance/Detect
namespace :import do
# README
#
@ -713,4 +714,5 @@ namespace :import do
puts "-----> Imported EIS domains in #{(Time.zone.now.to_f - start).round(2)} seconds"
end
end
# rubocop: enable Performance/Detect
# rubocop: enable Style/SymbolProc

View file

@ -151,7 +151,7 @@ describe 'EPP Contact', epp: true do
id.text.length.should == 15
# 5 seconds for what-ever weird lag reasons might happen
cr_date.text.to_time.should be_within(5).of(Time.zone.now)
cr_date.text.in_time_zone.utc.should be_within(5).of(Time.zone.now)
end
it 'should add registrar prefix for code when missing' do
@ -321,7 +321,7 @@ describe 'EPP Contact', epp: true do
response[:msg].should == 'Command completed successfully'
@contact.reload
@contact.name.should == 'John Doe Edited'
@contact.name.should == 'John Doe Edited'
@contact.email.should == 'edited@example.example'
end
@ -339,7 +339,7 @@ describe 'EPP Contact', epp: true do
response[:msg].should == 'Command completed successfully'
@contact.reload
@contact.name.should == 'John Doe Edited'
@contact.name.should == 'John Doe Edited'
end
it 'should update other contact with correct password' do
@ -365,7 +365,7 @@ describe 'EPP Contact', epp: true do
response[:msg].should == 'Authorization error'
@contact.reload
@contact.name.should == 'John Doe Edited'
@contact.name.should == 'John Doe Edited'
end
end

View file

@ -16,6 +16,7 @@ describe 'EPP Domain', epp: true do
Fabricate(:contact, code: 'FIXED:SH801333')
Fabricate(:contact, code: 'FIXED:JURIDICAL_1234', ident_type: 'bic')
Fabricate(:reserved_domain)
Fabricate(:blocked_domain)
@uniq_no = proc { @i ||= 0; @i += 1 }
end
@ -89,8 +90,8 @@ describe 'EPP Domain', epp: true do
cre_data = response[:parsed].css('creData')
cre_data.css('name').text.should == dn
cre_data.css('crDate').text.should == d.created_at.to_time.utc.iso8601
cre_data.css('exDate').text.should == d.valid_to.to_time.utc.iso8601
cre_data.css('crDate').text.should == d.created_at.in_time_zone.utc.utc.iso8601
cre_data.css('exDate').text.should == d.valid_to.in_time_zone.utc.utc.iso8601
response[:clTRID].should == 'ABC-12345'
@ -203,7 +204,16 @@ describe 'EPP Domain', epp: true do
response = epp_plain_request(xml)
response[:result_code].should == '2302'
response[:msg].should == 'Domain name is reserved or restricted [name_dirty]'
response[:msg].should == 'Domain name is reserved [name_dirty]'
response[:clTRID].should == 'ABC-12345'
end
it 'does not create blocked domain' do
xml = domain_create_xml(name: { value: 'ftp.ee' })
response = epp_plain_request(xml)
response[:result_code].should == '2302'
response[:msg].should == 'Domain name is blocked [name_dirty]'
response[:clTRID].should == 'ABC-12345'
end
@ -746,10 +756,10 @@ describe 'EPP Domain', epp: true do
trn_data.css('name').text.should == domain.name
trn_data.css('trStatus').text.should == 'serverApproved'
trn_data.css('reID').text.should == 'REGDOMAIN2'
trn_data.css('reDate').text.should == dtl.transfer_requested_at.to_time.utc.iso8601
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
trn_data.css('acID').text.should == 'REGDOMAIN1'
trn_data.css('acDate').text.should == dtl.transferred_at.to_time.utc.iso8601
trn_data.css('exDate').text.should == domain.valid_to.to_time.utc.iso8601
trn_data.css('acDate').text.should == dtl.transferred_at.in_time_zone.utc.utc.iso8601
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
domain.registrar.should == @registrar2
@ -791,10 +801,10 @@ describe 'EPP Domain', epp: true do
trn_data.css('name').text.should == domain.name
trn_data.css('trStatus').text.should == 'pending'
trn_data.css('reID').text.should == 'REGDOMAIN1'
trn_data.css('reDate').text.should == dtl.transfer_requested_at.to_time.utc.iso8601
trn_data.css('acDate').text.should == dtl.wait_until.to_time.utc.iso8601
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
trn_data.css('acDate').text.should == dtl.wait_until.in_time_zone.utc.utc.iso8601
trn_data.css('acID').text.should == 'REGDOMAIN2'
trn_data.css('exDate').text.should == domain.valid_to.to_time.utc.iso8601
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
domain.registrar.should == @registrar2
@ -806,10 +816,10 @@ describe 'EPP Domain', epp: true do
trn_data.css('name').text.should == domain.name
trn_data.css('trStatus').text.should == 'pending'
trn_data.css('reID').text.should == 'REGDOMAIN1'
trn_data.css('reDate').text.should == dtl.transfer_requested_at.to_time.utc.iso8601
trn_data.css('acDate').text.should == dtl.wait_until.to_time.utc.iso8601
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
trn_data.css('acDate').text.should == dtl.wait_until.in_time_zone.utc.utc.iso8601
trn_data.css('acID').text.should == 'REGDOMAIN2'
trn_data.css('exDate').text.should == domain.valid_to.to_time.utc.iso8601
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
domain.registrar.should == @registrar2
@ -1213,9 +1223,9 @@ describe 'EPP Domain', epp: true do
trn_data.css('name').text.should == domain.name
trn_data.css('trStatus').text.should == 'clientApproved'
trn_data.css('reID').text.should == 'REGDOMAIN2'
trn_data.css('reDate').text.should == dtl.transfer_requested_at.to_time.utc.iso8601
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
trn_data.css('acID').text.should == 'REGDOMAIN1'
trn_data.css('exDate').text.should == domain.valid_to.to_time.utc.iso8601
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
end
it 'rejects a domain transfer' do
@ -2187,8 +2197,8 @@ describe 'EPP Domain', epp: true do
ns1.css('hostName').last.text.should == 'ns1.example.com'
ns1.css('hostAddr').first.text.should == '192.168.1.1'
ns1.css('hostAddr').last.text.should == '1080:0:0:0:8:800:200C:417A'
inf_data.css('crDate').text.should == domain.created_at.to_time.utc.iso8601
inf_data.css('exDate').text.should == domain.valid_to.to_time.utc.iso8601
inf_data.css('crDate').text.should == domain.created_at.in_time_zone.utc.utc.iso8601
inf_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
inf_data.css('pw').text.should == domain.auth_info
ds_data_1 = response[:parsed].css('dsData')[0]
@ -2217,7 +2227,7 @@ describe 'EPP Domain', epp: true do
response = epp_plain_request(domain_info_xml(name: { value: domain.name }))
inf_data = response[:parsed].css('resData infData')
inf_data.css('upDate').text.should == domain.updated_at.to_time.utc.iso8601
inf_data.css('upDate').text.should == domain.updated_at.in_time_zone.utc.utc.iso8601
end
it 'returns domain info with different nameservers' do

View file

@ -25,7 +25,7 @@ describe 'EPP Session', epp: true do
it 'does not log in with invalid user' do
wrong_user = @epp_xml.session.login(clID: { value: 'wrong-user' }, pw: { value: 'ghyt9e4fu' })
response = epp_plain_request(wrong_user)
response[:msg].should == 'Authentication error; server closing connection'
response[:msg].should == 'Authentication error; server closing connection (API user not found)'
response[:result_code].should == '2501'
response[:clTRID].should == 'ABC-12345'
end
@ -36,7 +36,7 @@ describe 'EPP Session', epp: true do
inactive = @epp_xml.session.login(clID: { value: 'inactive-user' }, pw: { value: 'ghyt9e4fu' })
response = epp_plain_request(inactive)
response[:msg].should == 'Authentication error; server closing connection'
response[:msg].should == 'Authentication error; server closing connection (API user is not active)'
response[:result_code].should == '2501'
end
@ -133,21 +133,6 @@ describe 'EPP Session', epp: true do
@api_user.reload
@api_user.password.should == 'ghyt9e4fu'
end
it 'fails if new password is not valid' do
@api_user.update(password: 'ghyt9e4fu')
response = epp_plain_request(@epp_xml.session.login(
clID: { value: 'gitlab' },
pw: { value: 'ghyt9e4fu' },
newPW: { value: '' }
), validate_input: false)
response[:msg].should == 'Password is missing [password]'
response[:result_code].should == '2306'
@api_user.reload
@api_user.password.should == 'ghyt9e4fu'
end
end
end
end

View file

@ -0,0 +1,3 @@
Fabricator(:blocked_domain) do
names ['ftp.ee', 'cache.ee']
end

View file

@ -0,0 +1,52 @@
require 'rails_helper'
feature 'BankStatement', type: :feature do
before :all do
@user = Fabricate(:admin_user)
end
before do
sign_in @user
end
it 'should add a bank statement and transactions manually' do
visit admin_bank_statements_url
click_link 'Add'
fill_in 'Bank code', with: '767'
fill_in 'Iban', with: 'EE557700771000598731'
click_button 'Save'
page.should have_content('Record created')
page.should have_content('Bank statement ')
page.should have_content('767')
page.should have_content('EE557700771000598731')
page.should have_content('Not binded')
click_link 'Add'
fill_in 'Description', with: 'Payment 12345'
fill_in 'Sum', with: '120'
fill_in 'Reference no', with: 'RF4663930489'
fill_in 'Document no', with: '123'
fill_in 'Bank reference', with: '767'
fill_in 'Iban', with: 'EE557700771000598731'
fill_in 'Buyer bank code', with: '767'
fill_in 'Buyer iban', with: 'EE557700771000598000'
fill_in 'Buyer name', with: 'Test buyer'
fill_in 'Paid at', with: '2015-01-01'
click_button 'Save'
page.should have_content('Record created')
page.should have_content('Bank transaction')
page.should have_content('RF4663930489')
page.should have_content('EE557700771000598000')
page.should have_content('Not binded')
page.should have_content('Bind manually')
click_link 'Back to bank statement'
page.should have_content('120.0')
page.should have_content('Test buyer')
end
end

View file

@ -0,0 +1,30 @@
require 'rails_helper'
feature 'BlockedDomain', type: :feature do
before :all do
@user = Fabricate(:admin_user)
end
before do
sign_in @user
end
it 'should manage blocked domains' do
visit admin_blocked_domains_url
page.should have_content('Blocked domains')
d = Fabricate.build(:domain, name: 'ftp.ee')
d.valid?
d.errors.full_messages.should match_array([])
fill_in 'blocked_domains', with: "ftp.ee\ncache.ee"
click_button 'Save'
page.should have_content('Record updated')
page.should have_content('ftp.ee')
page.should have_content('cache.ee')
d.valid?
d.errors.full_messages.should match_array(["Domain name Domain name is blocked"])
end
end

View file

@ -6,15 +6,17 @@ feature 'Invoice', type: :feature do
Fabricate(:invoice)
end
it 'should show index of invoices' do
before do
sign_in @user
end
it 'should show index of invoices' do
visit admin_invoices_url
i = Invoice.first
page.should have_link("Invoice no. #{i.id}")
end
it 'should show invoice' do
sign_in @user
visit admin_invoices_url
i = Invoice.first
@ -23,4 +25,21 @@ feature 'Invoice', type: :feature do
page.should have_content("Details")
page.should have_content("Paldiski mnt. 123")
end
it 'should issue an invoice' do
Fabricate(:eis)
r = Fabricate(:registrar)
visit admin_invoices_url
click_link('Add')
page.should have_content('Create new invoice')
select r.name, from: 'Registrar'
fill_in 'Amount', with: '100'
fill_in 'Description', with: 'test issue'
click_button 'Save'
page.should have_content('Record created')
page.should have_content('Invoice no.')
page.should have_content('Prepayment')
page.should have_content('120.0')
page.should have_content(r.name)
end
end

View file

@ -8,6 +8,14 @@ feature 'Sessions', type: :feature do
page.should have_text('Access denied')
end
it 'should see login page when whitelist disabled' do
Setting.registrar_ip_whitelist_enabled = false
WhiteIp.destroy_all
visit registrar_login_path
page.should_not have_text('Access denied')
Setting.registrar_ip_whitelist_enabled = true
end
it 'should see log in' do
@fixed_registrar.white_ips = [Fabricate(:white_ip_registrar)]
visit registrar_login_path
@ -26,6 +34,20 @@ feature 'Sessions', type: :feature do
page.should have_text('Access denied')
end
it 'should get in with invalid when whitelist disabled' do
Setting.registrar_ip_whitelist_enabled = false
Fabricate(:registrar, white_ips: [Fabricate(:white_ip), Fabricate(:white_ip_registrar)])
@api_user_invalid_ip = Fabricate(
:api_user, identity_code: '37810013294', registrar: Fabricate(:registrar, white_ips: [])
)
visit registrar_login_path
fill_in 'depp_user_tag', with: @api_user_invalid_ip.username
fill_in 'depp_user_password', with: @api_user_invalid_ip.password
click_button 'Log in'
page.should have_text('Log out')
Setting.registrar_ip_whitelist_enabled = true
end
it 'should not get in with invalid user' do
visit registrar_login_path
fill_in 'depp_user_tag', with: 'bla'
@ -114,7 +136,7 @@ feature 'Sessions', type: :feature do
fill_in 'user_phone', with: '00007'
click_button 'Log in'
page.should have_text('Check your phone for confirmation code')
page.should have_text('Confirmation sms was sent to your phone. Verification code is')
page.should have_text('SIM application error')
end
@ -143,7 +165,7 @@ feature 'Sessions', type: :feature do
fill_in 'user_phone', with: '00007'
click_button 'Log in'
page.should have_text('Check your phone for confirmation code')
page.should have_text('Confirmation sms was sent to your phone. Verification code is')
page.should have_text('Welcome!')
end

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