mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Prevent domain deleting if status prohibits it
This commit is contained in:
parent
0096968265
commit
b4602e701c
7 changed files with 48 additions and 3 deletions
|
@ -67,7 +67,6 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
def can_be_deleted?
|
||||
(domain_statuses.pluck(:value) & %W(
|
||||
#{DomainStatus::CLIENT_DELETE_PROHIBITED}
|
||||
#{DomainStatus::SERVER_DELETE_PROHIBITED}
|
||||
)).empty?
|
||||
end
|
||||
|
|
|
@ -12,6 +12,9 @@ class Epp::EppDomain < Domain
|
|||
[:name_dirty, :taken, { value: { obj: 'name', val: name_dirty } }],
|
||||
[:name_dirty, :reserved, { value: { obj: 'name', val: name_dirty } }]
|
||||
],
|
||||
'2304' => [
|
||||
[:base, :domain_status_prohibits_operation]
|
||||
],
|
||||
'2306' => [ # Parameter policy error
|
||||
[:owner_contact, :blank],
|
||||
[:admin_contacts, :out_of_range]
|
||||
|
@ -237,6 +240,18 @@ class Epp::EppDomain < Domain
|
|||
add_epp_error('2306', 'curExpDate', cur_exp_date, I18n.t('errors.messages.epp_exp_dates_do_not_match'))
|
||||
end
|
||||
|
||||
### ABILITIES ###
|
||||
def can_be_deleted?
|
||||
begin
|
||||
errors.add(:base, :domain_status_prohibits_operation)
|
||||
return false
|
||||
end if (domain_statuses.pluck(:value) & %W(
|
||||
#{DomainStatus::CLIENT_DELETE_PROHIBITED}
|
||||
)).any?
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
## SHARED
|
||||
|
||||
# For domain transfer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue