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
|
IPC::JSON.message Maintenance, 7 do
|
||||||
enum Subject
|
enum Subject
|
||||||
Verbosity # Change the verbosity of dnsmanagerd.
|
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
|
end
|
||||||
|
|
||||||
property subject : Subject
|
property subject : Subject
|
||||||
property value : Int32?
|
property int : Int32? = nil
|
||||||
|
property string : String? = nil
|
||||||
|
|
||||||
def initialize(@subject)
|
def initialize(@subject)
|
||||||
end
|
end
|
||||||
@ -21,14 +25,36 @@ class DNSManager::Request
|
|||||||
|
|
||||||
case @subject
|
case @subject
|
||||||
when Subject::Verbosity
|
when Subject::Verbosity
|
||||||
if verbosity = @value
|
if verbosity = @int
|
||||||
Baguette::Context.verbosity = verbosity
|
Baguette::Context.verbosity = verbosity
|
||||||
end
|
end
|
||||||
Response::Success.new
|
Response::Success.new
|
||||||
|
when Subject::SanityCheck
|
||||||
|
Baguette::Log.info "TODO: sanity check"
|
||||||
|
Response::Error.new "not implemented"
|
||||||
else
|
else
|
||||||
Response::Error.new "not implemented"
|
Response::Error.new "not implemented"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
DNSManager.requests << Maintenance
|
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
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user