Maintenance: add a sanity check.
This commit is contained in:
parent
a708d8fc46
commit
0a03977a5e
@ -4,10 +4,14 @@ class DNSManager::Request
|
||||
IPC::JSON.message Maintenance, 7 do
|
||||
enum Subject
|
||||
Verbosity # Change the verbosity of dnsmanagerd.
|
||||
SanityCheck # Perform various verifications, including:
|
||||
# - TODO: debug print and removal of domains not linked to existing users
|
||||
# - TODO: check that at least an admin exists
|
||||
end
|
||||
|
||||
property subject : Subject
|
||||
property value : Int32?
|
||||
property int : Int32? = nil
|
||||
property string : String? = nil
|
||||
|
||||
def initialize(@subject)
|
||||
end
|
||||
@ -21,14 +25,36 @@ class DNSManager::Request
|
||||
|
||||
case @subject
|
||||
when Subject::Verbosity
|
||||
if verbosity = @value
|
||||
if verbosity = @int
|
||||
Baguette::Context.verbosity = verbosity
|
||||
end
|
||||
Response::Success.new
|
||||
when Subject::SanityCheck
|
||||
Baguette::Log.info "TODO: sanity check"
|
||||
Response::Error.new "not implemented"
|
||||
else
|
||||
Response::Error.new "not implemented"
|
||||
end
|
||||
end
|
||||
end
|
||||
DNSManager.requests << Maintenance
|
||||
|
||||
IPC::JSON.message GenerateZoneFile, 100 do
|
||||
property domain : String
|
||||
|
||||
def initialize(@domain)
|
||||
end
|
||||
|
||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||
user = dnsmanagerd.get_logged_user event
|
||||
return Response::ErrorUserNotLogged.new unless user
|
||||
|
||||
return Response::Error.new "unauthorized" unless user.admin
|
||||
# This request means serious business.
|
||||
# TODO: check for admin.
|
||||
|
||||
Response::Error.new "not implemented"
|
||||
end
|
||||
end
|
||||
DNSManager.requests << GenerateZoneFile
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user