branch | v0.6.x |
changeset 265 | 3c0173418d5d |
parent 264 | 04fea4d8b900 |
child 266 | e14c345b44a1 |
264:04fea4d8b900 | 265:3c0173418d5d |
---|---|
92 """Switch the state of the Account's services on or off. See |
92 """Switch the state of the Account's services on or off. See |
93 Account.enable()/Account.disable() for more information.""" |
93 Account.enable()/Account.disable() for more information.""" |
94 self._chk_state() |
94 self._chk_state() |
95 if service not in (None, 'all', 'imap', 'pop3', 'sieve', 'smtp'): |
95 if service not in (None, 'all', 'imap', 'pop3', 'sieve', 'smtp'): |
96 raise AErr(_(u"Unknown service: '%s'.") % service, UNKNOWN_SERVICE) |
96 raise AErr(_(u"Unknown service: '%s'.") % service, UNKNOWN_SERVICE) |
97 if dcvers > 0x10100f0: |
97 if dcvers >= 0x10200b2: |
98 sieve_col = 'sieve' |
98 sieve_col = 'sieve' |
99 else: |
99 else: |
100 sieve_col = 'managesieve' |
100 sieve_col = 'managesieve' |
101 if service in ('smtp', 'pop3', 'imap'): |
101 if service in ('smtp', 'pop3', 'imap'): |
102 sql = 'UPDATE users SET %s = %s WHERE uid = %d' % (service, state, |
102 sql = 'UPDATE users SET %s = %s WHERE uid = %d' % (service, state, |
228 if not self._passwd: |
228 if not self._passwd: |
229 raise AErr(_(u"No password set for '%s'.") % self._addr, |
229 raise AErr(_(u"No password set for '%s'.") % self._addr, |
230 ACCOUNT_MISSING_PASSWORD) |
230 ACCOUNT_MISSING_PASSWORD) |
231 assert all(isinstance(service, bool) for service in (smtp, pop3, imap, |
231 assert all(isinstance(service, bool) for service in (smtp, pop3, imap, |
232 sieve)) |
232 sieve)) |
233 if dcvers > 0x10100f0: |
233 if dcvers >= 0x10200b2: |
234 sieve_col = 'sieve' |
234 sieve_col = 'sieve' |
235 else: |
235 else: |
236 sieve_col = 'managesieve' |
236 sieve_col = 'managesieve' |
237 self._prepare(maillocation) |
237 self._prepare(maillocation) |
238 sql = "INSERT INTO users (local_part, passwd, uid, gid, mid, tid,\ |
238 sql = "INSERT INTO users (local_part, passwd, uid, gid, mid, tid,\ |
289 `dcvers` : int |
289 `dcvers` : int |
290 The concatenated major and minor version number from |
290 The concatenated major and minor version number from |
291 `dovecot --version`. |
291 `dovecot --version`. |
292 """ |
292 """ |
293 self._chk_state() |
293 self._chk_state() |
294 if dcvers > 0x10100f0: |
294 if dcvers >= 0x10200b2: |
295 sieve_col = 'sieve' |
295 sieve_col = 'sieve' |
296 else: |
296 else: |
297 sieve_col = 'managesieve' |
297 sieve_col = 'managesieve' |
298 sql = 'SELECT name, uid, gid, mid, tid, smtp, pop3, imap, %s\ |
298 sql = 'SELECT name, uid, gid, mid, tid, smtp, pop3, imap, %s\ |
299 FROM users WHERE uid = %d' % (sieve_col, self._uid) |
299 FROM users WHERE uid = %d' % (sieve_col, self._uid) |