# # Session manager class for gnuviech-admin tool backend # (c) 2006 Jan Dittberner # $Id$ # import Settings import os class InvalidLoginError(Exception): pass class InvalidSessionError(Exception): pass class Session: def __init__(self, id, login, rights, uid, gid): self.id = id self.login = login self.right = rights self.uid = uid self.gid = gid class SessionManager: def _getSessionFile(self, sessionid): if os.path.exists(Settings.SESSIONDIR) and \ os.path.isdir(Settings.SESSIONDIR): return file(os.path.join(SETTINGS.SESSIONDIR, sessionid)) return None def newSession(self, login, password): raise InvalidLoginError() def getSession(self, sessionid): raise InvalidSessionError() def deleteSession(self, sessionid): self._getSessionFile(sessionid)