mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Allow ForceDelete status not to block domain update
This commit is contained in:
parent
d58abdaea1
commit
851a2d6a2a
3 changed files with 14 additions and 8 deletions
|
@ -116,12 +116,15 @@ class Domain < ApplicationRecord
|
|||
|
||||
attr_accessor :is_admin
|
||||
|
||||
validate :check_permissions, :unless => :is_admin
|
||||
def check_permissions
|
||||
return unless force_delete_scheduled?
|
||||
errors.add(:base, I18n.t(:object_status_prohibits_operation))
|
||||
false
|
||||
end
|
||||
# Removed to comply new ForceDelete procedure
|
||||
# at https://github.com/internetee/registry/issues/1428#issuecomment-570561967
|
||||
#
|
||||
# validate :check_permissions, :unless => :is_admin
|
||||
# def check_permissions
|
||||
# return unless force_delete_scheduled?
|
||||
# errors.add(:base, I18n.t(:object_status_prohibits_operation))
|
||||
# false
|
||||
# end
|
||||
|
||||
validates :nameservers, domain_nameserver: {
|
||||
min: -> { Setting.ns_min_count },
|
||||
|
|
|
@ -9,7 +9,8 @@ class Epp::Domain < Domain
|
|||
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?
|
||||
return unless update_prohibited?
|
||||
|
||||
stat = (statuses & (DomainStatus::UPDATE_PROHIBIT_STATES + DomainStatus::DELETE_PROHIBIT_STATES)).first
|
||||
add_epp_error('2304', 'status', stat, I18n.t(:object_status_prohibits_operation))
|
||||
throw(:abort)
|
||||
|
|
|
@ -328,7 +328,9 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
end
|
||||
|
||||
def test_update_domain_allows_remove_of_client_hold
|
||||
@domain.update!(statuses: [DomainStatus::CLIENT_HOLD])
|
||||
@domain.update!(statuses: [DomainStatus::CLIENT_HOLD, DomainStatus::FORCE_DELETE,
|
||||
DomainStatus::SERVER_RENEW_PROHIBITED,
|
||||
DomainStatus::SERVER_TRANSFER_PROHIBITED])
|
||||
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue