Slighly change logs.
This commit is contained in:
parent
f0eb1790bf
commit
56706e66f2
@ -260,26 +260,25 @@ class DNSManager::Storage
|
|||||||
Response::DomainDeleted.new domain
|
Response::DomainDeleted.new domain
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get all removed users from `authd`, list all their domains and remove their data from `dnsmanagerd`.
|
||||||
def get_orphan_domains(authd : AuthD::Client, user_id : UserDataID) : IPC::JSON
|
def get_orphan_domains(authd : AuthD::Client, user_id : UserDataID) : IPC::JSON
|
||||||
user_must_be_admin! user_id
|
user_must_be_admin! user_id
|
||||||
|
|
||||||
#Baguette::Log.warning "list all orphan domains (long computation)"
|
Baguette::Log.debug "list all orphan domains (long computation)"
|
||||||
# Get all removed users from `authd`.
|
|
||||||
orphans = [] of String
|
orphans = [] of String
|
||||||
user_data.each do |user|
|
user_data.each do |user|
|
||||||
begin
|
begin
|
||||||
authd.get_user? user.uid
|
authd.get_user? user.uid
|
||||||
rescue e
|
rescue e
|
||||||
#Baguette::Log.warning "no authd info on user #{user.uid}: #{e}"
|
Baguette::Log.warning "no authd info on user #{user.uid}: #{e} (removing this user)"
|
||||||
|
Baguette::Log.debug "user #{user.uid} had #{user.domains.size} domains"
|
||||||
user.domains.each do |domain|
|
user.domains.each do |domain|
|
||||||
orphans << domain
|
orphans << domain
|
||||||
end
|
end
|
||||||
|
|
||||||
#Baguette::Log.warning "Removing #{user.uid}!"
|
|
||||||
wipe_user_data user
|
wipe_user_data user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#Baguette::Log.warning "total: #{orphans.size} orphans"
|
Baguette::Log.debug "total: #{orphans.size} orphans"
|
||||||
|
|
||||||
Response::OrphanDomainList.new orphans
|
Response::OrphanDomainList.new orphans
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user