# HG changeset patch # User Pascal Volk # Date 1208222914 0 # Node ID fe9be0081e5f9e20ad30fa18d2dd3fcec6cb3acc # Parent 3388b96fd3ed27e1ccbaf6d2b090fd0d2a07e359 * 'VirtualMailManager/VirtualMailManager.py' - implemented VirtualMailManager.user_transport() * 'vmm' * 'VirtualMailManager/Account.py' - Added code to modify user's transport diff -r 3388b96fd3ed -r fe9be0081e5f ChangeLog --- a/ChangeLog Mon Apr 14 02:21:46 2008 +0000 +++ b/ChangeLog Tue Apr 15 01:28:34 2008 +0000 @@ -1,4 +1,11 @@ === 0.0.0 === +2008-04-15 Pascal Volk + + * VirtualMailManager/Account.py (Account.modify()): + * vmm (main): Added code for modify user's transport + * VirtualMailManager/VirtualMailManager.py: Implemented + VirtualMailManager.user_transport() + 2008-04-14 Pascal Volk * VirtualMailManager/VirtualMailManager.py: Implemented: diff -r 3388b96fd3ed -r fe9be0081e5f VirtualMailManager/Account.py --- a/VirtualMailManager/Account.py Mon Apr 14 02:21:46 2008 +0000 +++ b/VirtualMailManager/Account.py Tue Apr 15 01:28:34 2008 +0000 @@ -120,7 +120,7 @@ dbc = self._dbh.cursor() dbc.execute("""INSERT INTO users (local_part, passwd, uid, gid,\ mid, tid) VALUES (%s, %s, %s, %s, %s, %s)""", self._localpart, self._passwd, - self._uid, self._gid, self._mid, self._tid ) + self._uid, self._gid, self._mid, self._tid) self._dbh.commit() dbc.close() else: @@ -131,12 +131,16 @@ if self._uid == 0: raise VMMAccountException(("Account doesn't exists", ERR.NO_SUCH_ACCOUNT)) - if what not in ['name', 'password']: + if what not in ['name', 'password', 'transport']: return False dbc = self._dbh.cursor() if what == 'password': dbc.execute("UPDATE users SET passwd=%s WHERE local_part=%s AND\ gid=%s", value, self._localpart, self._gid) + elif what == 'transport': + self._tid = Transport(self._dbh, transport=value).getID() + dbc.execute("UPDATE users SET tid=%s WHERE local_part=%s AND\ + gid=%s", self._tid, self._localpart, self._gid) else: dbc.execute("UPDATE users SET name=%s WHERE local_part=%s AND\ gid=%s", value, self._localpart, self._gid) diff -r 3388b96fd3ed -r fe9be0081e5f VirtualMailManager/VirtualMailManager.py --- a/VirtualMailManager/VirtualMailManager.py Mon Apr 14 02:21:46 2008 +0000 +++ b/VirtualMailManager/VirtualMailManager.py Tue Apr 15 01:28:34 2008 +0000 @@ -492,6 +492,10 @@ acc = self.__getAccount(emailaddress) acc.modify('name', name) + def user_transport(self, emailaddress, transport): + acc = self.__getAccount(emailaddress) + acc.modify('transport', transport) + def user_disable(self, emailaddress): acc = self.__getAccount(emailaddress) acc.disable() diff -r 3388b96fd3ed -r fe9be0081e5f vmm --- a/vmm Mon Apr 14 02:21:46 2008 +0000 +++ b/vmm Tue Apr 15 01:28:34 2008 +0000 @@ -192,6 +192,15 @@ else: vmm.user_name(sys.argv[2].lower(), sys.argv[3]) +def user_transport(): + global argc + if argc < 3: + usage(EXIT.MISSING_ARGS, 'Missing e-mail address and transport.') + if argc <4: + usage(EXIT.MISSING_ARGS, 'Missing transport.') + else: + vmm.user_transport(sys.argv[2].lower(), sys.argv[3]) + def user_enable(): global argc if argc < 3: @@ -277,6 +286,8 @@ user_name() elif sys.argv[1] in ['up', 'userpassword']: user_password() + elif sys.argv[1] in ['ut', 'usertransport']: + user_transport() elif sys.argv[1] in ['u0', 'userdisable']: user_disable() elif sys.argv[1] in ['u1', 'userenable']: