equal
deleted
inserted
replaced
40 self._passwd = password |
40 self._passwd = password |
41 self._setAddr() |
41 self._setAddr() |
42 self._exists() |
42 self._exists() |
43 if self._isAlias(): |
43 if self._isAlias(): |
44 raise VMMAccountException( |
44 raise VMMAccountException( |
45 (_(u'There is already an alias with address »%s«') % address, |
45 (_(u"There is already an alias with address '%s'") % address, |
46 ERR.ALIAS_EXISTS)) |
46 ERR.ALIAS_EXISTS)) |
47 |
47 |
48 def _exists(self): |
48 def _exists(self): |
49 dbc = self._dbh.cursor() |
49 dbc = self._dbh.cursor() |
50 dbc.execute("SELECT uid, mid, tid FROM users \ |
50 dbc.execute("SELECT uid, mid, tid FROM users \ |
72 def _setAddr(self): |
72 def _setAddr(self): |
73 self._localpart, d = self._addr.split('@') |
73 self._localpart, d = self._addr.split('@') |
74 dom = Domain(self._dbh, d) |
74 dom = Domain(self._dbh, d) |
75 self._gid = dom.getID() |
75 self._gid = dom.getID() |
76 if self._gid == 0: |
76 if self._gid == 0: |
77 raise VMMAccountException((_(u"Domain »%s« doesn't exist.") % d, |
77 raise VMMAccountException((_(u"Domain '%s' doesn't exist.") % d, |
78 ERR.NO_SUCH_DOMAIN)) |
78 ERR.NO_SUCH_DOMAIN)) |
79 self._base = dom.getDir() |
79 self._base = dom.getDir() |
80 self._tid = dom.getTransportID() |
80 self._tid = dom.getTransportID() |
81 |
81 |
82 def _setID(self): |
82 def _setID(self): |
91 |
91 |
92 def _switchState(self, state, service): |
92 def _switchState(self, state, service): |
93 if not isinstance(state, bool): |
93 if not isinstance(state, bool): |
94 return False |
94 return False |
95 if not service in ['smtp', 'pop3', 'imap', 'managesieve', 'all', None]: |
95 if not service in ['smtp', 'pop3', 'imap', 'managesieve', 'all', None]: |
96 raise VMMAccountException((_(u"Unknown service »%s«") % service, |
96 raise VMMAccountException((_(u"Unknown service '%s'") % service, |
97 ERR.UNKNOWN_SERVICE)) |
97 ERR.UNKNOWN_SERVICE)) |
98 if self._uid < 1: |
98 if self._uid < 1: |
99 raise VMMAccountException((_("Account doesn't exists"), |
99 raise VMMAccountException((_("Account doesn't exists"), |
100 ERR.NO_SUCH_ACCOUNT)) |
100 ERR.NO_SUCH_ACCOUNT)) |
101 dbc = self._dbh.cursor() |
101 dbc = self._dbh.cursor() |
112 imap = FALSE, managesieve = FALSE WHERE local_part = %s AND gid = %s", |
112 imap = FALSE, managesieve = FALSE WHERE local_part = %s AND gid = %s", |
113 self._localpart, self._gid) |
113 self._localpart, self._gid) |
114 if dbc.rowcount > 0: |
114 if dbc.rowcount > 0: |
115 self._dbh.commit() |
115 self._dbh.commit() |
116 dbc.close() |
116 dbc.close() |
|
117 |
|
118 def setPassword(self, password): |
|
119 self._passwd = password |
117 |
120 |
118 def getUID(self): |
121 def getUID(self): |
119 return self._uid |
122 return self._uid |
120 |
123 |
121 def getGID(self): |
124 def getGID(self): |