* 'VirtualMailManager/VirtualMailManager.py'
- implemented VirtualMailManager.user_transport()
* 'vmm'
* 'VirtualMailManager/Account.py'
- Added code to modify user's transport
--- 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 <neverseen@users.sourceforge.net>
+
+ * 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 <neverseen@users.sourceforge.net>
* VirtualMailManager/VirtualMailManager.py: Implemented:
--- 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)
--- 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()
--- 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']: