mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Honor contacts status on epp request #2477
This commit is contained in:
parent
601592aed1
commit
54db11812b
4 changed files with 59 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue