mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 19:48:28 +02:00
Merge remote-tracking branch 'origin/master' into 104525318-history_import
# Conflicts: # Gemfile # app/models/domain.rb
This commit is contained in:
commit
34dd6af4f7
135 changed files with 4123 additions and 814 deletions
|
@ -123,6 +123,7 @@ class Epp::Contact < Contact
|
|||
[:email, :invalid],
|
||||
[:ident, :invalid],
|
||||
[:ident, :invalid_EE_identity_format],
|
||||
[:ident, :invalid_EE_identity_format_update],
|
||||
[:ident, :invalid_birthday_format],
|
||||
[:ident, :invalid_country_code],
|
||||
[:ident_type, :missing],
|
||||
|
@ -160,20 +161,20 @@ class Epp::Contact < Contact
|
|||
self.ident_updated_at ||= Time.zone.now # not in use
|
||||
ident_frame = frame.css('ident').first
|
||||
|
||||
if ident_frame && ident_attr_valid?(ident_frame) && ident_country_code.blank? && ident_type.in?(%w(org priv).freeze)
|
||||
at.merge!(ident_country_code: ident_frame.attr('cc'))
|
||||
if ident_frame && ident_attr_valid?(ident_frame)
|
||||
org_priv = %w(org priv).freeze
|
||||
if ident_country_code.blank? && org_priv.include?(ident_type) && org_priv.include?(ident_frame.attr('type'))
|
||||
at.merge!(ident_country_code: ident_frame.attr('cc'), ident_type: ident_frame.attr('type'))
|
||||
elsif ident_type == "birthday" && !ident[/\A\d{4}-\d{2}-\d{2}\z/] && (Date.parse(ident) rescue false)
|
||||
at.merge!(ident: ident_frame.text)
|
||||
at.merge!(ident_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present?
|
||||
elsif ident_type.blank? && ident_country_code.blank?
|
||||
at.merge!(ident_type: ident_frame.attr('type'))
|
||||
at.merge!(ident_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present?
|
||||
else
|
||||
throw :epp_error, {code: '2306', msg: I18n.t(:ident_update_error)}
|
||||
end
|
||||
end
|
||||
|
||||
# Deprecated
|
||||
# if ident_updated_at.present?
|
||||
# throw :epp_error, {
|
||||
# code: '2306',
|
||||
# msg: I18n.t(:ident_update_error)
|
||||
# }
|
||||
# else
|
||||
# at.merge!(self.class.ident_attrs(frame.css('ident').first))
|
||||
# self.ident_updated_at = Time.zone.now
|
||||
# end
|
||||
end
|
||||
|
||||
super(at)
|
||||
|
|
|
@ -3,10 +3,12 @@ class Epp::Domain < Domain
|
|||
include EppErrors
|
||||
|
||||
# TODO: remove this spagetti once data in production is correct.
|
||||
attr_accessor :is_renewal
|
||||
attr_accessor :is_renewal, :is_transfer
|
||||
|
||||
before_validation :manage_permissions
|
||||
def manage_permissions
|
||||
return if is_admin # this bad hack for 109086524, refactor later
|
||||
return true if is_transfer || is_renewal
|
||||
return unless update_prohibited? || delete_prohibited?
|
||||
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
|
||||
false
|
||||
|
@ -14,7 +16,7 @@ class Epp::Domain < Domain
|
|||
|
||||
after_validation :validate_contacts
|
||||
def validate_contacts
|
||||
return true if is_renewal
|
||||
return true if is_renewal || is_transfer
|
||||
|
||||
ok = true
|
||||
active_admins = admin_domain_contacts.select { |x| !x.marked_for_destruction? }
|
||||
|
@ -486,6 +488,15 @@ class Epp::Domain < Domain
|
|||
|
||||
# at[:statuses] += at_add[:domain_statuses_attributes]
|
||||
|
||||
if registrant_id && registrant.code == frame.css('registrant')
|
||||
|
||||
throw :epp_error, {
|
||||
code: '2305',
|
||||
msg: I18n.t(:contact_already_associated_with_the_domain)
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
if errors.empty? && verify &&
|
||||
Setting.request_confrimation_on_registrant_change_enabled &&
|
||||
frame.css('registrant').present? &&
|
||||
|
@ -500,20 +511,22 @@ class Epp::Domain < Domain
|
|||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
|
||||
def apply_pending_update!
|
||||
old_registrant_email = DomainMailer.registrant_updated_notification_for_old_registrant(id, deliver_emails)
|
||||
preclean_pendings
|
||||
user = ApiUser.find(pending_json['current_user_id'])
|
||||
frame = Nokogiri::XML(pending_json['frame'])
|
||||
statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||
yield(self) if block_given? # need to skip statuses check here
|
||||
self.save
|
||||
|
||||
self.deliver_emails = true # turn on email delivery
|
||||
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
||||
|
||||
send_mail :registrant_updated_notification_for_old_registrant
|
||||
return unless update(frame, user, false)
|
||||
clean_pendings!
|
||||
self.deliver_emails = true # turn on email delivery
|
||||
DomainMailer.registrant_updated_notification_for_new_registrant(id, deliver_emails).deliver
|
||||
old_registrant_email.deliver
|
||||
|
||||
send_mail :registrant_updated_notification_for_new_registrant
|
||||
WhoisRecord.find_by(domain_id: id).save # need to reload model
|
||||
|
||||
save! # for notification if everything fails
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -586,6 +599,7 @@ class Epp::Domain < Domain
|
|||
|
||||
statuses.delete(DomainStatus::SERVER_HOLD)
|
||||
statuses.delete(DomainStatus::EXPIRED)
|
||||
statuses.delete(DomainStatus::SERVER_UPDATE_PROHIBITED)
|
||||
|
||||
save
|
||||
end
|
||||
|
@ -594,6 +608,8 @@ class Epp::Domain < Domain
|
|||
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
def transfer(frame, action, current_user)
|
||||
@is_transfer = true
|
||||
|
||||
case action
|
||||
when 'query'
|
||||
return domain_transfers.last if domain_transfers.any?
|
||||
|
@ -621,6 +637,7 @@ class Epp::Domain < Domain
|
|||
oc.registrar_id = registrar_id
|
||||
oc.copy_from_id = c.id
|
||||
oc.prefix_code
|
||||
oc.domain_transfer = true
|
||||
oc.save!(validate: false)
|
||||
oc
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue