Remove and create a domain.
This commit is contained in:
parent
04ac548915
commit
5147719ecb
@ -74,7 +74,7 @@ class DNSManager::Client < IPC
|
|||||||
def user_domain_del(domain : String)
|
def user_domain_del(domain : String)
|
||||||
request = Request::DeleteDomain.new domain
|
request = Request::DeleteDomain.new domain
|
||||||
send_now request
|
send_now request
|
||||||
parse_message [ Response::Success ], read
|
parse_message [ Response::DomainDeleted ], read
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get user domain list.
|
# Get user domain list.
|
||||||
@ -109,6 +109,18 @@ class DNSManager::Client < IPC
|
|||||||
parse_message [ Response::GeneratedZone ], read
|
parse_message [ Response::GeneratedZone ], read
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Provide a domain to a user.
|
||||||
|
def provide_domain(login : String, domain : String)
|
||||||
|
request = Request::Migration.new login, domain
|
||||||
|
send_now request
|
||||||
|
parse_message [ Response::DomainAdded,
|
||||||
|
Response::DomainAlreadyExists,
|
||||||
|
Response::InvalidDomainName,
|
||||||
|
Response::UnacceptableDomain,
|
||||||
|
Response::UnknownUser
|
||||||
|
], read
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Resource Record operations
|
# Resource Record operations
|
||||||
#
|
#
|
||||||
|
@ -31,6 +31,7 @@ class Actions
|
|||||||
@the_call["admin-generate-zonefile"] = ->admin_generate_zonefile
|
@the_call["admin-generate-zonefile"] = ->admin_generate_zonefile
|
||||||
@the_call["admin-migration-script"] = ->admin_migration_script
|
@the_call["admin-migration-script"] = ->admin_migration_script
|
||||||
@the_call["admin-generate-all-zonefiles"] = ->admin_generate_all_zonefiles
|
@the_call["admin-generate-all-zonefiles"] = ->admin_generate_all_zonefiles
|
||||||
|
@the_call["admin-provide-domain"] = ->admin_provide_domain
|
||||||
|
|
||||||
# Domain operations.
|
# Domain operations.
|
||||||
@the_call["user-domain-add"] = ->user_domain_add
|
@the_call["user-domain-add"] = ->user_domain_add
|
||||||
@ -147,6 +148,13 @@ class Actions
|
|||||||
puts "error for generate_all_zonefiles: #{e.message}"
|
puts "error for generate_all_zonefiles: #{e.message}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def admin_provide_domain
|
||||||
|
login, domain = Context.args.not_nil!
|
||||||
|
pp! @dnsmanagerd.provide_domain login, domain
|
||||||
|
rescue e
|
||||||
|
puts "error for provide_domain: #{e.message}"
|
||||||
|
end
|
||||||
|
|
||||||
def user_domain_add
|
def user_domain_add
|
||||||
domains = Context.args.not_nil!
|
domains = Context.args.not_nil!
|
||||||
domains.each do |domain|
|
domains.each do |domain|
|
||||||
|
@ -116,6 +116,14 @@ def parsing_cli(authd_config : Baguette::Configuration::Auth)
|
|||||||
unrecognized_args_to_context_args.call parser, 0, nil
|
unrecognized_args_to_context_args.call parser, 0, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Provide a domain to someone.
|
||||||
|
parser.on("provide-domain", "Create a domain for someone.") do
|
||||||
|
Baguette::Log.info "creating a domain for someone."
|
||||||
|
Context.command = "admin-provide-domain"
|
||||||
|
parser.banner = "COMMAND: admin provide-domain <login> <domain>"
|
||||||
|
unrecognized_args_to_context_args.call parser, 2, nil
|
||||||
|
end
|
||||||
|
|
||||||
# Migration script.
|
# Migration script.
|
||||||
parser.on("migration-script", "Migrate domains from dnsmanager v1.") do
|
parser.on("migration-script", "Migrate domains from dnsmanager v1.") do
|
||||||
Baguette::Log.info "migration script, provide domains to users."
|
Baguette::Log.info "migration script, provide domains to users."
|
||||||
|
Loading…
Reference in New Issue
Block a user