Merge branch 'master' of github.com:internetee/registry

Conflicts:
	app/models/domain.rb
	app/models/epp/epp_domain.rb
	config/locales/en.yml
	spec/epp/domain_spec.rb
This commit is contained in:
Martin Lensment 2014-10-13 10:37:26 +03:00
commit ee2d93128c
50 changed files with 528 additions and 201 deletions

View file

@ -20,6 +20,7 @@ module Epp::ContactsHelper
end
end
# rubocop:disable Metrics/CyclomaticComplexity
def delete_contact
@contact = find_contact
handle_errors(@contact) and return unless owner?
@ -28,6 +29,7 @@ module Epp::ContactsHelper
render '/epp/contacts/delete'
end
# rubocop:enable Metrics/CyclomaticComplexity
def check_contact
ph = params_hash['epp']['command']['check']['check']
@ -54,11 +56,11 @@ module Epp::ContactsHelper
## CREATE
def validate_contact_create_request
@ph = params_hash['epp']['command']['create']['create']
xml_attrs_present?(@ph, [ %w(authInfo pw), %w(postalInfo)])
xml_attrs_present?(@ph, [%w(authInfo pw), %w(postalInfo)])
return epp_errors.empty? unless @ph['postalInfo'].is_a?(Hash) || @ph['postalInfo'].is_a?(Array)
#(epp_errors << Address.validate_postal_info_types(parsed_frame)).flatten!
# (epp_errors << Address.validate_postal_info_types(parsed_frame)).flatten!
xml_attrs_array_present?(@ph['postalInfo'], [%w(name), %w(addr city), %w(addr cc)])
end
@ -114,7 +116,7 @@ module Epp::ContactsHelper
def owner?
return false unless find_contact
#return true if current_epp_user.registrar == find_contact.created_by.try(:registrar)
# return true if current_epp_user.registrar == find_contact.created_by.try(:registrar)
return true if @contact.registrar == current_epp_user.registrar
epp_errors << { code: '2201', msg: t('errors.messages.epp_authorization_error') }
false

View file

@ -8,12 +8,12 @@ module Epp::DomainsHelper
if @domain.errors.any?
handle_errors(@domain)
raise ActiveRecord::Rollback and return
fail ActiveRecord::Rollback and return
end
unless @domain.save
handle_errors(@domain)
raise ActiveRecord::Rollback and return
fail ActiveRecord::Rollback and return
end
render '/epp/domains/create'
@ -44,6 +44,7 @@ module Epp::DomainsHelper
render '/epp/domains/info'
end
# rubocop:disable Metrics/CyclomaticComplexity
def update_domain
Epp::EppDomain.transaction do
@domain = find_domain
@ -58,17 +59,18 @@ module Epp::DomainsHelper
if @domain.errors.any?
handle_errors(@domain)
raise ActiveRecord::Rollback and return
fail ActiveRecord::Rollback and return
end
unless @domain.save
handle_errors(@domain)
raise ActiveRecord::Rollback and return
fail ActiveRecord::Rollback and return
end
render '/epp/domains/success'
end
end
# rubocop:enable Metrics/CyclomaticComplexity
def transfer_domain
@domain = find_domain(secure: false)
@ -79,6 +81,7 @@ module Epp::DomainsHelper
render '/epp/domains/transfer'
end
# rubocop:disable Metrics/CyclomaticComplexity
def delete_domain
@domain = find_domain
@ -88,6 +91,7 @@ module Epp::DomainsHelper
render '/epp/domains/success'
end
# rubocop:enbale Metrics/CyclomaticComplexity
### HELPER METHODS ###
@ -166,12 +170,20 @@ module Epp::DomainsHelper
domain = Epp::EppDomain.find_by(name: @ph[:name])
unless domain
epp_errors << { code: '2303', msg: I18n.t('errors.messages.epp_domain_not_found'), value: { obj: 'name', val: @ph[:name] } }
epp_errors << {
code: '2303',
msg: I18n.t('errors.messages.epp_domain_not_found'),
value: { obj: 'name', val: @ph[:name] }
}
return nil
end
if domain.registrar != current_epp_user.registrar && secure[:secure] == true
epp_errors << { code: '2302', msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'), value: { obj: 'name', val: @ph[:name] } }
epp_errors << {
code: '2302',
msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'),
value: { obj: 'name', val: @ph[:name] }
}
return nil
end