diff --git a/.rubocop.yml b/.rubocop.yml
index b1ceb5312..16450b1d3 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -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
diff --git a/.spring.rb b/.spring.rb
new file mode 100644
index 000000000..48b5ff783
--- /dev/null
+++ b/.spring.rb
@@ -0,0 +1,2 @@
+Spring.watch 'config/application.yml'
+eee
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f700d1b1f..24b3f92b6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/Gemfile b/Gemfile
index e040fcac8..15674d021 100644
--- a/Gemfile
+++ b/Gemfile
@@ -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
diff --git a/Gemfile.lock b/Gemfile.lock
index 463b6afad..74a409af3 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -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
diff --git a/README.md b/README.md
index 01276c1e0..1af56f5e9 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/app/controllers/admin/bank_statements_controller.rb b/app/controllers/admin/bank_statements_controller.rb
index b667d0fb6..1e69aa1af 100644
--- a/app/controllers/admin/bank_statements_controller.rb
+++ b/app/controllers/admin/bank_statements_controller.rb
@@ -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
diff --git a/app/controllers/admin/bank_transactions_controller.rb b/app/controllers/admin/bank_transactions_controller.rb
index ca1da48a8..1aaf452a8 100644
--- a/app/controllers/admin/bank_transactions_controller.rb
+++ b/app/controllers/admin/bank_transactions_controller.rb
@@ -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
diff --git a/app/controllers/admin/blocked_domains_controller.rb b/app/controllers/admin/blocked_domains_controller.rb
new file mode 100644
index 000000000..82b1dcc5a
--- /dev/null
+++ b/app/controllers/admin/blocked_domains_controller.rb
@@ -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
diff --git a/app/controllers/admin/invoices_controller.rb b/app/controllers/admin/invoices_controller.rb
index fdbe80070..ce368742c 100644
--- a/app/controllers/admin/invoices_controller.rb
+++ b/app/controllers/admin/invoices_controller.rb
@@ -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
diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb
index 7c91bcbb0..fb9d80ae2 100644
--- a/app/controllers/admin/settings_controller.rb
+++ b/app/controllers/admin/settings_controller.rb
@@ -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
diff --git a/app/controllers/admin/zonefiles_controller.rb b/app/controllers/admin/zonefiles_controller.rb
index 9977d30b6..7d3b68ec6 100644
--- a/app/controllers/admin/zonefiles_controller.rb
+++ b/app/controllers/admin/zonefiles_controller.rb
@@ -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])
diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb
index 9f7ffb6ec..a3977e8e2 100644
--- a/app/controllers/epp/domains_controller.rb
+++ b/app/controllers/epp/domains_controller.rb
@@ -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
diff --git a/app/controllers/epp/keyrelays_controller.rb b/app/controllers/epp/keyrelays_controller.rb
index cbfdae665..d6515758f 100644
--- a/app/controllers/epp/keyrelays_controller.rb
+++ b/app/controllers/epp/keyrelays_controller.rb
@@ -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
diff --git a/app/controllers/epp/sessions_controller.rb b/app/controllers/epp/sessions_controller.rb
index b6b75fcfd..fe241d94e 100644
--- a/app/controllers/epp/sessions_controller.rb
+++ b/app/controllers/epp/sessions_controller.rb
@@ -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
diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb
index 8817e150e..16090a885 100644
--- a/app/controllers/epp_controller.rb
+++ b/app/controllers/epp_controller.rb
@@ -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
diff --git a/app/controllers/registrant/domain_delete_confirms_controller.rb b/app/controllers/registrant/domain_delete_confirms_controller.rb
index 73d7f21b5..f6f05d628 100644
--- a/app/controllers/registrant/domain_delete_confirms_controller.rb
+++ b/app/controllers/registrant/domain_delete_confirms_controller.rb
@@ -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
diff --git a/app/controllers/registrant/domain_update_confirms_controller.rb b/app/controllers/registrant/domain_update_confirms_controller.rb
index debe7294b..598681d7a 100644
--- a/app/controllers/registrant/domain_update_confirms_controller.rb
+++ b/app/controllers/registrant/domain_update_confirms_controller.rb
@@ -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
diff --git a/app/controllers/registrant/sessions_controller.rb b/app/controllers/registrant/sessions_controller.rb
index 2d8c3013d..f0a292137 100644
--- a/app/controllers/registrant/sessions_controller.rb
+++ b/app/controllers/registrant/sessions_controller.rb
@@ -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
diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb
index 3fea41f75..940e5f415 100644
--- a/app/controllers/registrar/sessions_controller.rb
+++ b/app/controllers/registrar/sessions_controller.rb
@@ -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
diff --git a/app/controllers/registrar_controller.rb b/app/controllers/registrar_controller.rb
index e1b6b5a3c..37ec99bfd 100644
--- a/app/controllers/registrar_controller.rb
+++ b/app/controllers/registrar_controller.rb
@@ -1,6 +1,5 @@
class RegistrarController < ApplicationController
before_action :authenticate_user!, :check_ip
- # before_action :check_ip
layout 'registrar/application'
include Registrar::ApplicationHelper
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 3c641fdcb..c02e5847c 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -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
diff --git a/app/models/api_user.rb b/app/models/api_user.rb
index 3312de5d4..3d18ea181 100644
--- a/app/models/api_user.rb
+++ b/app/models/api_user.rb
@@ -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
diff --git a/app/models/bank_statement.rb b/app/models/bank_statement.rb
index bb670d227..7267b4773 100644
--- a/app/models/bank_statement.rb
+++ b/app/models/bank_statement.rb
@@ -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
diff --git a/app/models/blocked_domain.rb b/app/models/blocked_domain.rb
new file mode 100644
index 000000000..2a646a74f
--- /dev/null
+++ b/app/models/blocked_domain.rb
@@ -0,0 +1,5 @@
+class BlockedDomain < ActiveRecord::Base
+ include Versions
+
+ after_initialize -> { self.names = [] if names.nil? }
+end
diff --git a/app/models/certificate.rb b/app/models/certificate.rb
index b354f87f2..c1a7d3019 100644
--- a/app/models/certificate.rb
+++ b/app/models/certificate.rb
@@ -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')
diff --git a/app/models/deposit.rb b/app/models/deposit.rb
index 18cb8e05d..fae4336cf 100644
--- a/app/models/deposit.rb
+++ b/app/models/deposit.rb
@@ -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
diff --git a/app/models/depp/contact.rb b/app/models/depp/contact.rb
index be0429c2f..ddac61049 100644
--- a/app/models/depp/contact.rb
+++ b/app/models/depp/contact.rb
@@ -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(
diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb
index 4a13d5ba5..649d00964 100644
--- a/app/models/depp/domain.rb
+++ b/app/models/depp/domain.rb
@@ -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'] },
diff --git a/app/models/depp/keyrelay.rb b/app/models/depp/keyrelay.rb
index f4e609c05..8e8eaec26 100644
--- a/app/models/depp/keyrelay.rb
+++ b/app/models/depp/keyrelay.rb
@@ -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
diff --git a/app/models/depp/user.rb b/app/models/depp/user.rb
index fcce49c10..4efbd42d9 100644
--- a/app/models/depp/user.rb
+++ b/app/models/depp/user.rb
@@ -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
diff --git a/app/models/dnskey.rb b/app/models/dnskey.rb
index 5dd03ae50..0c426978c 100644
--- a/app/models/dnskey.rb
+++ b/app/models/dnskey.rb
@@ -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
diff --git a/app/models/domain.rb b/app/models/domain.rb
index 50e8b6fa4..2fa8e338e 100644
--- a/app/models/domain.rb
+++ b/app/models/domain.rb
@@ -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'
diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb
index d9ba0a48a..d85b16cec 100644
--- a/app/models/epp/contact.rb
+++ b/app/models/epp/contact.rb
@@ -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
diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb
index bca034f52..69072a398 100644
--- a/app/models/epp/domain.rb
+++ b/app/models/epp/domain.rb
@@ -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 ###
diff --git a/app/models/invoice.rb b/app/models/invoice.rb
index aa5a8c430..271e37f2f 100644
--- a/app/models/invoice.rb
+++ b/app/models/invoice.rb
@@ -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)
diff --git a/app/models/legal_document.rb b/app/models/legal_document.rb
index 0972767f7..f1a63e976 100644
--- a/app/models/legal_document.rb
+++ b/app/models/legal_document.rb
@@ -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
diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb
index 0fad0ff5c..6206a4f16 100644
--- a/app/models/nameserver.rb
+++ b/app/models/nameserver.rb
@@ -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|
diff --git a/app/models/registrar.rb b/app/models/registrar.rb
index 38f09aa04..1feb2caf4 100644
--- a/app/models/registrar.rb
+++ b/app/models/registrar.rb
@@ -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
diff --git a/app/models/version/blocked_domain_version.rb b/app/models/version/blocked_domain_version.rb
new file mode 100644
index 000000000..82e6b30da
--- /dev/null
+++ b/app/models/version/blocked_domain_version.rb
@@ -0,0 +1,4 @@
+class BlockedDomainVersion < PaperTrail::Version
+ self.table_name = :log_blocked_domains
+ self.sequence_name = :log_blocked_domains_id_seq
+end
diff --git a/app/models/white_ip.rb b/app/models/white_ip.rb
index f62cb2f9f..d8f9dd7fa 100644
--- a/app/models/white_ip.rb
+++ b/app/models/white_ip.rb
@@ -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(
diff --git a/app/models/whois_record.rb b/app/models/whois_record.rb
index e1b168935..5113b331f 100644
--- a/app/models/whois_record.rb
+++ b/app/models/whois_record.rb
@@ -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")
diff --git a/app/validators/date_time_iso8601_validator.rb b/app/validators/date_time_iso8601_validator.rb
index d764620e8..cc77e0d9e 100644
--- a/app/validators/date_time_iso8601_validator.rb
+++ b/app/validators/date_time_iso8601_validator.rb
@@ -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
diff --git a/app/validators/domain_name_validator.rb b/app/validators/domain_name_validator.rb
index 93046c882..ff6ef69f6 100644
--- a/app/validators/domain_name_validator.rb
+++ b/app/validators/domain_name_validator.rb
@@ -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)
diff --git a/app/validators/object_count_validator.rb b/app/validators/object_count_validator.rb
index b442a360a..d2d880fea 100644
--- a/app/validators/object_count_validator.rb
+++ b/app/validators/object_count_validator.rb
@@ -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
diff --git a/app/views/admin/bank_statements/_form.haml b/app/views/admin/bank_statements/_form.haml
new file mode 100644
index 000000000..158d69e89
--- /dev/null
+++ b/app/views/admin/bank_statements/_form.haml
@@ -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')
diff --git a/app/views/admin/bank_statements/import.haml b/app/views/admin/bank_statements/import.haml
new file mode 100644
index 000000000..e432abdf1
--- /dev/null
+++ b/app/views/admin/bank_statements/import.haml
@@ -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')
diff --git a/app/views/admin/bank_statements/index.haml b/app/views/admin/bank_statements/index.haml
index afb3a7be1..0810c15fe 100644
--- a/app/views/admin/bank_statements/index.haml
+++ b/app/views/admin/bank_statements/index.haml
@@ -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
diff --git a/app/views/admin/bank_statements/new.haml b/app/views/admin/bank_statements/new.haml
index 452ffd264..4e5ff09d3 100644
--- a/app/views/admin/bank_statements/new.haml
+++ b/app/views/admin/bank_statements/new.haml
@@ -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'
diff --git a/app/views/admin/bank_statements/show.haml b/app/views/admin/bank_statements/show.haml
index 6eb808515..db8d64004 100644
--- a/app/views/admin/bank_statements/show.haml
+++ b/app/views/admin/bank_statements/show.haml
@@ -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
diff --git a/app/views/admin/bank_transactions/_form.haml b/app/views/admin/bank_transactions/_form.haml
new file mode 100644
index 000000000..244284fda
--- /dev/null
+++ b/app/views/admin/bank_transactions/_form.haml
@@ -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')
diff --git a/app/views/admin/bank_transactions/edit.haml b/app/views/admin/bank_transactions/edit.haml
index 5c38ea6e0..8bb5a2666 100644
--- a/app/views/admin/bank_transactions/edit.haml
+++ b/app/views/admin/bank_transactions/edit.haml
@@ -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'
diff --git a/app/views/admin/bank_transactions/new.haml b/app/views/admin/bank_transactions/new.haml
new file mode 100644
index 000000000..403eb415e
--- /dev/null
+++ b/app/views/admin/bank_transactions/new.haml
@@ -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'
diff --git a/app/views/admin/blocked_domains/index.haml b/app/views/admin/blocked_domains/index.haml
new file mode 100644
index 000000000..bd5660193
--- /dev/null
+++ b/app/views/admin/blocked_domains/index.haml
@@ -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)
diff --git a/app/views/admin/domains/partials/_general.haml b/app/views/admin/domains/partials/_general.haml
index 53c73c65b..91b4aeabd 100644
--- a/app/views/admin/domains/partials/_general.haml
+++ b/app/views/admin/domains/partials/_general.haml
@@ -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
diff --git a/app/views/admin/invoices/index.haml b/app/views/admin/invoices/index.haml
index 45efe74de..837300133 100644
--- a/app/views/admin/invoices/index.haml
+++ b/app/views/admin/invoices/index.haml
@@ -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
diff --git a/app/views/admin/invoices/new.haml b/app/views/admin/invoices/new.haml
new file mode 100644
index 000000000..3b10341af
--- /dev/null
+++ b/app/views/admin/invoices/new.haml
@@ -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')
diff --git a/app/views/admin/invoices/show.haml b/app/views/admin/invoices/show.haml
index 9bab21f1d..c96cbb583 100644
--- a/app/views/admin/invoices/show.haml
+++ b/app/views/admin/invoices/show.haml
@@ -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
diff --git a/app/views/admin/settings/index.haml b/app/views/admin/settings/index.haml
index cd0e1d9a4..a9c2b1c4b 100644
--- a/app/views/admin/settings/index.haml
+++ b/app/views/admin/settings/index.haml
@@ -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)
diff --git a/app/views/invoice_mailer/invoice_email.html.erb b/app/views/invoice_mailer/invoice_email.html.erb
index 0a9e4163b..35f0dbb6e 100644
--- a/app/views/invoice_mailer/invoice_email.html.erb
+++ b/app/views/invoice_mailer/invoice_email.html.erb
@@ -1,5 +1,5 @@
<%= t(:you_have_a_new_invoice) %>
<%= t(:sincerely) %>,
-<%= Setting.eis_invoice_contact %>
+<%= Setting.registry_invoice_contact %>
<%= @invoice.seller_phone %>
diff --git a/app/views/invoice_mailer/invoice_email.text.erb b/app/views/invoice_mailer/invoice_email.text.erb
index ae65fd7da..ab8595474 100644
--- a/app/views/invoice_mailer/invoice_email.text.erb
+++ b/app/views/invoice_mailer/invoice_email.text.erb
@@ -1,5 +1,5 @@
<%= t(:you_have_a_new_invoice) %>
<%= t(:sincerely) %>,
-<%= Setting.eis_invoice_contact %>
+<%= Setting.registry_invoice_contact %>
<%= @invoice.seller_phone %>
diff --git a/app/views/layouts/admin/application.haml b/app/views/layouts/admin/application.haml
index 2cde75596..8fac692f5 100644
--- a/app/views/layouts/admin/application.haml
+++ b/app/views/layouts/admin/application.haml
@@ -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
diff --git a/app/views/registrar/invoices/index.haml b/app/views/registrar/invoices/index.haml
index d0c38940b..e20158ea7 100644
--- a/app/views/registrar/invoices/index.haml
+++ b/app/views/registrar/invoices/index.haml
@@ -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
diff --git a/bin/delayed_job b/bin/delayed_job
deleted file mode 100755
index edf195985..000000000
--- a/bin/delayed_job
+++ /dev/null
@@ -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
diff --git a/config/application-example.yml b/config/application-example.yml
index 24a551769..c01412138 100644
--- a/config/application-example.yml
+++ b/config/application-example.yml
@@ -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.
diff --git a/config/application.rb b/config/application.rb
index 9931ce25e..3fe81b40c 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -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]
diff --git a/config/daemons.yml b/config/daemons.yml
new file mode 100644
index 000000000..29ce969f4
--- /dev/null
+++ b/config/daemons.yml
@@ -0,0 +1,7 @@
+dir_mode: script
+dir: ../../log
+multiple: true
+backtrace: true
+monitor: true
+ontop: false
+app_name: 'que'
diff --git a/config/environments/alpha.rb b/config/environments/alpha.rb
index 00cf88f5b..01ae5d81d 100644
--- a/config/environments/alpha.rb
+++ b/config/environments/alpha.rb
@@ -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
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 562159d27..ce01368f9 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -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
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 00cf88f5b..01ae5d81d 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -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
diff --git a/config/environments/staging.rb b/config/environments/staging.rb
index 81690cb98..ee1303a1c 100644
--- a/config/environments/staging.rb
+++ b/config/environments/staging.rb
@@ -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
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 6c75b5a00..b56e173c1 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -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
diff --git a/config/initializers/autolabel.rb b/config/initializers/autolabel.rb
index 160d6c322..ad877d540 100644
--- a/config/initializers/autolabel.rb
+++ b/config/initializers/autolabel.rb
@@ -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
diff --git a/config/initializers/initial_settings.rb b/config/initializers/initial_settings.rb
index 824cf0fcc..764a96c18 100644
--- a/config/initializers/initial_settings.rb
+++ b/config/initializers/initial_settings.rb
@@ -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
diff --git a/config/initializers/money.rb b/config/initializers/money.rb
index 30df8eadf..bd14a3f3d 100644
--- a/config/initializers/money.rb
+++ b/config/initializers/money.rb
@@ -1,7 +1,6 @@
# encoding : utf-8
MoneyRails.configure do |config|
-
# To set the default currency
#
config.default_currency = :eur
diff --git a/config/initializers/new_relic_app_name.rb b/config/initializers/new_relic_app_name.rb
deleted file mode 100644
index 662fdf6b1..000000000
--- a/config/initializers/new_relic_app_name.rb
+++ /dev/null
@@ -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
diff --git a/config/initializers/que.rb b/config/initializers/que.rb
deleted file mode 100644
index b9e5a68ab..000000000
--- a/config/initializers/que.rb
+++ /dev/null
@@ -1 +0,0 @@
-Que.mode = :off
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 2336303e6..679bb44a0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -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:
ref number
payment amount
invoice number (the very first number in comment field).'
+ 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'
diff --git a/config/newrelic.yml b/config/newrelic.yml
index 6dc617a9d..e83d67abd 100644
--- a/config/newrelic.yml
+++ b/config/newrelic.yml
@@ -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
diff --git a/config/routes.rb b/config/routes.rb
index 5986f213f..e7ad5a63b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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
diff --git a/config/spring.rb b/config/spring.rb
new file mode 100644
index 000000000..12c701147
--- /dev/null
+++ b/config/spring.rb
@@ -0,0 +1 @@
+Spring.watch 'config/application.yml'
diff --git a/db/migrate/20150701074344_create_blocked_domains.rb b/db/migrate/20150701074344_create_blocked_domains.rb
new file mode 100644
index 000000000..41bff1f56
--- /dev/null
+++ b/db/migrate/20150701074344_create_blocked_domains.rb
@@ -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
diff --git a/db/seeds.rb b/db/seeds.rb
index 16b938cc4..cec5c9318 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -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!
diff --git a/db/structure.sql b/db/structure.sql
index efb3463bd..c3930c566 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -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');
diff --git a/doc/epp-examples.md b/doc/epp-examples.md
index c9dd1c38b..0343703d2 100644
--- a/doc/epp-examples.md
+++ b/doc/epp-examples.md
@@ -13213,53 +13213,3 @@ RESPONSE:
```
-
-### EPP Session when connected with valid user fails if new password is not valid
-
-REQUEST:
-
-```xml
-
-
-
-
- gitlab
- ghyt9e4fu
-
-
- 1.0
- en
-
-
- https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd
- https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd
- urn:ietf:params:xml:ns:host-1.0
- urn:ietf:params:xml:ns:keyrelay-1.0
-
- urn:ietf:params:xml:ns:secDNS-1.1
- https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd
-
-
-
- ABC-12345
-
-
-```
-
-RESPONSE:
-
-```xml
-
-
-
-
- Password is missing [password]
-
-
- ABC-12345
- ccReg-0674363838
-
-
-
-```
-
diff --git a/doc/que/README.md b/doc/que/README.md
new file mode 100644
index 000000000..3c34a10ac
--- /dev/null
+++ b/doc/que/README.md
@@ -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
diff --git a/doc/que/que-init-example b/doc/que/que-init-example
new file mode 100644
index 000000000..95a2f45f2
--- /dev/null
+++ b/doc/que/que-init-example
@@ -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 "
+ exit 1
+ ;;
+esac
diff --git a/lib/daemons/daemons b/lib/daemons/daemons
new file mode 100755
index 000000000..f021cee84
--- /dev/null
+++ b/lib/daemons/daemons
@@ -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?
\ No newline at end of file
diff --git a/lib/daemons/que.rb b/lib/daemons/que.rb
new file mode 100755
index 000000000..7586e65b8
--- /dev/null
+++ b/lib/daemons/que.rb
@@ -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
diff --git a/lib/daemons/que_ctl b/lib/daemons/que_ctl
new file mode 100755
index 000000000..0a9d3598b
--- /dev/null
+++ b/lib/daemons/que_ctl
@@ -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
\ No newline at end of file
diff --git a/lib/devise_custom_failure.rb b/lib/devise_custom_failure.rb
index b902486d4..a8a947173 100644
--- a/lib/devise_custom_failure.rb
+++ b/lib/devise_custom_failure.rb
@@ -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
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index f5c8e409c..9a89d2b72 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -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
diff --git a/spec/epp/contact_spec.rb b/spec/epp/contact_spec.rb
index ffbb3cd0b..752f017ef 100644
--- a/spec/epp/contact_spec.rb
+++ b/spec/epp/contact_spec.rb
@@ -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
diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb
index 9161f5cdc..c9bb99451 100644
--- a/spec/epp/domain_spec.rb
+++ b/spec/epp/domain_spec.rb
@@ -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
diff --git a/spec/epp/session_spec.rb b/spec/epp/session_spec.rb
index b1ad5d136..7573ea015 100644
--- a/spec/epp/session_spec.rb
+++ b/spec/epp/session_spec.rb
@@ -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
diff --git a/spec/fabricators/blocked_domain_fabricator.rb b/spec/fabricators/blocked_domain_fabricator.rb
new file mode 100644
index 000000000..363cc0526
--- /dev/null
+++ b/spec/fabricators/blocked_domain_fabricator.rb
@@ -0,0 +1,3 @@
+Fabricator(:blocked_domain) do
+ names ['ftp.ee', 'cache.ee']
+end
diff --git a/spec/features/admin/bank_statement_spec.rb b/spec/features/admin/bank_statement_spec.rb
new file mode 100644
index 000000000..bca3136fb
--- /dev/null
+++ b/spec/features/admin/bank_statement_spec.rb
@@ -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
diff --git a/spec/features/admin/blocked_domain_spec.rb b/spec/features/admin/blocked_domain_spec.rb
new file mode 100644
index 000000000..3c12a298c
--- /dev/null
+++ b/spec/features/admin/blocked_domain_spec.rb
@@ -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
diff --git a/spec/features/admin/invoice_spec.rb b/spec/features/admin/invoice_spec.rb
index dd6fff2f2..4e3747373 100644
--- a/spec/features/admin/invoice_spec.rb
+++ b/spec/features/admin/invoice_spec.rb
@@ -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
diff --git a/spec/features/registrar/sessions_spec.rb b/spec/features/registrar/sessions_spec.rb
index 5d5f3095a..07db0774a 100644
--- a/spec/features/registrar/sessions_spec.rb
+++ b/spec/features/registrar/sessions_spec.rb
@@ -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
diff --git a/spec/mailers/domain_mailer_spec.rb b/spec/mailers/domain_mailer_spec.rb
index 75c0640cd..8734153ee 100644
--- a/spec/mailers/domain_mailer_spec.rb
+++ b/spec/mailers/domain_mailer_spec.rb
@@ -54,7 +54,7 @@ describe DomainMailer do
end
it 'should render verification url' do
- @mail.body.encoded.should =~ /registrant\/domain_update_confirms/
+ @mail.body.encoded.should =~ %r{registrant\/domain_update_confirms}
end
end
@@ -109,7 +109,7 @@ describe DomainMailer do
end
it 'should render verification url' do
- @mail.body.encoded.should =~ /registrant\/domain_delete_con/ # somehowe delete_confirms not matching
+ @mail.body.encoded.should =~ %r{registrant\/domain_delete_con} # somehowe delete_confirms not matching
end
end
end
diff --git a/spec/models/bank_statement_spec.rb b/spec/models/bank_statement_spec.rb
index ed9a0218e..d5812fbeb 100644
--- a/spec/models/bank_statement_spec.rb
+++ b/spec/models/bank_statement_spec.rb
@@ -12,8 +12,7 @@ describe BankStatement do
@bank_statement.valid?
@bank_statement.errors.full_messages.should match_array([
"Bank code is missing",
- "Iban is missing",
- "Queried at is missing"
+ "Iban is missing"
])
end
diff --git a/spec/models/blocked_domain_spec.rb b/spec/models/blocked_domain_spec.rb
new file mode 100644
index 000000000..58bc1fdd3
--- /dev/null
+++ b/spec/models/blocked_domain_spec.rb
@@ -0,0 +1,34 @@
+require 'rails_helper'
+
+describe BlockedDomain do
+ context 'with no attributes' do
+ before :all do
+ @blocked_domain = BlockedDomain.new
+ end
+
+ it 'should have names array' do
+ @blocked_domain.names.should == []
+ end
+ end
+
+ context 'with valid attributes' do
+ before :all do
+ @blocked_domain = Fabricate(:blocked_domain)
+ end
+
+ it 'should be valid' do
+ @blocked_domain.valid?
+ @blocked_domain.errors.full_messages.should match_array([])
+ end
+
+ it 'should have one version' do
+ with_versioning do
+ @blocked_domain.versions.should == []
+ @blocked_domain.names = ['bla.ee']
+ @blocked_domain.save
+ @blocked_domain.errors.full_messages.should match_array([])
+ @blocked_domain.versions.size.should == 1
+ end
+ end
+ end
+end
diff --git a/spec/models/dnskey_spec.rb b/spec/models/dnskey_spec.rb
index 911713da5..a7ddfece4 100644
--- a/spec/models/dnskey_spec.rb
+++ b/spec/models/dnskey_spec.rb
@@ -49,7 +49,7 @@ describe Dnskey do
dk = d.dnskeys.last
dk.generate_digest
- dk.ds_digest.should == '0B62D1BC64EFD1EE652FB102BDF1011BF514CCD9A1A0CFB7472AEA3B01F38C92'
+ dk.ds_digest.should == '0B62D1BC64EFD1EE652FB102BDF1011BF514CCD9A1A0CFB7472AEA3B01F38C92'
dk.ds_key_tag.should == '30607'
end
diff --git a/spec/models/invoice_spec.rb b/spec/models/invoice_spec.rb
index 54a640d2d..b4f1d3908 100644
--- a/spec/models/invoice_spec.rb
+++ b/spec/models/invoice_spec.rb
@@ -71,7 +71,7 @@ describe Invoice do
end
it 'should cancel overdue invoices' do
- Fabricate(:invoice, created_at: Time.zone.now - 35.days, due_date: Time.zone.now - 1.days)
+ Fabricate(:invoice, created_at: Time.zone.now - 35.days, due_date: Time.zone.now - 30.days)
Invoice.cancel_overdue_invoices
Invoice.where(cancelled_at: nil).count.should == 1
end