mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 08:52:04 +02:00
nameserver replacement: scope only to selected domains
This commit is contained in:
parent
ed7181e060
commit
451e1f79af
4 changed files with 30 additions and 3 deletions
|
@ -141,11 +141,13 @@ class Registrar < ApplicationRecord
|
|||
end
|
||||
|
||||
# Audit log is needed, therefore no raw SQL
|
||||
def replace_nameservers(hostname, new_attributes)
|
||||
def replace_nameservers(hostname, new_attributes, domains)
|
||||
transaction do
|
||||
domain_list = []
|
||||
|
||||
nameservers.where(hostname: hostname).find_each do |original_nameserver|
|
||||
next unless domains.include?(original_nameserver.domain.name_puny) || domains.empty?
|
||||
|
||||
new_nameserver = Nameserver.new
|
||||
new_nameserver.domain = original_nameserver.domain
|
||||
new_nameserver.attributes = new_attributes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue