DeleteZone
This commit is contained in:
parent
4545f5472c
commit
22d110d45d
@ -29,14 +29,21 @@ class DNSManager::Client < IPC
|
|||||||
def login(token : String)
|
def login(token : String)
|
||||||
request = DNSManager::Request::Login.new token
|
request = DNSManager::Request::Login.new token
|
||||||
send_now request
|
send_now request
|
||||||
parse_message [ DNSManager::Response::Success ], read
|
parse_message [ Response::Success ], read
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adding a full zone.
|
# Adding a full zone.
|
||||||
def user_zone_add(zone : DNSManager::Storage::Zone)
|
def user_zone_add(zone : DNSManager::Storage::Zone)
|
||||||
request = DNSManager::Request::AddOrUpdateZone.new zone
|
request = DNSManager::Request::AddOrUpdateZone.new zone
|
||||||
send_now request
|
send_now request
|
||||||
parse_message [ DNSManager::Response::Success, DNSManager::Response::InvalidZone ], read
|
parse_message [ Response::Success ], read
|
||||||
|
end
|
||||||
|
|
||||||
|
# Removing a zone.
|
||||||
|
def user_zone_del(domain : String)
|
||||||
|
request = DNSManager::Request::DeleteZone.new domain
|
||||||
|
send_now request
|
||||||
|
parse_message [ Response::Success ], read
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -85,7 +85,7 @@ class Actions
|
|||||||
domains.each do |domain|
|
domains.each do |domain|
|
||||||
begin
|
begin
|
||||||
pp! domain
|
pp! domain
|
||||||
#pp! @dnsmanagerd.user_zone_del domain
|
pp! @dnsmanagerd.user_zone_del domain
|
||||||
rescue e
|
rescue e
|
||||||
puts "error for user_zone_del: #{e.message}"
|
puts "error for user_zone_del: #{e.message}"
|
||||||
end
|
end
|
||||||
|
@ -102,15 +102,19 @@ class DNSManager::Storage
|
|||||||
|
|
||||||
# User must own the domain.
|
# User must own the domain.
|
||||||
unless user_data.domains.includes? domain
|
unless user_data.domains.includes? domain
|
||||||
Baguette::Log.warning "user #{user_id} tries to delete domain #{domain} doesn't own it"
|
Baguette::Log.warning "user #{user_id} tries to delete domain #{domain} but doesn't own it"
|
||||||
return Response::NoOwnership.new
|
return Response::NoOwnership.new
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: remove this domain from the list of user's domains.
|
# Remove this domain from the list of user's domains.
|
||||||
# TODO: remove the related zone.
|
user_data.domains.delete domain
|
||||||
#unless errors = Storage::Zone.is_domain_valid? domain
|
|
||||||
# return Response::InvalidZone.new errors
|
# Update on-disk user data.
|
||||||
#end
|
update_user_data user_data
|
||||||
|
|
||||||
|
# Remove the related zone.
|
||||||
|
zones_by_domain.delete domain
|
||||||
|
|
||||||
Response::Success.new
|
Response::Success.new
|
||||||
rescue e
|
rescue e
|
||||||
Baguette::Log.error "trying to delete a domain #{domain}: #{e}"
|
Baguette::Log.error "trying to delete a domain #{domain}: #{e}"
|
||||||
|
Loading…
Reference in New Issue
Block a user