Merge pull request #1846 from internetee/1818-block-bulk-changes-on-update-prohibited

Add check if UpdateProhibited to nameserver bulk update
This commit is contained in:
Timo Võhmar 2021-02-23 17:01:56 +02:00 committed by GitHub
commit 02ec43a1dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 2 deletions

View file

@ -31,7 +31,9 @@ module Concerns::Domain::Transferable
DomainStatus::PENDING_TRANSFER,
DomainStatus::FORCE_DELETE,
DomainStatus::SERVER_TRANSFER_PROHIBITED,
DomainStatus::CLIENT_TRANSFER_PROHIBITED
DomainStatus::CLIENT_TRANSFER_PROHIBITED,
DomainStatus::SERVER_UPDATE_PROHIBITED,
DomainStatus::CLIENT_UPDATE_PROHIBITED,
]).empty?
end

View file

@ -153,7 +153,7 @@ class Registrar < ApplicationRecord
puny = origin.domain.name_puny
next unless domains.include?(idn) || domains.include?(puny) || domains.empty?
if origin.domain.nameservers.where(hostname: new_attributes[:hostname]).any?
if domain_not_updatable?(hostname: new_attributes[:hostname], domain: origin.domain)
failed_list << idn
next
end
@ -202,6 +202,10 @@ class Registrar < ApplicationRecord
private
def domain_not_updatable?(hostname:, domain:)
domain.nameservers.where(hostname: hostname).any? || domain.bulk_update_prohibited?
end
def set_defaults
self.language = Setting.default_language unless language
end