Honor contacts status on epp request #2477

This commit is contained in:
Priit Tark 2015-07-22 14:27:24 +03:00
parent 601592aed1
commit 54db11812b
4 changed files with 59 additions and 7 deletions

View file

@ -4,6 +4,13 @@ class Epp::Contact < Contact
# disable STI, there is type column present
self.inheritance_column = :sti_disabled
before_validation :manage_permissions
def manage_permissions
return unless update_prohibited? || delete_prohibited?
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
false
end
class << self
# support legacy search
def find_by_epp_code(code)

View file

@ -9,6 +9,21 @@ class Epp::Domain < Domain
false
end
before_validation :validate_contacts
def validate_contacts
return if contacts.map {|c| c.valid? }.all?
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
false
end
before_save :update_contact_status
def update_contact_status
contacts.each do |c|
next if c.linked?
c.save(validate: false)
end
end
class << self
def new_from_epp(frame, current_user)
domain = Epp::Domain.new