Merge branch 'alpha' into staging

This commit is contained in:
Priit Tark 2015-07-15 10:53:43 +03:00
commit 78465d6803
161 changed files with 9507 additions and 2265 deletions

View file

@ -5,6 +5,7 @@ AllCops:
- 'Guardfile'
# stuff generated by AR and rails
- 'db/schema.rb'
- 'db/schema-read-only.rb'
- 'db/whois_schema.rb'
- 'db/api_log_schema.rb'
- 'db/migrate/*'
@ -60,6 +61,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 +96,27 @@ 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
# annoying to maintain, small thing, no real problem
Style/SpaceInsideHashLiteralBraces:
Enabled: false

2
.spring.rb Normal file
View file

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

View file

@ -17,7 +17,6 @@ before_script:
- cp config/database-travis.yml config/database.yml
- RAILS_ENV=test bundle exec rake db:all:drop
- RAILS_ENV=test bundle exec rake db:all:setup
- RAILS_ENV=test bundle exec rake zonefile:replace_procedure
script:
- RAILS_ENV=test bundle exec rake
cache: bundler

View file

@ -1,4 +1,22 @@
14.07.2015
* Updated que init script doc example, now status and stop works faster
* Updated registry server cronjob with mina cron:setup
07.07.2015
* Before applyling 20150707104937_refactor_reserved_domains.rb migration, enable hstore extension in db
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

81
Gemfile
View file

@ -1,18 +1,27 @@
# 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'
# load env
gem 'figaro', '~> 1.1.0'
gem 'figaro', '~> 1.1.1'
# model related
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,22 @@ 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'
# emits errors, needs more investigation
# 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 +124,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 +160,5 @@ group :development, :test do
# for travis
gem 'rake'
gem "autodoc"
gem 'autodoc'
end

View file

@ -1,5 +1,5 @@
GIT
remote: git://github.com/airblade/paper_trail.git
remote: https://github.com/airblade/paper_trail.git
revision: a453811226ec4ea59753ba6b827e390ced2fc140
ref: a453811226ec4ea59753ba6b827e390ced2fc140
specs:
@ -9,7 +9,7 @@ GIT
request_store (~> 1.1.0)
GIT
remote: git://github.com/gitlabeu/data_migrate.git
remote: https://github.com/gitlabeu/data_migrate.git
revision: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
ref: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
specs:
@ -17,64 +17,66 @@ 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/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 +89,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 +97,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 +105,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 +143,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 +183,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 +199,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 +209,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 +245,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 +278,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 +289,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 +309,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 +355,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 +376,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 +394,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 +464,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 +498,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 +512,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 +545,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)
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)
fabrication (~> 2.13.2)
faker (~> 1.4.3)
figaro (~> 1.1.1)
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 +587,37 @@ 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)
therubyracer (~> 0.12.2)
traceroute (~> 0.4.0)
traceroute (~> 0.5.0)
turbolinks (~> 2.5.3)
uglifier (~> 2.7.1)
unicorn

View file

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

View file

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

View file

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

View file

@ -0,0 +1,23 @@
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')
redirect_to :back
else
@blocked_domains = params[:blocked_domains]
flash.now[:alert] = I18n.t('failed_to_update_record')
render :index
end
end
end

View file

@ -1,6 +1,26 @@
class Admin::InvoicesController < AdminController
load_and_authorize_resource
before_action :set_invoice, only: [:forward, :download_pdf]
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 +40,34 @@ class Admin::InvoicesController < AdminController
render :show
end
end
def forward
@invoice.billing_email = @invoice.buyer.billing_email
return unless request.post?
@invoice.billing_email = params[:invoice][:billing_email]
if @invoice.forward(render_to_string('registrar/invoices/pdf', layout: false))
flash[:notice] = t(:invoice_forwared)
redirect_to([:admin, @invoice])
else
flash.now[:alert] = t(:failed_to_forward_invoice)
end
end
def download_pdf
pdf = @invoice.pdf(render_to_string('registrar/invoices/pdf', layout: false))
send_data pdf, filename: @invoice.pdf_name
end
private
def deposit_params
params.require(:deposit).permit(:amount, :description, :registrar_id)
end
def set_invoice
@invoice = Invoice.find(params[:invoice_id])
end
end

View file

@ -32,6 +32,11 @@ class Admin::PricelistsController < AdminController
end
end
def destroy
@pricelist.destroy
redirect_to admin_pricelists_url
end
private
def set_pricelist

View file

@ -0,0 +1,30 @@
class Admin::ReservedDomainsController < AdminController
load_and_authorize_resource
def index
rd = ReservedDomain.first_or_initialize
@reserved_domains = rd.names.to_yaml
end
def create
@reserved_domains = params[:reserved_domains]
begin
names = YAML.load(params[:reserved_domains])
rescue
flash.now[:alert] = I18n.t('invalid_yaml')
logger.warn 'Invalid YAML'
render :index and return
end
rd = ReservedDomain.first_or_create
if rd.update(names: names)
flash[:notice] = I18n.t('record_updated')
redirect_to :back
else
flash.now[:alert] = I18n.t('failed_to_update_record')
render :index
end
end
end

View file

@ -37,13 +37,46 @@ 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,
:expire_pending_confirmation
]
floats = [:registry_vat_prc]
booleans = [
:ds_data_allowed,
:key_data_allowed,
:client_side_status_editing_enabled,
:registrar_ip_whitelist_enabled,
:api_ip_whitelist_enabled
]
params[:settings].each do |k, v|
settings[k] = v.to_i if Setting[k].class == Fixnum
settings[k] = v.to_f if Setting[k].class == Float
settings[k] = (v == 'true' ? true : false) if [TrueClass, FalseClass].include?(Setting[k].class)
settings[k] = v
settings[k] = v.to_i if ints.include?(k.to_sym)
settings[k] = v.to_f if floats.include?(k.to_sym)
settings[k] = (v == 'true' ? true : false) if booleans.include?(k.to_sym)
end
settings
end
end

View file

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

View file

@ -18,18 +18,35 @@ class Epp::DomainsController < EppController
render_epp_response '/epp/domains/info'
end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def create
authorize! :create, Epp::Domain
@domain = Epp::Domain.new_from_epp(params[:parsed_frame], current_user)
handle_errors(@domain) and return if @domain.errors.any?
@domain.valid?
handle_errors(@domain) and return if @domain.errors.any?
if @domain.errors.any? || !@domain.save
handle_errors(@domain)
else
render_epp_response '/epp/domains/create'
handle_errors and return unless balance_ok?('create')
ActiveRecord::Base.transaction do
if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain?
current_user.registrar.debit!({
sum: @domain_pricelist.price.amount,
description: "#{I18n.t('create')} #{@domain.name}",
activity_type: AccountActivity::CREATE,
log_pricelist_id: @domain_pricelist.id
})
render_epp_response '/epp/domains/create'
else
handle_errors(@domain)
end
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/CyclomaticComplexity
def update
authorize! :update, @domain, @password
@ -44,7 +61,6 @@ class Epp::DomainsController < EppController
end
end
# rubocop:disable Metrics/CyclomaticComplexity
def delete
authorize! :delete, @domain, @password
@ -66,7 +82,6 @@ class Epp::DomainsController < EppController
handle_errors(@domain)
end
end
# rubocop:enbale Metrics/CyclomaticComplexity
def check
authorize! :check, Epp::Domain
@ -79,17 +94,35 @@ class Epp::DomainsController < EppController
def renew
authorize! :renew, @domain
handle_errors(@domain) and return unless @domain.renew(
params[:parsed_frame].css('curExpDate').text,
params[:parsed_frame].css('period').text,
params[:parsed_frame].css('period').first['unit']
)
period = params[:parsed_frame].css('period').text
period_unit = params[:parsed_frame].css('period').first['unit']
render_epp_response '/epp/domains/renew'
ActiveRecord::Base.transaction do
success = @domain.renew(
params[:parsed_frame].css('curExpDate').text,
period, period_unit
)
if success
unless balance_ok?('renew', period, period_unit)
handle_errors
fail ActiveRecord::Rollback
end
current_user.registrar.debit!({
sum: @domain_pricelist.price.amount,
description: "#{I18n.t('renew')} #{@domain.name}",
activity_type: AccountActivity::RENEW,
log_pricelist_id: @domain_pricelist.id
})
render_epp_response '/epp/domains/renew'
else
handle_errors(@domain)
end
end
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 +135,6 @@ class Epp::DomainsController < EppController
handle_errors(@domain)
end
end
# rubocop: enable Metrics/MethodLength
# rubocop: enable Metrics/CyclomaticComplexity
private
@ -161,7 +192,7 @@ class Epp::DomainsController < EppController
requires 'name'
@prefix = nil
requires_attribute 'transfer', 'op', values: %(approve, query, reject)
requires_attribute 'transfer', 'op', values: %(approve, query, reject, request)
end
def find_domain
@ -192,4 +223,17 @@ class Epp::DomainsController < EppController
msg: "#{I18n.t(:client_side_status_editing_error)}: status [status]"
}
end
def balance_ok?(operation, period = nil, unit = nil)
@domain_pricelist = @domain.pricelist(operation, period.try(:to_i), unit)
if current_user.registrar.balance < @domain_pricelist.price.amount
epp_errors << {
code: '2104',
msg: I18n.t('billing_failure_credit_balance_low')
}
return false
end
true
end
end

View file

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

View file

@ -7,17 +7,49 @@ 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
if request.ip == ENV['webclient_ip'] && !Rails.env.test? && !Rails.env.development?
client_md5 = Certificate.parse_md_from_string(request.env['HTTP_SSL_CLIENT_CERT'])
server_md5 = Certificate.parse_md_from_string(File.read(ENV['cert_path']))
if client_md5 != server_md5
@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 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'])
@msg = 'Authentication error; server closing connection (certificate is not valid)'
success = false
end
end
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 +65,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 +84,10 @@ class Epp::SessionsController < EppController
'registrar_id = ? AND updated_at >= ?', @api_user.registrar_id, Time.zone.now - 5.minutes
).count
if c >= 4
@msg = t('connection_limit_reached')
return false
end
return false if c >= 4
true
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def logout
@api_user = current_user # cache current_user for logging
epp_session.destroy

View file

@ -10,15 +10,29 @@ class EppController < ApplicationController
before_action :update_epp_session
helper_method :current_user
rescue_from CanCan::AccessDenied do |_exception|
rescue_from StandardError do |e|
@errors ||= []
if @errors.blank?
@errors = [{
msg: t('errors.messages.epp_authorization_error'),
code: '2201'
}]
if e.class == CanCan::AccessDenied
if @errors.blank?
@errors = [{
msg: t('errors.messages.epp_authorization_error'),
code: '2201'
}]
end
else
if @errors.blank?
@errors = [{
msg: 'Internal error.',
code: '2400'
}]
end
logger.error e.message
logger.error e.backtrace.join("\n")
# TODO: NOITFY AIRBRAKE / ERRBIT HERE
end
render_epp_response '/epp/error'
end
@ -124,7 +138,7 @@ class EppController < ApplicationController
# validate legal document's type here because it may be in most of the requests
@prefix = nil
if element_count('extdata > legalDocument') > 0
requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES)
requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES, policy: true)
end
handle_errors and return if epp_errors.any?
@ -174,12 +188,27 @@ class EppController < ApplicationController
attribute = element[attribute_selector]
return if attribute && options[:values].include?(attribute)
unless attribute
epp_errors << {
code: '2003',
msg: I18n.t('errors.messages.required_parameter_missing', key: attribute_selector)
}
return
end
epp_errors << {
code: '2306',
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector)
}
return if options[:values].include?(attribute)
if options[:policy]
epp_errors << {
code: '2306',
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector)
}
else
epp_errors << {
code: '2004',
msg: I18n.t('parameter_value_range_error', key: attribute_selector)
}
end
end
def optional_attribute(element_selector, attribute_selector, options)
@ -272,7 +301,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 +323,6 @@ class EppController < ApplicationController
ip: request.ip
})
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def iptables_counter_update

View file

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

View file

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

View file

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

View file

@ -1,10 +1,28 @@
class Registrar::AccountActivitiesController < RegistrarController
load_and_authorize_resource
def index
def index # rubocop: disable Metrics/AbcSize
params[:q] ||= {}
account = current_user.registrar.cash_account
ca_cache = params[:q][:created_at_lteq]
begin
end_time = params[:q][:created_at_lteq].try(:to_date)
params[:q][:created_at_lteq] = end_time.try(:end_of_day)
rescue
logger.warn('Invalid date')
end
@q = account.activities.includes(:invoice).search(params[:q])
@q.sorts = 'id desc' if @q.sorts.empty?
@account_activities = @q.result.page(params[:page])
respond_to do |format|
format.html { @account_activities = @q.result.page(params[:page]) }
format.csv do
send_data @q.result.to_csv, filename: "account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv"
end
end
params[:q][:created_at_lteq] = ca_cache
end
end

View file

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

View file

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

View file

@ -12,7 +12,7 @@ class ContactMailer < ApplicationMailer
emails = []
emails << [@contact.email, @contact.email_was] if @contact.registrant_domains.present?
emails << @contact.domains.map(&:email) if @contact.domains.present?
emails << @contact.domains.map(&:registrant_email) if @contact.domains.present?
emails = emails.uniq
emails.each do |email|

View file

@ -3,7 +3,7 @@ class DomainMailer < ApplicationMailer
@domain = domain
return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email)
# turn on delivery on specific request only, thus rake tasks does not deliver anything
# turn on delivery on specific EPP request only, thus rake tasks does not deliver anything
return if @domain.deliver_emails != true
if @domain.registrant_verification_token.blank?
@ -25,11 +25,22 @@ class DomainMailer < ApplicationMailer
subject: "#{I18n.t(:domain_registrant_pending_updated_subject, name: @domain.name)} [#{@domain.name}]")
end
def registrant_updated(domain)
@domain = domain
return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email)
# turn on delivery on specific EPP request only, thus rake tasks does not deliver anything
return if @domain.deliver_emails != true
mail(to: @domain.registrant_email,
subject: "#{I18n.t(:domain_registrant_updated, name: @domain.name)} [#{@domain.name}]")
end
def pending_deleted(domain)
@domain = domain
return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email)
# turn on delivery on specific request only, thus rake tasks does not deliver anything
# turn on delivery on specific EPP request only, thus rake tasks does not deliver anything
return if @domain.deliver_emails != true
if @domain.registrant_verification_token.blank?

View file

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

View file

@ -1,13 +1,37 @@
require 'csv'
class AccountActivity < ActiveRecord::Base
include Versions
belongs_to :account
belongs_to :bank_transaction
belongs_to :invoice
CREATE = 'create'
RENEW = 'renew'
ADD_CREDIT = 'add_credit'
after_create :update_balance
def update_balance
account.balance += sum
account.save
end
class << self
def types_for_select
[CREATE, RENEW, ADD_CREDIT].map { |x| [I18n.t(x), x] }
end
def to_csv
attributes = %w(description activity_type created_at sum)
CSV.generate(headers: true) do |csv|
csv << %w(description activity_type receipt_date sum)
all.each do |x| # rubocop:disable Rails/FindEach
csv << attributes.map { |attr| x.send(attr) }
end
end
end
end
end

View file

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

View file

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

View file

@ -3,7 +3,9 @@ class BankTransaction < ActiveRecord::Base
belongs_to :bank_statement
has_one :account_activity
scope :unbinded, -> { where('id NOT IN (SELECT bank_transaction_id FROM account_activities)') }
scope :unbinded, lambda {
where('id NOT IN (SELECT bank_transaction_id FROM account_activities where bank_transaction_id IS NOT NULL)')
}
def binded?
account_activity.present?
@ -77,7 +79,8 @@ class BankTransaction < ActiveRecord::Base
invoice: invoice,
sum: invoice.sum_without_vat,
currency: currency,
description: description
description: description,
activity_type: AccountActivity::ADD_CREDIT
)
end
end

View file

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

View file

@ -76,6 +76,7 @@ class Certificate < ActiveRecord::Base
@cached_status = REVOKED
end
# rubocop: disable Metrics/AbcSize
def sign!
csr_file = Tempfile.new('client_csr')
csr_file.write(csr)
@ -107,6 +108,7 @@ class Certificate < ActiveRecord::Base
return false
end
end
# rubocop: enable Metrics/AbcSize
def revoke!
crt_file = Tempfile.new('client_crt')
@ -198,5 +200,14 @@ class Certificate < ActiveRecord::Base
_out, _err, _st = Open3.capture3("sudo /etc/init.d/apache2 reload")
STDOUT << "#{Time.zone.now.utc} - Apache reloaded\n"
end
def parse_md_from_string(crt)
return nil if crt.blank?
crt = crt.split(' ').join("\n")
crt.gsub!("-----BEGIN\nCERTIFICATE-----\n", "-----BEGIN CERTIFICATE-----\n")
crt.gsub!("\n-----END\nCERTIFICATE-----", "\n-----END CERTIFICATE-----")
cert = OpenSSL::X509::Certificate.new(crt)
OpenSSL::Digest::MD5.new(cert.to_der).to_s
end
end
end

View file

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

View file

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

View file

@ -79,7 +79,8 @@ module Depp
end
def transfer(params)
op = params[:query] ? 'query' : nil
op = params[:request] ? 'request' : nil
op = params[:query] ? 'query' : op
op = params[:approve] ? 'approve' : op
op = params[:reject] ? 'reject' : op
@ -130,7 +131,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,18 +179,22 @@ module Depp
ret
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def construct_custom_params_hash(domain_params)
custom_params = {}
custom_params = { _anonymus: [] }
if domain_params[:legal_document].present?
type = domain_params[:legal_document].original_filename.split('.').last.downcase
custom_params = {
_anonymus: [
legalDocument: { value: Base64.encode64(domain_params[:legal_document].read), attrs: { type: type } }
]
custom_params[:_anonymus] << {
legalDocument: { value: Base64.encode64(domain_params[:legal_document].read), attrs: { type: type } }
}
end
if domain_params[:reserved_pw].present?
custom_params[:_anonymus] << { reserved: { pw: { value: domain_params[:reserved_pw] } } }
end
custom_params
end
@ -233,7 +240,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 +263,11 @@ module Depp
domain_params[:dnskeys_attributes].each do |_k, v|
if v['ds_key_tag'].blank?
kd = create_key_data_hash(v)
ret << {
ret << {
keyData: kd
} if kd
else
ret << {
ret << {
dsData: [
keyTag: { value: v['ds_key_tag'] },
alg: { value: v['ds_alg'] },

View file

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

View file

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

View file

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

View file

@ -61,6 +61,7 @@ class Domain < ActiveRecord::Base
before_create :generate_auth_info
before_create :set_validity_dates
before_create -> { self.reserved = in_reserved_list?; nil }
before_update :manage_statuses
def manage_statuses
return unless registrant_id_changed?
@ -78,12 +79,32 @@ class Domain < ActiveRecord::Base
after_initialize -> { self.statuses = [] if statuses.nil? }
after_create :update_reserved_domains
def update_reserved_domains
return unless in_reserved_list?
rd = ReservedDomain.first
rd.names[name] = SecureRandom.hex
rd.save
end
validates :name_dirty, domain_name: true, uniqueness: true
validates :puny_label, length: { maximum: 63 }
validates :period, numericality: { only_integer: true }
validates :registrant, :registrar, presence: true
validate :validate_period
validate :validate_reservation
def validate_reservation
return if persisted? || !in_reserved_list?
if reserved_pw.blank?
errors.add(:base, :required_parameter_missing_reserved)
return false
end
return if ReservedDomain.pw_for(name) == reserved_pw
errors.add(:base, :invalid_auth_information_reserved)
end
validates :nameservers, object_count: {
min: -> { Setting.ns_min_count },
@ -134,7 +155,7 @@ class Domain < ActiveRecord::Base
end
attr_accessor :registrant_typeahead, :update_me, :deliver_emails,
:epp_pending_update, :epp_pending_delete
:epp_pending_update, :epp_pending_delete, :reserved_pw
def subordinate_nameservers
nameservers.select { |x| x.hostname.end_with?(name) }
@ -146,9 +167,9 @@ class Domain < ActiveRecord::Base
class << self
def convert_period_to_time(period, unit)
return period.to_i.days if unit == 'd'
return period.to_i.months if unit == 'm'
return period.to_i.years if unit == 'y'
return (period.to_i / 365).years if unit == 'd'
return (period.to_i / 12).years if unit == 'm'
return period.to_i.years if unit == 'y'
end
def included
@ -162,16 +183,34 @@ class Domain < ActiveRecord::Base
)
end
def clean_expired_pendings
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
expire_at = Setting.expire_pending_confirmation.hours.ago
count = 0
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
expired_pending_domains.each do |domain|
unless domain.pending_update? || domain.pending_delete?
msg = "#{Time.zone.now.utc} - ISSUE: DOMAIN #{domain.id}: #{domain.name} IS IN EXPIRED PENDING LIST, " \
"but no pendingDelete/pendingUpdate state present!\n"
STDOUT << msg unless Rails.env.test?
next
end
count += 1
domain.clean_pendings!
end
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test?
count
end
def start_expire_period
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
d = Domain.where('valid_to <= ?', Time.zone.now)
d.each do |x|
next unless x.expirable?
x.statuses << DomainStatus::EXPIRED
# TODO: This should be managed by automatic_statuses
x.statuses.delete(DomainStatus::OK)
x.save(validate: false)
domains = Domain.where('valid_to <= ?', Time.zone.now)
domains.each do |domain|
next unless domain.expirable?
domain.set_expired!
end
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" unless Rails.env.test?
@ -207,6 +246,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 +263,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)
@ -245,6 +286,10 @@ class Domain < ActiveRecord::Base
@registrant_typeahead || registrant.try(:name) || nil
end
def in_reserved_list?
ReservedDomain.pw_for(name).present?
end
def pending_transfer
domain_transfers.find_by(status: DomainTransfer::PENDING)
end
@ -370,6 +415,25 @@ class Domain < ActiveRecord::Base
DomainMailer.pending_deleted(self).deliver_now
end
def pricelist(operation, period_i = nil, unit = nil)
period_i ||= period
unit ||= period_unit
zone = name.split('.').drop(1).join('.')
p = period_i / 365 if unit == 'd'
p = period_i / 12 if unit == 'm'
p = period_i if unit == 'y'
if p > 1
p = "#{p}years"
else
p = "#{p}year"
end
Pricelist.pricelist_for(zone, operation, p)
end
### VALIDATIONS ###
def validate_nameserver_ips
@ -410,8 +474,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'
@ -471,6 +535,19 @@ class Domain < ActiveRecord::Base
save(validate: false)
end
def set_expired
# TODO: currently valid_to attribute update logic is open
# self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
self.outzone_at = Time.zone.now + Setting.expire_warning_period.days
self.delete_at = Time.zone.now + Setting.redemption_grace_period.days
statuses << DomainStatus::EXPIRED
end
def set_expired!
set_expired
save(validate: false)
end
def manage_automatic_statuses
# domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable?
if statuses.empty? && valid?

View file

@ -71,6 +71,7 @@ class DomainStatus < ActiveRecord::Base
FORCE_DELETE = 'forceDelete'
DELETE_CANDIDATE = 'deleteCandidate'
EXPIRED = 'expired'
RESERVED = 'reserved'
STATUSES = [
CLIENT_DELETE_PROHIBITED, SERVER_DELETE_PROHIBITED, CLIENT_HOLD, SERVER_HOLD,

View file

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

View file

@ -25,7 +25,8 @@ class Epp::Domain < Domain
],
'2003' => [ # Required parameter missing
[:registrant, :blank],
[:registrar, :blank]
[:registrar, :blank],
[:base, :required_parameter_missing_reserved]
],
'2004' => [ # Parameter value range error
[:nameservers, :out_of_range,
@ -60,9 +61,13 @@ class Epp::Domain < Domain
'2201' => [ # Authorisation error
[:auth_info, :wrong_pw]
],
'2202' => [
[:base, :invalid_auth_information_reserved]
],
'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 +86,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
@ -110,6 +116,8 @@ class Epp::Domain < Domain
at[:period_unit] = Epp::Domain.parse_period_unit_from_frame(frame) || 'y'
at[:reserved_pw] = frame.css('reserved > pw').text
# at[:statuses] = domain_statuses_attrs(frame, action)
# binding.pry
at[:nameservers_attributes] = nameservers_attrs(frame, action)
@ -130,6 +138,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 +367,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 +390,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
@ -387,7 +398,10 @@ class Epp::Domain < Domain
frame = Nokogiri::XML(pending_json['frame'])
statuses.delete(DomainStatus::PENDING_UPDATE)
clean_pendings! if update(frame, user, false)
return unless update(frame, user, false)
clean_pendings!
self.deliver_emails = true # turn on email delivery for epp
DomainMailer.registrant_updated(self).deliver_now
end
def apply_pending_delete!
@ -408,7 +422,7 @@ class Epp::Domain < Domain
)
end
def epp_destroy(frame, user_id, verify=true)
def epp_destroy(frame, user_id, verify = true)
return false unless valid?
if verify && frame.css('delete').attr('verified').to_s.downcase != 'yes'
@ -418,7 +432,7 @@ class Epp::Domain < Domain
manage_automatic_statuses
true # aka 1001 pending_delete
else
destroy
set_expired!
end
end
@ -450,6 +464,8 @@ class Epp::Domain < Domain
def transfer(frame, action, current_user)
case action
when 'query'
return domain_transfers.last if domain_transfers.any?
when 'request'
return pending_transfer if pending_transfer
return query_transfer(frame, current_user)
when 'approve'
@ -457,7 +473,7 @@ class Epp::Domain < Domain
when 'reject'
return reject_transfer(frame, current_user) if pending_transfer
end
add_epp_error('2303', nil, nil, I18n.t('pending_transfer_was_not_found'))
add_epp_error('2303', nil, nil, I18n.t('no_transfers_found'))
end
# TODO: Eager load problems here. Investigate how it's possible not to query contact again
@ -524,6 +540,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 +550,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 +582,7 @@ class Epp::Domain < Domain
end
end
end
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/MethodLength
def approve_transfer(frame, current_user)
@ -621,13 +639,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 +683,7 @@ class Epp::Domain < Domain
true
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
### VALIDATIONS ###
@ -733,7 +753,7 @@ class Epp::Domain < Domain
next
end
unless DomainNameValidator.validate_reservation(x)
if ReservedDomain.pw_for(x).present?
res << { name: x, avail: 0, reason: I18n.t('errors.messages.epp_domain_reserved') }
next
end

View file

@ -7,7 +7,9 @@ class Invoice < ActiveRecord::Base
accepts_nested_attributes_for :invoice_items
scope :unbinded, -> { where('id NOT IN (SELECT invoice_id FROM account_activities)') }
scope :unbinded, lambda {
where('id NOT IN (SELECT invoice_id FROM account_activities where invoice_id IS NOT NULL)')
}
attr_accessor :billing_email
validates :billing_email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }, allow_blank: true
@ -15,11 +17,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
@ -36,16 +38,16 @@ class Invoice < ActiveRecord::Base
class << self
def cancel_overdue_invoices
logger.info "#{Time.zone.now.utc} - Cancelling overdue invoices\n"
STDOUT << "#{Time.zone.now.utc} - Cancelling overdue invoices\n" unless Rails.env.test?
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)
logger.info "#{Time.zone.now.utc} - Successfully cancelled #{count} overdue invoices\n"
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} overdue invoices\n" unless Rails.env.test?
end
end

View file

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

View file

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

View file

@ -1,3 +0,0 @@
class Pending < ActiveRecord::Base
belongs_to :domain
end

View file

@ -1,6 +1,8 @@
class Pricelist < ActiveRecord::Base
include Versions # version/pricelist_version.rb
scope :valid, -> { where("valid_from <= ? AND valid_to >= ? OR valid_to IS NULL", Time.zone.now, Time.zone.now) }
monetize :price_cents
validates :price_cents, :price_currency, :price,
@ -13,10 +15,18 @@ class Pricelist < ActiveRecord::Base
after_initialize :init_values
def init_values
return unless new_record?
self.valid_from = Time.zone.now.beginning_of_year
self.valid_from = Time.zone.now.beginning_of_year unless valid_from
end
def name
"#{operation_category} #{category}"
end
class << self
def pricelist_for(zone, operation, period)
lists = valid.where(category: zone, operation_category: operation, duration: period)
return lists.first if lists.count == 1
lists.where('valid_to IS NOT NULL').order(valid_from: :desc).first
end
end
end

View file

@ -12,6 +12,8 @@ class Registrar < ActiveRecord::Base
has_many :priv_contacts, -> { privs }, class_name: 'Contact'
has_many :white_ips, dependent: :destroy
delegate :balance, to: :cash_account
validates :name, :reg_no, :country_code, :email, :code, presence: true
validates :name, :reg_no, :reference_no, :code, uniqueness: true
validate :forbidden_codes
@ -64,42 +66,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,11 +117,23 @@ class Registrar < ActiveRecord::Base
]
)
end
# rubocop:enable Metrics/MethodLength
def cash_account
accounts.find_by(account_type: Account::CASH)
end
def debit!(args)
args[:sum] *= -1
args[:currency] = 'EUR'
cash_account.account_activities.create!(args)
end
def credit!(args)
args[:currency] = 'EUR'
cash_account.account_activities.create!(args)
end
def domain_transfers
at = DomainTransfer.arel_table
DomainTransfer.where(
@ -153,10 +160,12 @@ class Registrar < ActiveRecord::Base
end
def api_ip_white?(ip)
return true unless Setting.api_ip_whitelist_enabled
white_ips.api.pluck(:ipv4, :ipv6).flatten.include?(ip) || global_ip_white?(ip)
end
def registrar_ip_white?(ip)
return true unless Setting.registrar_ip_whitelist_enabled
white_ips.registrar.pluck(:ipv4, :ipv6).flatten.include?(ip) || global_ip_white?(ip)
end

View file

@ -1,3 +1,9 @@
class ReservedDomain < ActiveRecord::Base
include Versions # version/reserved_domain_version.rb
class << self
def pw_for(domain_name)
select("names -> '#{domain_name}' AS pw").first.try(:pw)
end
end
end

View file

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

View file

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

View file

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

View file

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

View file

@ -2,8 +2,8 @@ class DomainNameValidator < ActiveModel::EachValidator
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_reservation(value)
record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :reserved)))
elsif !self.class.validate_blocked(value)
record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :blocked)))
end
end
@ -31,9 +31,9 @@ class DomainNameValidator < ActiveModel::EachValidator
# rubocop: enable Style/DoubleNegation
end
def validate_reservation(value)
def validate_blocked(value)
return true unless value
!ReservedDomain.exists?(name: value.mb_chars.downcase.strip)
BlockedDomain.where("names @> ?::varchar[]", "{#{value}}").count == 0
end
end
end

View file

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

View file

@ -1,4 +1,4 @@
= form_for([:admin, @admin_user], html: { class: 'form-horizontal' }) do |f|
= form_for([:admin, @admin_user], html: { class: 'form-horizontal', autocomplete: 'off' }) do |f|
= render 'shared/full_errors', object: @admin_user
.row
@ -14,12 +14,12 @@
- not_required = @admin_user.new_record? ? '' : 'not-required'
= f.label :password, class: not_required
.col-md-8
= f.password_field(:password, class: 'form-control')
= f.text_field(:password, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :password_confirmation, class: not_required
.col-md-8
= f.password_field(:password_confirmation, class: 'form-control')
= f.text_field(:password_confirmation, class: 'form-control')
%hr
.form-group
@ -36,7 +36,7 @@
.col-md-4.control-label
= f.label :country_code, t(:country)
.col-md-8
= f.select(:country_code,
= f.select(:country_code,
SortedCountry.all_options(f.object.country_code), {}, class: 'form-control')
%hr
.form-group
@ -48,7 +48,7 @@
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary')
= button_tag(t(:save), class: 'btn btn-warning')
:coffee
$("#admin_user_password").removeAttr('required')

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,15 @@
- content_for :actions do
= link_to(t(:back_to_invoice), admin_invoice_path(@invoice), class: 'btn btn-default')
= render 'shared/title', name: t(:forward_invoice)
= form_for([:admin, @invoice], url: { action: :forward }, method: :post) do |f|
.row
.col-md-4.col-md-offset-4
= render 'shared/full_errors', object: @invoice
.form-group
= f.label :billing_email
= f.text_field :billing_email, class: 'form-control', autocomplete: 'off'
.row
.col-md-12.text-right
= button_tag(t(:forward), class: 'btn btn-warning')

View file

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

View file

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

View file

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

View file

@ -29,5 +29,7 @@
%hr
.row
.col-md-12.text-right
= button_tag(t(:save), class: 'btn btn-primary')
= button_tag(t(:save), class: 'btn btn-warning')
- if !f.object.new_record? && can?(:delete, f.object)
= link_to t(:delete), admin_pricelist_path(f.object),
method: :delete, data: { confirm: t(:are_you_sure_destroy) }, class: 'btn btn-danger'

View file

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

View file

@ -21,6 +21,7 @@
= render 'setting_row', var: :dnskeys_max_count
= render 'setting_row', var: :ns_min_count
= render 'setting_row', var: :ns_max_count
= render 'setting_row', var: :expire_pending_confirmation
.panel.panel-default
.panel-heading.clearfix
@ -36,24 +37,6 @@
= render 'setting_row', var: :expire_warning_period
= render 'setting_row', var: :redemption_grace_period
.panel.panel-default
.panel-heading.clearfix
= t(:billing)
.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: :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
.panel.panel-default
.panel-heading.clearfix
= t(:other)
@ -67,6 +50,51 @@
= 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
.panel.panel-default
.panel-heading.clearfix
= t(:billing_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: :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
.row
.col-md-12.text-right
%button.btn.btn-primary=t(:save)

View file

@ -4,7 +4,7 @@ Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veen
<br><br>
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
<br><br>
Taotlus on aktiivne <48> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.<br>
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.<br>
<%= link_to @verification_url, @verification_url %>
<br><br>
Lugupidamisega<br>
@ -19,7 +19,7 @@ Application for deletion of your domain <%= @domain.name %> has been filed. Plea
To confirm the update please visit this website, once again review the data and press approve:<br>
<%= link_to @verification_url, @verification_url %>
<br><br>
The application will remain in pending status for <48> hrs and will be automaticcally rejected if it is not approved nor rejected before.
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -4,7 +4,7 @@ Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veen
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
Taotlus on aktiivne <48> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.
<%= link_to @verification_url, @verification_url %>
Lugupidamisega
@ -19,7 +19,7 @@ Application for deletion of your domain <%= @domain.name %> has been filed. Plea
To confirm the update please visit this website, once again review the data and press approve:
<%= link_to @verification_url, @verification_url %>
The application will remain in pending status for <48> hrs and will be automaticcally rejected if it is not approved nor rejected before.
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.
Best Regards,
Estonian Internet Foundation

View file

@ -13,7 +13,9 @@ Tänav: <%= @domain.registrant_street %><br>
Linn: <%= @domain.registrant_city %><br>
Riik: <%= @domain.registrant_country %>
<br><br>
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.<br>
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:<br>
<%= link_to @verification_url, @verification_url %>
<br><br>
Lugupidamisega<br>
@ -36,6 +38,7 @@ Street: <%= @domain.registrant_street %><br>
City: <%= @domain.registrant_city %><br>
Country: <%= @domain.registrant_country %>
<br><br>
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.<br>
To confirm the update please visit this website, once again review the data and press approve:<br>
<%= link_to @verification_url, @verification_url %>
<br><br>

View file

@ -13,6 +13,7 @@ Tänav: <%= @domain.registrant_street %>
Linn: <%= @domain.registrant_city %>
Riik: <%= @domain.registrant_country %>
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
<%= @verification_url %>
@ -36,6 +37,7 @@ Street: <%= @domain.registrant_street %>
City: <%= @domain.registrant_city %>
Country: <%= @domain.registrant_country %>
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.
To confirm the update please visit this website, once again review the data and press approve:
<%= @verification_url %>

View file

@ -0,0 +1,39 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
<br><br>
Uued registreerija andmed:<br>
Nimi: <%= @domain.registrant_name %><br>
<% if @domain.registrant.priv? %>
Isikukood: <%= @domain.registrant_ident %><br>
<% else %>
Äriregistrikood: <%= @domain.registrant_ident %><br>
<% end %>
Epost: <%= @domain.registrant_email %><br>
Tänav: <%= @domain.registrant_street %><br>
Linn: <%= @domain.registrant_city %><br>
Riik: <%= @domain.registrant_country %>
<br><br>
Lugupidamisega<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
<br><br>
New registrant:<br>
Name: <%= @domain.registrant_name %><br>
<% if @domain.registrant.priv? %>
Personal code: <%= @domain.registrant_ident %><br>
<% else %>
Business Registry code: <%= @domain.registrant_ident %><br>
<% end %>
E-mail: <%= @domain.registrant_email %><br>
Street: <%= @domain.registrant_street %><br>
City: <%= @domain.registrant_city %><br>
Country: <%= @domain.registrant_country %>
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,39 @@
Tere,
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
Uued registreerija andmed:
Nimi: <%= @domain.registrant_name %>
<% if @domain.registrant.priv? %>
Isikukood: <%= @domain.registrant_ident %>
<% else %>
Äriregistrikood: <%= @domain.registrant_ident %>
<% end %>
Epost: <%= @domain.registrant_email %>
Tänav: <%= @domain.registrant_street %>
Linn: <%= @domain.registrant_city %>
Riik: <%= @domain.registrant_country %>
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
New registrant:
Name: <%= @domain.registrant_name %>
<% if @domain.registrant.priv? %>
Personal code: <%= @domain.registrant_ident %>
<% else %>
Business Registry code: <%= @domain.registrant_ident %>
<% end %>
E-mail: <%= @domain.registrant_email %>
Street: <%= @domain.registrant_street %>
City: <%= @domain.registrant_city %>
Country: <%= @domain.registrant_country %>
Best Regards,
Estonian Internet Foundation

View file

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

View file

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

View file

@ -59,9 +59,8 @@
%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(:reserved_domains), admin_reserved_domains_path
-# %li= link_to t(:domains_history), admin_domain_versions_path
%li= link_to t(:epp_logs), admin_epp_logs_path
%li= link_to t(:repp_logs), admin_repp_logs_path

View file

@ -1,29 +1,67 @@
- content_for :actions do
= link_to(t(:back_to_billing), registrar_invoices_path, class: 'btn btn-default')
= link_to(t(:export_csv), url_for(params.merge(format: 'csv')), class: 'btn btn-default')
= render 'shared/title', name: t(:account_activity)
.row
.col-md-12
= search_form_for @q, url: [:registrar, :account_activities], html: { style: 'margin-bottom: 0;' } do |f|
.row
.col-md-6
.form-group
= f.label t(:activity_type)
= f.select :activity_type_in, AccountActivity.types_for_select, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true
.col-md-6
.form-group
= f.label t(:description)
= f.search_field :description_cont, class: 'form-control', placeholder: t(:description), autocomplete: 'off'
.row
.col-md-3
.form-group
= f.label t(:receipt_date_from)
= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control datepicker', placeholder: t(:receipt_date_from), autocomplete: 'off'
.col-md-3
.form-group
= f.label t(:receipt_date_until)
= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control datepicker', placeholder: t(:receipt_date_until), autocomplete: 'off'
.col-md-6{style: 'padding-top: 25px;'}
%button.btn.btn-default
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-condensed
%thead
%tr
%th{class: 'col-xs-5'}= t(:description)
%th{class: 'col-xs-3'}= t(:receipt_date)
%th{class: 'col-xs-2'}= t(:invoice)
%th{class: 'col-xs-2'}= t(:sum)
%th{class: 'col-xs-5'}
= sort_link(@q, 'description')
%th{class: 'col-xs-2'}
= sort_link(@q, 'activity_type')
%th{class: 'col-xs-3'}
= sort_link(@q, 'created_at', t(:receipt_date))
%th{class: 'col-xs-2'}
= sort_link(@q, 'sum')
%tbody
- @account_activities.each do |x|
%tr
%td= x.description.present? ? x.description : '-'
%td= x.activity_type ? t(x.activity_type) : ''
%td= l(x.created_at)
- if x.invoice
%td= link_to(x.invoice, [:registrar, x.invoice])
- else
%td \-
- c = x.sum > 0.0 ? 'text-success' : 'text-danger'
- s = x.sum > 0.0 ? "+#{x.sum} #{x.currency}" : "#{x.sum} #{x.currency}"
%td{class: c}= s
.row
.col-md-12
= paginate @account_activities
:coffee
$(".js-reset-form").on "click", (e) ->
e.preventDefault();
window.location = "#{registrar_account_activities_path}"

View file

@ -5,7 +5,7 @@
= label_tag :domain_name, t(:name), class: 'required'
.col-md-7
- readonly = params[:domain_name] ? true : false
= text_field_tag('domain[name]', @domain_params[:name],
= text_field_tag('domain[name]', @domain_params[:name],
class: 'form-control', readonly: readonly, required: true)
- unless params[:domain_name]
@ -13,13 +13,20 @@
.col-md-3.control-label
= label_tag :domain_period, t(:period), class: 'required'
.col-md-7
= select_tag 'domain[period]',
= select_tag 'domain[period]',
options_for_select(Depp::Domain::PERIODS, @domain_params[:period]), { class: 'form-control' }
.form-group
.col-md-3.control-label
= label_tag :domain_registrant, t(:registrant), class: 'required'
.col-md-7
= select_tag "domain[registrant]",
= select_tag "domain[registrant]",
options_for_select(@contacts_autocomplete_map, selected: @domain_params[:registrant]),
include_blank: true, class: 'js-combobox', required: true
- unless params[:domain_name]
.form-group
.col-md-3.control-label
= label_tag :domain_reserved_pw, t(:reserved_pw)
.col-md-7
= text_field_tag('domain[reserved_pw]', @domain_params[:reserved_pw], class: 'form-control')

View file

@ -22,6 +22,6 @@
= file_field_tag 'legal_document'
.form-group
.col-md-10.text-right
%button.btn.btn-warning{ name: 'query' }= t(:transfer)
%button.btn.btn-warning{ name: 'request' }= t(:transfer)
/%button.btn.btn-warning{ name: 'approve' }= t(:approve)
/%button.btn.btn-warning{ name: 'reject' }= t(:reject)

View file

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

View file

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

View file

@ -31,8 +31,6 @@ bundle install
RAILS_ENV=test bundle exec rake db:all:drop
RAILS_ENV=test bundle exec rake db:all:setup
RAILS_ENV=test bundle exec rake zonefile:replace_procedure
RAILS_ENV=test bundle exec rake assets:precompile
echo "GIT_LAST_COMMITS"
git log --pretty='%s (%cn, %cr)' --abbrev-commit --graph --decorate -n 20 --no-color
@ -44,7 +42,7 @@ RCODE=$?
echo "END_OF_RUBOCOP_RESULTS"
echo "TEST_RESULTS"
# basic test
# basic tests without EPP
# ROBOT=true bundle exec rake
# all tests with EPP

View file

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

View file

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

7
config/daemons.yml Normal file
View file

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

View file

@ -16,6 +16,7 @@ set :deploy_to, '$HOME/registry'
set :repository, 'https://github.com/domify/registry' # dev repo
set :branch, 'master'
set :rails_env, 'alpha'
set :que_restart, true
# alpha branch, only use for heavy debugging
task :epp do
@ -24,6 +25,7 @@ task :epp do
set :repository, 'https://github.com/domify/registry' # dev repo
set :branch, 'master'
set :rails_env, 'alpha'
set :que_restart, false
end
# alpha branch, only use for heavy debugging
@ -33,6 +35,7 @@ task :registrar do
set :repository, 'https://github.com/domify/registry' # dev repo
set :branch, 'master'
set :rails_env, 'alpha'
set :que_restart, false
end
# alpha branch, only use for heavy debugging
@ -42,6 +45,7 @@ task :registrant do
set :repository, 'https://github.com/domify/registry' # dev repo
set :branch, 'master'
set :rails_env, 'alpha'
set :que_restart, false
end
# staging
@ -51,6 +55,7 @@ task :st do
set :repository, 'https://github.com/internetee/registry' # production repo
set :branch, 'staging'
set :rails_env, 'staging'
set :que_restart, true
end
# staging
@ -60,6 +65,7 @@ task :eppst do
set :repository, 'https://github.com/internetee/registry' # production repo
set :branch, 'staging'
set :rails_env, 'staging'
set :que_restart, false
end
# staging
@ -69,6 +75,7 @@ task :registrarst do
set :repository, 'https://github.com/internetee/registry' # production repo
set :branch, 'staging'
set :rails_env, 'staging'
set :que_restart, false
end
# staging
@ -78,6 +85,7 @@ task :registrantst do
set :repository, 'https://github.com/internetee/registry' # production repo
set :branch, 'staging'
set :rails_env, 'staging'
set :que_restart, false
end
# production
@ -87,6 +95,7 @@ task :pr do
set :repository, 'https://github.com/internetee/registry' # production repo
set :branch, 'master'
set :rails_env, 'production'
set :que_restart, true
end
# production
@ -96,6 +105,7 @@ task :epppr do
set :repository, 'https://github.com/internetee/registry' # production repo
set :branch, 'master'
set :rails_env, 'production'
set :que_restart, false
end
# production
@ -105,6 +115,7 @@ task :registrarpr do
set :repository, 'https://github.com/internetee/registry' # production repo
set :branch, 'master'
set :rails_env, 'production'
set :que_restart, false
end
# production
@ -114,6 +125,7 @@ task :registrantpr do
set :repository, 'https://github.com/internetee/registry' # production repo
set :branch, 'master'
set :rails_env, 'production'
set :que_restart, false
end
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
@ -193,6 +205,7 @@ task deploy: :environment do
to :launch do
invoke :restart
invoke :'deploy:cleanup'
queue! "QUE_WORKER_COUNT=1 #{rake} daemon:que:restart" if que_restart
end
end
end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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