Jan Dittberner
985810317a
- add keywords - add ServiceFacade, SettingsManager, DomainManager - add xmlrpcclient - add xmlrpcserver git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@184 a67ec6bc-e5d5-0310-a910-815c51eb3124
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
#
|
|
# Service facade for gnuviech-admin tool backend
|
|
# (c) 2006 Jan Dittberner <jan@dittberner.info>
|
|
# $Id$
|
|
#
|
|
from SessionManager import *
|
|
from DomainManager import *
|
|
|
|
class ServiceFacade:
|
|
def __init__(self):
|
|
self.sessionManager = SessionManager()
|
|
self.domainManager = DomainManager()
|
|
"""
|
|
This class implements the facade to the services provided by the
|
|
gnuviech admin backend.
|
|
"""
|
|
def login(self, login, password):
|
|
"""
|
|
Logs in the user specified by the given login and password.
|
|
The method creates a session and returns the session id which
|
|
has to be sent back by subsequent requests. If the login is
|
|
invalid the returned id is 0
|
|
"""
|
|
try:
|
|
return self.sessionManager.newSession(login, password)
|
|
except InvalidLoginError, ile:
|
|
return 0
|
|
|
|
def listdomains(self, sessionid):
|
|
"""
|
|
Lists the domains the given session may see.
|
|
"""
|
|
try:
|
|
session = self.sessionManager.getSession(sessionid)
|
|
return self.domainManager.listDomains(session)
|
|
except InvalidSessionError, ise:
|
|
return ""
|