Enable to delete user data with CLI.
This commit is contained in:
parent
f8ac920fd9
commit
2c1d9fedab
3 changed files with 30 additions and 1 deletions
|
|
@ -186,6 +186,13 @@ class DNSManager::Client < IPC
|
||||||
send_now request
|
send_now request
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def admin_delete_user_data(user : UInt32)
|
||||||
|
request = Request::DeleteUser.new user
|
||||||
|
send_now request
|
||||||
|
parse_message [ Response::Success ], read
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Utils
|
# Utils
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ class Actions
|
||||||
@the_call["admin-provide-domain"] = ->admin_provide_domain
|
@the_call["admin-provide-domain"] = ->admin_provide_domain
|
||||||
@the_call["admin-exit"] = ->admin_exit
|
@the_call["admin-exit"] = ->admin_exit
|
||||||
|
|
||||||
|
@the_call["admin-delete-user-data"] = ->admin_delete_user_data
|
||||||
|
|
||||||
# Domain operations.
|
# Domain operations.
|
||||||
@the_call["user-domain-add"] = ->user_domain_add
|
@the_call["user-domain-add"] = ->user_domain_add
|
||||||
@the_call["user-domain-del"] = ->user_domain_del
|
@the_call["user-domain-del"] = ->user_domain_del
|
||||||
|
|
@ -159,9 +161,21 @@ class Actions
|
||||||
def admin_exit
|
def admin_exit
|
||||||
@dnsmanagerd.admin_exit
|
@dnsmanagerd.admin_exit
|
||||||
rescue e
|
rescue e
|
||||||
puts "error for provide_domain: #{e.message}"
|
puts "error for admin_exit: #{e.message}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# To purge hackers, mostly.
|
||||||
|
def admin_delete_user_data
|
||||||
|
users = Context.args.not_nil!
|
||||||
|
users.each do |user|
|
||||||
|
puts "purging #{user}"
|
||||||
|
@dnsmanagerd.admin_delete_user_data user.to_u32
|
||||||
|
end
|
||||||
|
rescue e
|
||||||
|
puts "error for admin_delete_user_data: #{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|
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,14 @@ def parsing_cli(authd_config : Baguette::Configuration::Auth)
|
||||||
parser.banner = "COMMAND: exit"
|
parser.banner = "COMMAND: exit"
|
||||||
unrecognized_args_to_context_args.call parser, nil, 0
|
unrecognized_args_to_context_args.call parser, nil, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Purge an account.
|
||||||
|
parser.on("delete-user-data", "Delete user data.") do
|
||||||
|
Baguette::Log.info "purge user data."
|
||||||
|
Context.command = "admin-delete-user-data"
|
||||||
|
parser.banner = "COMMAND: delete-user-data uid [uid ...]"
|
||||||
|
unrecognized_args_to_context_args.call parser, nil, 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# User section.
|
# User section.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue