ErrorUserNotLogged
parent
ac9fc3b563
commit
f0fdf75251
|
@ -13,6 +13,9 @@ class DNSManager::Request
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
|
user = dnsmanagerd.get_logged_user event
|
||||||
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
|
|
||||||
# This request means serious business.
|
# This request means serious business.
|
||||||
# TODO: check for admin.
|
# TODO: check for admin.
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ class DNSManager::Request
|
||||||
end
|
end
|
||||||
rescue e
|
rescue e
|
||||||
# FIXME: Should those be logged?
|
# FIXME: Should those be logged?
|
||||||
|
Baguette::Log.error "Error: #{e}"
|
||||||
Response::Error.new "unauthorized"
|
Response::Error.new "unauthorized"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class DNSManager::Request
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
raise NotLoggedException.new if user.nil?
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
dnsmanagerd.storage.new_domain user.uid, @domain
|
dnsmanagerd.storage.new_domain user.uid, @domain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -25,7 +25,7 @@ class DNSManager::Request
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
raise NotLoggedException.new if user.nil?
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
dnsmanagerd.storage.add_or_update_zone user.uid, zone
|
dnsmanagerd.storage.add_or_update_zone user.uid, zone
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -39,7 +39,7 @@ class DNSManager::Request
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
raise NotLoggedException.new if user.nil?
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
dnsmanagerd.storage.delete_domain user.uid, @domain
|
dnsmanagerd.storage.delete_domain user.uid, @domain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -53,7 +53,7 @@ class DNSManager::Request
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
raise NotLoggedException.new if user.nil?
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
dnsmanagerd.storage.get_zone user.uid, @domain
|
dnsmanagerd.storage.get_zone user.uid, @domain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -65,7 +65,7 @@ class DNSManager::Request
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
raise NotLoggedException.new if user.nil?
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
dnsmanagerd.storage.user_domains user.uid
|
dnsmanagerd.storage.user_domains user.uid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -80,7 +80,7 @@ class DNSManager::Request
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
raise NotLoggedException.new if user.nil?
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
dnsmanagerd.storage.add_rr user.uid, @domain, @rr
|
dnsmanagerd.storage.add_rr user.uid, @domain, @rr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -95,7 +95,7 @@ class DNSManager::Request
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
raise NotLoggedException.new if user.nil?
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
dnsmanagerd.storage.update_rr user.uid, @domain, @rr
|
dnsmanagerd.storage.update_rr user.uid, @domain, @rr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -110,7 +110,7 @@ class DNSManager::Request
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
raise NotLoggedException.new if user.nil?
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
dnsmanagerd.storage.delete_rr user.uid, @domain, @rrid
|
dnsmanagerd.storage.delete_rr user.uid, @domain, @rrid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,5 +17,11 @@ class DNSManager::Response
|
||||||
def initialize()
|
def initialize()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << ErrorInvalidToken
|
DNSManager.responses << DomainAlreadyExists
|
||||||
|
|
||||||
|
IPC::JSON.message ErrorUserNotLogged, 4 do
|
||||||
|
def initialize()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DNSManager.responses << ErrorUserNotLogged
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue