Merge pull request #1462 from internetee/1428-check-status-change-prohibition

Allow ForceDelete status not to block domain update
This commit is contained in:
Timo Võhmar 2020-01-09 14:48:40 +02:00 committed by GitHub
commit 7e90153cd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 8 deletions

View file

@ -116,12 +116,15 @@ class Domain < ApplicationRecord
attr_accessor :is_admin attr_accessor :is_admin
validate :check_permissions, :unless => :is_admin # Removed to comply new ForceDelete procedure
def check_permissions # at https://github.com/internetee/registry/issues/1428#issuecomment-570561967
return unless force_delete_scheduled? #
errors.add(:base, I18n.t(:object_status_prohibits_operation)) # validate :check_permissions, :unless => :is_admin
false # def check_permissions
end # return unless force_delete_scheduled?
# errors.add(:base, I18n.t(:object_status_prohibits_operation))
# false
# end
validates :nameservers, domain_nameserver: { validates :nameservers, domain_nameserver: {
min: -> { Setting.ns_min_count }, min: -> { Setting.ns_min_count },

View file

@ -9,7 +9,8 @@ class Epp::Domain < Domain
def manage_permissions def manage_permissions
return if is_admin # this bad hack for 109086524, refactor later return if is_admin # this bad hack for 109086524, refactor later
return true if is_transfer || is_renewal 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 stat = (statuses & (DomainStatus::UPDATE_PROHIBIT_STATES + DomainStatus::DELETE_PROHIBIT_STATES)).first
add_epp_error('2304', 'status', stat, I18n.t(:object_status_prohibits_operation)) add_epp_error('2304', 'status', stat, I18n.t(:object_status_prohibits_operation))
throw(:abort) throw(:abort)

View file

@ -328,7 +328,9 @@ class EppDomainUpdateBaseTest < EppTestCase
end end
def test_update_domain_allows_remove_of_client_hold 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 request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>