This list is closed, nobody may subscribe to it.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(18) |
Feb
(43) |
Mar
(11) |
Apr
(50) |
May
(10) |
Jun
|
Jul
(39) |
Aug
(30) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(14) |
Feb
(43) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(4) |
Oct
(12) |
Nov
(45) |
Dec
(3) |
| 2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(65) |
May
(2) |
Jun
(19) |
Jul
(6) |
Aug
(19) |
Sep
(23) |
Oct
(11) |
Nov
(21) |
Dec
(16) |
| 2013 |
Jan
(21) |
Feb
(2) |
Mar
(2) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
(4) |
Feb
(34) |
Mar
(10) |
Apr
|
May
|
Jun
(10) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
|
3
|
4
|
5
|
6
(4) |
7
(4) |
|
8
(5) |
9
|
10
(14) |
11
(2) |
12
(2) |
13
|
14
(24) |
|
15
(10) |
16
|
17
|
18
|
19
|
20
|
21
|
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
|
29
|
30
|
|
|
|
|
|
|
From: <nev...@us...> - 2012-04-15 17:59:37
|
details: http://hg.localdomain.org/vmm/rev/a93671970617 changeset: 554:a93671970617 user: martin f. krafft date: Sun Apr 15 19:56:21 2012 +0200 description: man: escape hyphens Hyphens inside words must be spelt \- instead of just -. This patch fixes up the manpages. * * * . diffstat: man/de/man1/vmm.1 | 18 +++++++++--------- man/de/man5/vmm.cfg.5 | 4 ++-- man/man1/vmm.1 | 18 +++++++++--------- man/man5/vmm.cfg.5 | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diffs (190 lines): diff -r 6f2c41c3c7d6 -r a93671970617 man/de/man1/vmm.1 --- a/man/de/man1/vmm.1 Sun Apr 15 19:47:58 2012 +0200 +++ b/man/de/man1/vmm.1 Sun Apr 15 19:56:21 2012 +0200 @@ -21,7 +21,7 @@ .I Unterbefehl gibt es jeweils eine lange und kurze Variante. Die Kurzform ist in Klammern geschrieben. -Bei beiden Formen ist die Groß-/Kleinschreibung zu berücksichtigen. +Bei beiden Formen ist die Groß\-/Kleinschreibung zu berücksichtigen. .PP Die meisten .IR Unterbefehl e @@ -281,7 +281,7 @@ .br Sollte Ihre Dovecot\-Installation nicht zu alt sein, werden zusätzlich die verwendbaren Encoding\-Suffixe ausgegeben. -Eines dieser Suffixe kann an das Passwort-Schema angefügt werden. +Eines dieser Suffixe kann an das Passwort\-Schema angefügt werden. .PP Beispiel: .PP @@ -488,7 +488,7 @@ angegeben, so werden alle kontospezifischen Einstellungen gelöscht und es gelten fortan die Service\-Einstellungen der Domain für alle Konten. Ohne dieses Schlüsselwort gelten die neuen Einstellungen nur für Konten, bei denen -die Service-Einstellungen nicht individuell geändert wurden. +die Service\-Einstellungen nicht individuell geändert wurden. .\" ------------------------------------ .SS domaintransport (dt) .BI "vmm domaintransport" " fqdn transport" @@ -505,7 +505,7 @@ angegeben, so werden alle kontospezifischen Einstellungen gelöscht und es gelten fortan die Transport\-Einstellungen der Domain für alle Konten. Ohne dieses Schlüsselwort gelten die neuen Einstellungen nur für Konten, bei denen -die Transport-Einstellungen nicht individuell geändert wurden. +die Transport\-Einstellungen nicht individuell geändert wurden. .PP Beispiel: .PP @@ -839,7 +839,7 @@ .IR %= durch den ursprünglichen lokalen Teil, die Domain bzw. die Emailadresse mit '=' anstelle von '@' ersetzt. Dies ermöglicht z.B. in Verbindung mit -Alias-Domains domain-spezifische Empfänger. +Alias\-Domains domain\-spezifische Empfänger. .PP Beispiele: .PP @@ -930,7 +930,7 @@ .B vmm relocateddelete b.n...@ex... .fi .\" ----------------------------------------------------------------------- -.SH CATCH-ALL UNTERBEFEHLE +.SH CATCH\-ALL UNTERBEFEHLE .SS catchalladd (caa) .BI "vmm catchalladd" " fqdn destination ..." .PP @@ -940,7 +940,7 @@ Diese Adressen \(dqfangen alle\(dq diese E\-Mails auf, es sei denn es bestehen spezifischere Aliase, Mailboxen oder Relocated\-Einträge. .PP -WARNUNG: Catch-all Adressen können dazu führen, daß ein Mailserver von Spam +WARNUNG: Catch\-all Adressen können dazu führen, daß ein Mailserver von Spam überflutet wird, da Spammer zuweilen gerne alle möglichen Emailadressen ausprobieren und man auf einmal zig tausend Nachrichten gerichtet an Adressen von ab...@ex... bis zz...@ex... weitergeleitet bekommt. @@ -954,7 +954,7 @@ .SS catchallinfo (cai) .BI "vmm catchallinfo " fqdn .PP -Dieser Unterbefehl zeigt die für eine Domain definierten Catch-All Aliase +Dieser Unterbefehl zeigt die für eine Domain definierten Catch\-all Aliase an. .PP Beispiel: @@ -972,7 +972,7 @@ .BI "vmm catchalldelete " fqdn .RI [ destination ] .PP -Mit diesem Unterbefehl werden Catch-All Aliase einer Domain wieder +Mit diesem Unterbefehl werden Catch\-all Aliase einer Domain wieder gelöscht, entweder nur das angegebene Alias, oder alle, wenn keines angegeben wurde. .PP diff -r 6f2c41c3c7d6 -r a93671970617 man/de/man5/vmm.cfg.5 --- a/man/de/man5/vmm.cfg.5 Sun Apr 15 19:47:58 2012 +0200 +++ b/man/de/man5/vmm.cfg.5 Sun Apr 15 19:56:21 2012 +0200 @@ -133,7 +133,7 @@ .PP Bei umfangreichen Maildirs kann das langsam sein. Falls Sie Quotas aktiviert haben, wird der -.BR vmm -Unterbefehl +.BR vmm\-Unterbefehl userinfo ebenfalls die aktuelle Quota\-Nutzung des Kontos mit ausgegeben. Sie können auch eines der optionalen Argumente .BR du " oder " full @@ -622,4 +622,4 @@ .SH COPYING vmm und die dazugehörigen Manualseiten wurden von Pascal Volk <user+vmm AT localhost.localdomain.org> geschrieben und sind unter den Bedingungen der -BSD Lizenz lizenziert. \ No newline at end of file +BSD Lizenz lizenziert. diff -r 6f2c41c3c7d6 -r a93671970617 man/man1/vmm.1 --- a/man/man1/vmm.1 Sun Apr 15 19:47:58 2012 +0200 +++ b/man/man1/vmm.1 Sun Apr 15 19:56:21 2012 +0200 @@ -736,7 +736,7 @@ .PP Instead of .I transport -pass 'default' to remove the account-specific override, causing the +pass 'default' to remove the account\-specific override, causing the domain's value to be in effect. .PP Example: @@ -757,7 +757,7 @@ .PP Instead of .I transport -pass 'default' to remove the account-specific override, causing the +pass 'default' to remove the account\-specific override, causing the domain's value to be in effect. .PP Example: @@ -774,7 +774,7 @@ .PP Instead of .I transport -pass 'default' to remove the account-specific override, causing the +pass 'default' to remove the account\-specific override, causing the domain's value to be in effect. .PP Example: @@ -807,7 +807,7 @@ .IR %= will be replaced by the local part, the domain, or the email address with '@' replaced by '=' respectively. In combination with alias domains, this enables -domain-specific destinations. +domain\-specific destinations. .PP Examples: .PP @@ -896,16 +896,16 @@ .B vmm relocateddelete b....@ex... .fi .\" ----------------------------------------------------------------------- -.SH CATCH-ALL SUBCOMMANDS +.SH CATCH\-ALL SUBCOMMANDS .SS catchalladd (caa) .BI "vmm catchalladd" " fqdn destination ..." .PP This subcommand allows to specify destination addresses for a domain, which shall receive mail addressed to unknown local parts within that domain. -Those catch-all aliases hence \(dqcatch all\(dq mail to any address in the +Those catch\-all aliases hence \(dqcatch all\(dq mail to any address in the domain (unless a more specific alias, mailbox or relocated entry exists). .PP -WARNING: Catch-all addresses can cause mail server flooding because +WARNING: Catch\-all addresses can cause mail server flooding because spammers like to deliver mail to all possible combinations of names, e.g. to all addresses between ab...@ex... and zz...@ex.... .PP @@ -918,7 +918,7 @@ .SS catchallinfo (cai) .BI "vmm catchallinfo " fqdn .PP -This subcommand displays information about catch-all aliases defined for +This subcommand displays information about catch\-all aliases defined for a domain. .PP Example: @@ -935,7 +935,7 @@ .BI "vmm catchalldelete " fqdn .RI [ destination ] .PP -With this subcommand, catch-all aliases defined for a domain can be +With this subcommand, catch\-all aliases defined for a domain can be removed, either all of them, or a single one if specified explicitly. .PP Example: diff -r 6f2c41c3c7d6 -r a93671970617 man/man5/vmm.cfg.5 --- a/man/man5/vmm.cfg.5 Sun Apr 15 19:47:58 2012 +0200 +++ b/man/man5/vmm.cfg.5 Sun Apr 15 19:56:21 2012 +0200 @@ -587,4 +587,4 @@ .SH COPYING vmm and its manual pages were written by Pascal Volk <user+vmm AT localhost.localdomain.org> and are licensed under the terms of the BSD -License. \ No newline at end of file +License. |
|
From: <nev...@us...> - 2012-04-15 17:55:22
|
details: http://hg.localdomain.org/vmm/rev/6f2c41c3c7d6 changeset: 553:6f2c41c3c7d6 user: martin f. krafft date: Sun Apr 15 19:47:58 2012 +0200 description: man: add 'catchall' to domaininfo Since the addition of catchall, the domaininfo subcommand can also take 'catchall' as a [detail] to limit the output of details to the catch-all aliases. Also, the number of catch-all destinations is now included in the simple domaininfo output. diffstat: man/de/man1/vmm.1 | 6 +++++- man/man1/vmm.1 | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diffs (56 lines): diff -r 107f7a3be9f5 -r 6f2c41c3c7d6 man/de/man1/vmm.1 --- a/man/de/man1/vmm.1 Sun Apr 15 16:17:50 2012 +0000 +++ b/man/de/man1/vmm.1 Sun Apr 15 19:47:58 2012 +0200 @@ -412,6 +412,9 @@ .B relocated um alle Adressen der Relocated Users aufzulisten .TP +.B catchall +um alle Catch\-all\-Ziele aufzulisten +.TP .B full um alle oben genannten Informationen aufzulisten .RE @@ -432,6 +435,7 @@ Accounts.........: 1 Aliases..........: 0 Relocated........: 0 + Catch-All Dests..: 1 .fi .\" ------------------------------------ .SS domainquota (dq) @@ -1008,4 +1012,4 @@ .SH COPYING vmm und die dazugehörigen Manualseiten wurden von Pascal Volk <user+vmm AT localhost.localdomain.org> geschrieben und sind unter den Bedingungen der -BSD Lizenz lizenziert. \ No newline at end of file +BSD Lizenz lizenziert. diff -r 107f7a3be9f5 -r 6f2c41c3c7d6 man/man1/vmm.1 --- a/man/man1/vmm.1 Sun Apr 15 16:17:50 2012 +0000 +++ b/man/man1/vmm.1 Sun Apr 15 19:47:58 2012 +0200 @@ -389,6 +389,9 @@ .B relocated to list the e\-mail addresses of all relocated users .TP +.B catchall +to list all catch\-all destinations +.TP .B full to list all information mentioned above .RE @@ -409,6 +412,7 @@ Accounts.........: 1 Aliases..........: 0 Relocated........: 0 + Catch-All Dests..: 1 .fi .\" ------------------------------------ .SS domainquota (dq) @@ -970,4 +974,4 @@ .SH COPYING vmm and its manual pages were written by Pascal Volk <user+vmm AT localhost.localdomain.org> and are licensed under the terms of the BSD -License. \ No newline at end of file +License. |
|
From: <nev...@us...> - 2012-04-15 16:18:03
|
details: http://hg.localdomain.org/vmm/rev/107f7a3be9f5 changeset: 552:107f7a3be9f5 user: Pascal Volk date: Sun Apr 15 16:17:50 2012 +0000 description: man: vmm1: Use `fqdn' instead of `domain' in catchall* descriptions. Fixed a typo s/cadd/cad/. Replaced double quotes by \(dq. diffstat: man/de/man1/vmm.1 | 31 +++++++++++++++++-------------- man/man1/vmm.1 | 30 +++++++++++++++--------------- 2 files changed, 32 insertions(+), 29 deletions(-) diffs (144 lines): diff -r 62f2daff853e -r 107f7a3be9f5 man/de/man1/vmm.1 --- a/man/de/man1/vmm.1 Sun Apr 15 15:56:01 2012 +0000 +++ b/man/de/man1/vmm.1 Sun Apr 15 16:17:50 2012 +0000 @@ -1,4 +1,4 @@ -.TH "VMM" "1" "2012-04-14" "vmm 0.6" "vmm" +.TH "VMM" "1" "2012-04-15" "vmm 0.6" "vmm" .SH NAME vmm \- Kommandozeilenprogramm zur Verwaltung von E\-Mail\-Domains/\-Konten und \-Aliase. @@ -928,17 +928,18 @@ .\" ----------------------------------------------------------------------- .SH CATCH-ALL UNTERBEFEHLE .SS catchalladd (caa) -.BI "vmm catchalladd" " domain destination ..." +.BI "vmm catchalladd" " fqdn destination ..." .PP Mit diesem Unterbefehl können für eine Domain Adressen definiert werden, an -die E-mails geleitet werden, die an nicht-existente Adressen innerhalb dieser -Domains adressiert sind. Diese Adressen \"fangen alle\" diese E-mails auf, es -sei denn es bestehen spezifischere Aliase, Mailboxes oder Relocated-Einträge. +die E\-Mails geleitet werden, die an nicht\-existente Adressen innerhalb +dieser Domains adressiert sind. +Diese Adressen \(dqfangen alle\(dq diese E\-Mails auf, es sei denn es +bestehen spezifischere Aliase, Mailboxen oder Relocated\-Einträge. .PP WARNUNG: Catch-all Adressen können dazu führen, daß ein Mailserver von Spam überflutet wird, da Spammer zuweilen gerne alle möglichen Emailadressen -ausprobieren und man auf einmal zig tausend Nachrichten gerichtet an Adressen -von ab...@ex... bis zz...@ex... weitergeleitet bekommt. +ausprobieren und man auf einmal zig tausend Nachrichten gerichtet an +Adressen von ab...@ex... bis zz...@ex... weitergeleitet bekommt. .PP Beispiel: .PP @@ -947,9 +948,10 @@ .fi .\" ------------------------------------ .SS catchallinfo (cai) -.BI "vmm catchallinfo " domain +.BI "vmm catchallinfo " fqdn .PP -Dieser Unterbefehl zeigt die für eine Domain definierten Catch-All Aliase an. +Dieser Unterbefehl zeigt die für eine Domain definierten Catch-All Aliase +an. .PP Beispiel: .PP @@ -962,12 +964,13 @@ * b.n...@ex... .fi .\" ------------------------------------ -.SS catchalldelete (cadd) -.BI "vmm catchalldelete " domain +.SS catchalldelete (cad) +.BI "vmm catchalldelete " fqdn .RI [ destination ] .PP -Mit diesem Unterbefehl werden Catch-All Aliase einer Domain wieder gelöscht, -entweder nur das angegebene Alias, oder alle, wenn keines angegeben wurde. +Mit diesem Unterbefehl werden Catch-All Aliase einer Domain wieder +gelöscht, entweder nur das angegebene Alias, oder alle, wenn keines +angegeben wurde. .PP Beispiel: .PP @@ -1005,4 +1008,4 @@ .SH COPYING vmm und die dazugehörigen Manualseiten wurden von Pascal Volk <user+vmm AT localhost.localdomain.org> geschrieben und sind unter den Bedingungen der -BSD Lizenz lizenziert. +BSD Lizenz lizenziert. \ No newline at end of file diff -r 62f2daff853e -r 107f7a3be9f5 man/man1/vmm.1 --- a/man/man1/vmm.1 Sun Apr 15 15:56:01 2012 +0000 +++ b/man/man1/vmm.1 Sun Apr 15 16:17:50 2012 +0000 @@ -1,4 +1,4 @@ -.TH "VMM" "1" "2012-04-14" "vmm 0.6" "vmm" +.TH "VMM" "1" "2012-04-15" "vmm 0.6" "vmm" .SH NAME vmm \- command line tool to manage email domains/accounts/aliases .\" ----------------------------------------------------------------------- @@ -894,16 +894,16 @@ .\" ----------------------------------------------------------------------- .SH CATCH-ALL SUBCOMMANDS .SS catchalladd (caa) -.BI "vmm catchalladd" " domain destination ..." +.BI "vmm catchalladd" " fqdn destination ..." .PP This subcommand allows to specify destination addresses for a domain, which -shall receive mail addressed to unknown local parts within that domain. Those -catch-all aliases hence "catch all" mail to any address in the domain (unless -a more specific alias, mailbox or relocated entry exists). +shall receive mail addressed to unknown local parts within that domain. +Those catch-all aliases hence \(dqcatch all\(dq mail to any address in the +domain (unless a more specific alias, mailbox or relocated entry exists). .PP -WARNING: Catch-all addresses can cause mail server flooding because spammers -like to deliver mail to all possible combinations of names, e.g. to all -addresses between ab...@ex... and zz...@ex.... +WARNING: Catch-all addresses can cause mail server flooding because +spammers like to deliver mail to all possible combinations of names, e.g. +to all addresses between ab...@ex... and zz...@ex.... .PP Example: .PP @@ -912,7 +912,7 @@ .fi .\" ------------------------------------ .SS catchallinfo (cai) -.BI "vmm catchallinfo " domain +.BI "vmm catchallinfo " fqdn .PP This subcommand displays information about catch-all aliases defined for a domain. @@ -927,17 +927,17 @@ * us...@ex... .fi .\" ------------------------------------ -.SS catchalldelete (cadd) -.BI "vmm catchalldelete " domain +.SS catchalldelete (cad) +.BI "vmm catchalldelete " fqdn .RI [ destination ] .PP -With this subcommand, catch-all aliases defined for a domain can be removed, -either all of them, or a single one if specified explicitly. +With this subcommand, catch-all aliases defined for a domain can be +removed, either all of them, or a single one if specified explicitly. .PP Example: .PP .nf -.B vmm catchalldelete example us...@ex... +.B vmm catchalldelete example.com us...@ex... .fi .\" ----------------------------------------------------------------------- .SH FILES @@ -970,4 +970,4 @@ .SH COPYING vmm and its manual pages were written by Pascal Volk <user+vmm AT localhost.localdomain.org> and are licensed under the terms of the BSD -License. +License. \ No newline at end of file |
|
From: <nev...@us...> - 2012-04-15 15:56:12
|
details: http://hg.localdomain.org/vmm/rev/62f2daff853e changeset: 551:62f2daff853e user: Pascal Volk date: Sun Apr 15 15:56:01 2012 +0000 description: VMM/cli/subcommands: Use the `fqdn' argument placeholder also for catch-all subcommands. diffstat: VirtualMailManager/cli/subcommands.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (21 lines): diff -r 867d950ce7b7 -r 62f2daff853e VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Sun Apr 15 17:51:00 2012 +0200 +++ b/VirtualMailManager/cli/subcommands.py Sun Apr 15 15:56:01 2012 +0000 @@ -782,14 +782,14 @@ 'domain to an other domain')), # CatchallAlias commands 'catchalladd': cmd('catchalladd', 'caa', catchall_add, - 'domain destination ...', + 'fqdn destination ...', _(u'add one or more catch-all destinations for a ' u'domain')), 'catchalldelete': cmd('catchalldelete', 'cad', catchall_delete, - 'domain [destination]', + 'fqdn [destination]', _(u'delete the specified catch-all destination or all ' u'of a domain\'s destinations')), - 'catchallinfo': cmd('catchallinfo', 'cai', catchall_info, 'domain', + 'catchallinfo': cmd('catchallinfo', 'cai', catchall_info, 'fqdn', _(u'show the catch-all destination(s) of the specified domain')), # Domain commands 'domainadd': cmd('domainadd', 'da', domain_add, 'fqdn [transport]', |
|
From: <nev...@us...> - 2012-04-15 15:53:42
|
details: http://hg.localdomain.org/vmm/rev/867d950ce7b7 changeset: 550:867d950ce7b7 user: martin f. krafft date: Sun Apr 15 17:51:00 2012 +0200 description: Fix transport_maps function for non-existent domains The postfix_transport_maps function had a bug causing 2012-04-15 17:40:22 CEST LOG: statement: SELECT transport FROM postfix_transport_map('logcheck', 'domine.madduck.net'); 2012-04-15 17:40:22 CEST ERROR: query returned no rows when the domain was not in the database. This would make did be NULL and make the query fail. This patch moves the tid query until after a check for did. If the latter is NULL, the function RETURNs (rather than fails). diffstat: pgsql/create_tables-dovecot-1.2.x.pgsql | 11 +++++++++-- pgsql/create_tables.pgsql | 11 +++++++++-- pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql | 11 +++++++++-- pgsql/update_tables_0.5.x-0.6.pgsql | 11 +++++++++-- 4 files changed, 36 insertions(+), 8 deletions(-) diffs (88 lines): diff -r 44a808af6cf4 -r 867d950ce7b7 pgsql/create_tables-dovecot-1.2.x.pgsql --- a/pgsql/create_tables-dovecot-1.2.x.pgsql Sun Apr 15 17:36:26 2012 +0200 +++ b/pgsql/create_tables-dovecot-1.2.x.pgsql Sun Apr 15 17:51:00 2012 +0200 @@ -571,9 +571,16 @@ record recipient_transport; recipient varchar(320) := localpart || '@' || the_domain; did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain); - transport_id bigint := (SELECT tid FROM users - WHERE gid = did AND local_part = localpart); + transport_id bigint; BEGIN + IF did IS NULL THEN + RETURN; + END IF; + + SELECT tid INTO transport_id + FROM users + WHERE gid = did AND local_part = localpart; + IF transport_id IS NULL THEN SELECT tid INTO STRICT transport_id FROM domain_data diff -r 44a808af6cf4 -r 867d950ce7b7 pgsql/create_tables.pgsql --- a/pgsql/create_tables.pgsql Sun Apr 15 17:36:26 2012 +0200 +++ b/pgsql/create_tables.pgsql Sun Apr 15 17:51:00 2012 +0200 @@ -549,9 +549,16 @@ record recipient_transport; recipient varchar(320) := localpart || '@' || the_domain; did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain); - transport_id bigint := (SELECT tid FROM users - WHERE gid = did AND local_part = localpart); + transport_id bigint; BEGIN + IF did IS NULL THEN + RETURN; + END IF; + + SELECT tid INTO transport_id + FROM users + WHERE gid = did AND local_part = localpart; + IF transport_id IS NULL THEN SELECT tid INTO STRICT transport_id FROM domain_data diff -r 44a808af6cf4 -r 867d950ce7b7 pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql --- a/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Sun Apr 15 17:36:26 2012 +0200 +++ b/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Sun Apr 15 17:51:00 2012 +0200 @@ -496,9 +496,16 @@ record recipient_transport; recipient varchar(320) := localpart || '@' || the_domain; did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain); - transport_id bigint := (SELECT tid FROM users - WHERE gid = did AND local_part = localpart); + transport_id bigint; BEGIN + IF did IS NULL THEN + RETURN; + END IF; + + SELECT tid INTO transport_id + FROM users + WHERE gid = did AND local_part = localpart; + IF transport_id IS NULL THEN SELECT tid INTO STRICT transport_id FROM domain_data diff -r 44a808af6cf4 -r 867d950ce7b7 pgsql/update_tables_0.5.x-0.6.pgsql --- a/pgsql/update_tables_0.5.x-0.6.pgsql Sun Apr 15 17:36:26 2012 +0200 +++ b/pgsql/update_tables_0.5.x-0.6.pgsql Sun Apr 15 17:51:00 2012 +0200 @@ -475,9 +475,16 @@ record recipient_transport; recipient varchar(320) := localpart || '@' || the_domain; did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain); - transport_id bigint := (SELECT tid FROM users - WHERE gid = did AND local_part = localpart); + transport_id bigint; BEGIN + IF did IS NULL THEN + RETURN; + END IF; + + SELECT tid INTO transport_id + FROM users + WHERE gid = did AND local_part = localpart; + IF transport_id IS NULL THEN SELECT tid INTO STRICT transport_id FROM domain_data |
|
From: <nev...@us...> - 2012-04-15 15:40:54
|
details: http://hg.localdomain.org/vmm/rev/44a808af6cf4 changeset: 549:44a808af6cf4 user: martin f. krafft date: Sun Apr 15 17:36:26 2012 +0200 description: Revert caching of destination interpolation Since 'destination' comes from the table in the query, it cannot be cached across queries! Doh! diffstat: pgsql/create_tables-dovecot-1.2.x.pgsql | 8 ++++---- pgsql/create_tables.pgsql | 8 ++++---- pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql | 8 ++++---- pgsql/update_tables_0.5.x-0.6.pgsql | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diffs (112 lines): diff -r 92ef34f07da3 -r 44a808af6cf4 pgsql/create_tables-dovecot-1.2.x.pgsql --- a/pgsql/create_tables-dovecot-1.2.x.pgsql Sun Apr 15 15:30:16 2012 +0000 +++ b/pgsql/create_tables-dovecot-1.2.x.pgsql Sun Apr 15 17:36:26 2012 +0200 @@ -631,12 +631,11 @@ record recipient_destination; catchall_cursor refcursor; recipient varchar(320) := localpart || '@' || the_domain; - idestination varchar(320) := - _interpolate_destination(destination, localpart, the_domain); did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain); BEGIN FOR record IN - SELECT recipient, idestination + SELECT recipient, + _interpolate_destination(destination, localpart, the_domain) FROM alias WHERE gid = did AND address = localpart @@ -654,7 +653,8 @@ -- or relocated entry and return the identity mapping if that is -- the case OPEN catchall_cursor FOR - SELECT recipient, idestination + SELECT recipient, + _interpolate_destination(destination, localpart, the_domain) FROM catchall WHERE gid = did; FETCH NEXT FROM catchall_cursor INTO recordc; diff -r 92ef34f07da3 -r 44a808af6cf4 pgsql/create_tables.pgsql --- a/pgsql/create_tables.pgsql Sun Apr 15 15:30:16 2012 +0000 +++ b/pgsql/create_tables.pgsql Sun Apr 15 17:36:26 2012 +0200 @@ -609,12 +609,11 @@ record recipient_destination; catchall_cursor refcursor; recipient varchar(320) := localpart || '@' || the_domain; - idestination varchar(320) := - _interpolate_destination(destination, localpart, the_domain); did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain); BEGIN FOR record IN - SELECT recipient, idestination + SELECT recipient, + _interpolate_destination(destination, localpart, the_domain) FROM alias WHERE gid = did AND address = localpart @@ -632,7 +631,8 @@ -- or relocated entry and return the identity mapping if that is -- the case OPEN catchall_cursor FOR - SELECT recipient, idestination + SELECT recipient, + _interpolate_destination(destination, localpart, the_domain) FROM catchall WHERE gid = did; FETCH NEXT FROM catchall_cursor INTO recordc; diff -r 92ef34f07da3 -r 44a808af6cf4 pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql --- a/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Sun Apr 15 15:30:16 2012 +0000 +++ b/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Sun Apr 15 17:36:26 2012 +0200 @@ -551,12 +551,11 @@ record recipient_destination; catchall_cursor refcursor; recipient varchar(320) := localpart || '@' || the_domain; - idestination varchar(320) := - _interpolate_destination(destination, localpart, the_domain); did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain); BEGIN FOR record IN - SELECT recipient, idestination + SELECT recipient, + _interpolate_destination(destination, localpart, the_domain) FROM alias WHERE gid = did AND address = localpart @@ -574,7 +573,8 @@ -- or relocated entry and return the identity mapping if that is -- the case OPEN catchall_cursor FOR - SELECT recipient, idestination + SELECT recipient, + _interpolate_destination(destination, localpart, the_domain) FROM catchall WHERE gid = did; FETCH NEXT FROM catchall_cursor INTO recordc; diff -r 92ef34f07da3 -r 44a808af6cf4 pgsql/update_tables_0.5.x-0.6.pgsql --- a/pgsql/update_tables_0.5.x-0.6.pgsql Sun Apr 15 15:30:16 2012 +0000 +++ b/pgsql/update_tables_0.5.x-0.6.pgsql Sun Apr 15 17:36:26 2012 +0200 @@ -530,12 +530,11 @@ record recipient_destination; catchall_cursor refcursor; recipient varchar(320) := localpart || '@' || the_domain; - idestination varchar(320) := - _interpolate_destination(destination, localpart, the_domain); did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain); BEGIN FOR record IN - SELECT recipient, idestination + SELECT recipient, + _interpolate_destination(destination, localpart, the_domain) FROM alias WHERE gid = did AND address = localpart @@ -553,7 +552,8 @@ -- or relocated entry and return the identity mapping if that is -- the case OPEN catchall_cursor FOR - SELECT recipient, idestination + SELECT recipient, + _interpolate_destination(destination, localpart, the_domain) FROM catchall WHERE gid = did; FETCH NEXT FROM catchall_cursor INTO recordc; |
|
From: <nev...@us...> - 2012-04-15 15:30:32
|
details: http://hg.localdomain.org/vmm/rev/92ef34f07da3 changeset: 548:92ef34f07da3 user: Pascal Volk date: Sun Apr 15 15:30:16 2012 +0000 description: pgsql: update_tables_*: Added missing `NOT' to `… tid DROP NOT NULL;'. diffstat: pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql | 2 +- pgsql/update_tables_0.5.x-0.6.pgsql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diffs (24 lines): diff -r 5020c56f9388 -r 92ef34f07da3 pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql --- a/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Sun Apr 15 12:54:16 2012 +0000 +++ b/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Sun Apr 15 15:30:16 2012 +0000 @@ -179,7 +179,7 @@ -- --- -- Quota/Service/Transport inheritance -- --- -ALTER TABLE users ALTER COLUMN tid DROP NULL; +ALTER TABLE users ALTER COLUMN tid DROP NOT NULL; ALTER TABLE users ALTER COLUMN tid SET DEFAULT NULL; -- The qid and ssid columns have already been defined accordingly above. -- The rest of the logic will take place in the functions. diff -r 5020c56f9388 -r 92ef34f07da3 pgsql/update_tables_0.5.x-0.6.pgsql --- a/pgsql/update_tables_0.5.x-0.6.pgsql Sun Apr 15 12:54:16 2012 +0000 +++ b/pgsql/update_tables_0.5.x-0.6.pgsql Sun Apr 15 15:30:16 2012 +0000 @@ -147,7 +147,7 @@ -- --- -- Quota/Service/Transport inheritance -- --- -ALTER TABLE users ALTER COLUMN tid DROP NULL; +ALTER TABLE users ALTER COLUMN tid DROP NOT NULL; ALTER TABLE users ALTER COLUMN tid SET DEFAULT NULL; -- The qid and ssid columns have already been defined accordingly above. -- The rest of the logic will take place in the functions. |
|
From: <nev...@us...> - 2012-04-15 12:54:38
|
details: http://hg.localdomain.org/vmm/rev/5020c56f9388 changeset: 547:5020c56f9388 user: Pascal Volk date: Sun Apr 15 12:54:16 2012 +0000 description: pgsql: Create column `note' as text. diffstat: pgsql/create_tables-dovecot-1.2.x.pgsql | 4 ++-- pgsql/create_tables.pgsql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diffs (42 lines): diff -r 79f09cdd1a21 -r 5020c56f9388 pgsql/create_tables-dovecot-1.2.x.pgsql --- a/pgsql/create_tables-dovecot-1.2.x.pgsql Sun Apr 15 14:10:40 2012 +0200 +++ b/pgsql/create_tables-dovecot-1.2.x.pgsql Sun Apr 15 12:54:16 2012 +0000 @@ -104,7 +104,7 @@ ssid bigint NOT NULL DEFAULT 1, -- default service set tid bigint NOT NULL DEFAULT 1, -- default transport domaindir varchar(40) NOT NULL, --/srv/mail/$RAND/4294967294 - note varchar NULL DEFAULT NULL, + note text NULL DEFAULT NULL, CONSTRAINT pkey_domain_data PRIMARY KEY (gid), CONSTRAINT fkey_domain_data_qid_quotalimit FOREIGN KEY (qid) REFERENCES quotalimit (qid), @@ -133,7 +133,7 @@ qid bigint NULL DEFAULT NULL, ssid bigint NULL DEFAULT NULL, tid bigint NULL DEFAULT NULL, - note varchar NULL DEFAULT NULL, + note text NULL DEFAULT NULL, CONSTRAINT pkey_users PRIMARY KEY (local_part, gid), CONSTRAINT ukey_users_uid UNIQUE (uid), CONSTRAINT fkey_users_gid_domain_data FOREIGN KEY (gid) diff -r 79f09cdd1a21 -r 5020c56f9388 pgsql/create_tables.pgsql --- a/pgsql/create_tables.pgsql Sun Apr 15 14:10:40 2012 +0200 +++ b/pgsql/create_tables.pgsql Sun Apr 15 12:54:16 2012 +0000 @@ -104,7 +104,7 @@ ssid bigint NOT NULL DEFAULT 1, -- default service_set tid bigint NOT NULL DEFAULT 1, -- default transport domaindir varchar(40) NOT NULL, --/srv/mail/$RAND/4294967294 - note varchar NULL DEFAULT NULL, + note text NULL DEFAULT NULL, CONSTRAINT pkey_domain_data PRIMARY KEY (gid), CONSTRAINT fkey_domain_data_qid_quotalimit FOREIGN KEY (qid) REFERENCES quotalimit (qid), @@ -133,7 +133,7 @@ qid bigint NULL DEFAULT NULL, ssid bigint NULL DEFAULT NULL, tid bigint NULL DEFAULT NULL, - note varchar NULL DEFAULT NULL, + note text NULL DEFAULT NULL, CONSTRAINT pkey_users PRIMARY KEY (local_part, gid), CONSTRAINT ukey_users_uid UNIQUE (uid), CONSTRAINT fkey_users_gid_domain_data FOREIGN KEY (gid) |
|
From: <nev...@us...> - 2012-04-15 12:13:07
|
details: http://hg.localdomain.org/vmm/rev/79f09cdd1a21 changeset: 546:79f09cdd1a21 user: martin f. krafft date: Sun Apr 15 14:10:40 2012 +0200 description: Add docstring for common.format_domain_default diffstat: VirtualMailManager/common.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 47254b46c361 -r 79f09cdd1a21 VirtualMailManager/common.py --- a/VirtualMailManager/common.py Sat Apr 14 21:48:00 2012 +0200 +++ b/VirtualMailManager/common.py Sun Apr 15 14:10:40 2012 +0200 @@ -187,6 +187,7 @@ return version_string def format_domain_default(domaindata): + """Format info output when the value displayed is the domain default.""" return _(u'%s [domain default]') % domaindata del _ |
|
From: <nev...@us...> - 2012-04-15 10:58:44
|
details: http://hg.localdomain.org/vmm/rev/47254b46c361 changeset: 545:47254b46c361 user: martin f. krafft date: Sat Apr 14 21:48:00 2012 +0200 description: Document domainnote in manpages 5806fb74130b did not contain this, so I must have forgotten it. Oops. diffstat: man/de/man1/vmm.1 | 15 ++++++++++++++- man/man1/vmm.1 | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diffs (60 lines): diff -r ff805bd17817 -r 47254b46c361 man/de/man1/vmm.1 --- a/man/de/man1/vmm.1 Sat Apr 14 22:56:52 2012 +0200 +++ b/man/de/man1/vmm.1 Sat Apr 14 21:48:00 2012 +0200 @@ -508,6 +508,19 @@ .nf .B vmm domaintransport support.example.com dovecot: .fi +.\" ------------------------------------ +.SS domainnote (do) +.BI "vmm domainnote" " fqdn" +.RI [ note ] +.PP +Mit diesem Unterbefehl kann eine Domain mit einer Notiz versehen werden. Um +die Notiz wieder zu löschen, läßt man sie einfach weg. +.PP +Beispiel: +.PP +.nf +.B vmm do example.com Gehört Robert +.fi .\" ----------------------------------------------------------------------- .SH ALIAS\-DOMAIN UNTERBEFEHLE Eine Alias\-Domain ist ein Alias für eine Domain, die zuvor mit dem @@ -992,4 +1005,4 @@ .SH COPYING vmm und die dazugehörigen Manualseiten wurden von Pascal Volk <user+vmm AT localhost.localdomain.org> geschrieben und sind unter den Bedingungen der -BSD Lizenz lizenziert. \ No newline at end of file +BSD Lizenz lizenziert. diff -r ff805bd17817 -r 47254b46c361 man/man1/vmm.1 --- a/man/man1/vmm.1 Sat Apr 14 22:56:52 2012 +0200 +++ b/man/man1/vmm.1 Sat Apr 14 21:48:00 2012 +0200 @@ -477,6 +477,19 @@ .nf .B vmm domaintransport support.example.com dovecot: .fi +.\" ------------------------------------ +.SS domainnote (do) +.BI "vmm domainnote" " fqdn" +.RI [ note ] +.PP +With this subcommand, it is possible to attach a note to the specified +domain. Without an argument, an existing note is removed. +.PP +Example: +.PP +.nf +.B vmm do example.com Belongs to Robert +.fi .\" ----------------------------------------------------------------------- .SH ALIAS DOMAIN SUBCOMMANDS An alias domain is an alias for a domain that was previously added with the @@ -957,4 +970,4 @@ .SH COPYING vmm and its manual pages were written by Pascal Volk <user+vmm AT localhost.localdomain.org> and are licensed under the terms of the BSD -License. \ No newline at end of file +License. |
|
From: <nev...@us...> - 2012-04-14 21:05:49
|
details: http://hg.localdomain.org/vmm/rev/ff805bd17817 changeset: 544:ff805bd17817 user: martin f. krafft date: Sat Apr 14 22:56:52 2012 +0200 description: Remove domain/account notes from TODO diffstat: TODO | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) diffs (12 lines): diff -r 1b3bdce0bf87 -r ff805bd17817 TODO --- a/TODO Sat Apr 14 22:53:21 2012 +0200 +++ b/TODO Sat Apr 14 22:56:52 2012 +0200 @@ -46,8 +46,3 @@ users, aliases, relocated, and addresses (the union of all three). Ideally, the commands would also take % wildcards, so that I can limit the output - -- domain and account notes [ma...@ma...]: - - I found it useful to keep a free-text "notes" field for accounts and - domains, where the admin can store anything s/he wants. This would - simply be a new field in the two tables and the appropriate UI changes. |
|
From: <nev...@us...> - 2012-04-14 21:05:33
|
details: http://hg.localdomain.org/vmm/rev/1b3bdce0bf87 changeset: 543:1b3bdce0bf87 user: martin f. krafft date: Sat Apr 14 22:53:21 2012 +0200 description: Include account note in getuser output Modify the getuser output to include an account note, if one is present diffstat: VirtualMailManager/account.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r c3b98364f03d -r 1b3bdce0bf87 VirtualMailManager/account.py --- a/VirtualMailManager/account.py Sat Apr 14 22:52:40 2012 +0200 +++ b/VirtualMailManager/account.py Sat Apr 14 22:53:21 2012 +0200 @@ -479,7 +479,7 @@ raise AErr(_(u'UID must be greater than 0.'), INVALID_ARGUMENT) dbc = dbh.cursor() dbc.execute("SELECT local_part||'@'|| domain_name.domainname AS address, " - "uid, users.gid FROM users LEFT JOIN domain_name ON " + "uid, users.gid, note FROM users LEFT JOIN domain_name ON " "(domain_name.gid = users.gid AND is_primary) WHERE uid = %s", (uid,)) info = dbc.fetchone() @@ -487,7 +487,7 @@ if not info: raise AErr(_(u"There is no account with the UID: '%d'") % uid, NO_SUCH_ACCOUNT) - info = dict(zip(('address', 'uid', 'gid'), info)) + info = dict(zip(('address', 'uid', 'gid', 'note'), info)) return info del _, cfg_dget |
|
From: <nev...@us...> - 2012-04-14 21:05:13
|
details: http://hg.localdomain.org/vmm/rev/c3b98364f03d changeset: 542:c3b98364f03d user: martin f. krafft date: Sat Apr 14 22:52:40 2012 +0200 description: Display formatted notes in info output If the user/domain object has an attached note, this patch makes the userinfo/domaininfo output print the note, wrapped to the terminal size. diffstat: VirtualMailManager/cli/subcommands.py | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diffs (26 lines): diff -r a582f1452bc0 -r c3b98364f03d VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Sat Apr 14 21:20:06 2012 +0200 +++ b/VirtualMailManager/cli/subcommands.py Sat Apr 14 22:52:40 2012 +0200 @@ -898,7 +898,22 @@ else: w_std(u'\t%s: %s' % (key.title().ljust(17, u'.'), info[key])) print + note = info.get('note', None) + if note is not None: + _print_note(note) +def _print_note(note): + msg = _(u'Note') + w_std(msg, u'-' * len(msg)) + old_ii = txt_wrpr.initial_indent + old_si = txt_wrpr.subsequent_indent + txt_wrpr.initial_indent = txt_wrpr.subsequent_indent = '\t' + txt_wrpr.width -= 8 + for para in note.split('\n'): + w_std(txt_wrpr.fill(para)) + txt_wrpr.width += 8 + txt_wrpr.subsequent_indent = old_si + txt_wrpr.initial_indent = old_ii def _print_list(alist, title): """Print a list.""" |
|
From: <nev...@us...> - 2012-04-14 19:22:26
|
details: http://hg.localdomain.org/vmm/rev/a582f1452bc0 changeset: 541:a582f1452bc0 user: martin f. krafft date: Sat Apr 14 21:20:06 2012 +0200 description: Ignore *.egg-status build directory created by setuptools diffstat: .hgignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r a8ee0328f908 -r a582f1452bc0 .hgignore --- a/.hgignore Sat Apr 14 15:44:23 2012 +0200 +++ b/.hgignore Sat Apr 14 21:20:06 2012 +0200 @@ -13,3 +13,4 @@ debian/files debian/*substvars .pc +*.egg-info |
|
From: <nev...@us...> - 2012-04-14 16:07:27
|
details: http://hg.localdomain.org/vmm/rev/a8ee0328f908 changeset: 540:a8ee0328f908 user: martin f. krafft date: Sat Apr 14 15:44:23 2012 +0200 description: Add user/domainnote commands to manpages diffstat: man/de/man1/vmm.1 | 13 +++++++++++++ man/man1/vmm.1 | 13 +++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) diffs (46 lines): diff -r 5806fb74130b -r a8ee0328f908 man/de/man1/vmm.1 --- a/man/de/man1/vmm.1 Sat Apr 14 13:29:01 2012 +0200 +++ b/man/de/man1/vmm.1 Sat Apr 14 15:44:23 2012 +0200 @@ -723,6 +723,19 @@ .B vmm up d....@ex... \(dqA |\(rs/|0r3 5ecur3 P4s5\(rs/\(rs/0rd?\(dq .fi .\" ------------------------------------ +.SS usernote (uo) +.BI "vmm usernote" " address" +.RI [ note ] +.PP +Mit diesem Unterbefehl kann ein Konto mit einer Notiz versehen werden. Um die +Notiz wieder zu löschen, läßt man sie einfach weg. +.PP +Beispiel: +.PP +.nf +.B vmm uo d....@ex... Wird nur bis Ende Mai 2012 gebraucht +.fi +.\" ------------------------------------ .SS userquota (uq) .BI "vmm userquota" " address storage" .RI [ messages ] diff -r 5806fb74130b -r a8ee0328f908 man/man1/vmm.1 --- a/man/man1/vmm.1 Sat Apr 14 13:29:01 2012 +0200 +++ b/man/man1/vmm.1 Sat Apr 14 15:44:23 2012 +0200 @@ -692,6 +692,19 @@ .B vmm up d....@ex... \(dqA |\(rs/|0r3 5ecur3 P4s5\(rs/\(rs/0rd?\(dq .fi .\" ------------------------------------ +.SS usernote (uo) +.BI "vmm usernote" " address" +.RI [ note ] +.PP +With this subcommand, it is possible to attach a note to the specified +account. Without an argument, an existing note is removed. +.PP +Example: +.PP +.nf +.B vmm uo d....@ex... Only needed until end of May 2012 +.fi +.\" ------------------------------------ .SS userquota (uq) .BI "vmm userquota" " address storage" .RI [ messages ] |
|
From: <nev...@us...> - 2012-04-14 16:07:17
|
details: http://hg.localdomain.org/vmm/rev/5806fb74130b changeset: 539:5806fb74130b user: martin f. krafft date: Sat Apr 14 13:29:01 2012 +0200 description: Add note field to Account/Domain and CLI diffstat: VirtualMailManager/account.py | 47 ++++++++++++++++------ VirtualMailManager/cli/subcommands.py | 39 ++++++++++++++++- VirtualMailManager/domain.py | 73 +++++++++++++++++++++++++++------- VirtualMailManager/handler.py | 19 ++++---- 4 files changed, 137 insertions(+), 41 deletions(-) diffs (truncated from 425 to 300 lines): diff -r 1f9ea5658627 -r 5806fb74130b VirtualMailManager/account.py --- a/VirtualMailManager/account.py Sat Apr 14 12:58:20 2012 +0200 +++ b/VirtualMailManager/account.py Sat Apr 14 13:29:01 2012 +0200 @@ -32,7 +32,7 @@ class Account(object): """Class to manage e-mail accounts.""" __slots__ = ('_addr', '_dbh', '_domain', '_mail', '_new', '_passwd', - '_qlimit', '_services', '_transport', '_uid') + '_qlimit', '_services', '_transport', '_note', '_uid') def __init__(self, dbh, address): """Creates a new Account instance. @@ -63,6 +63,7 @@ self._qlimit = None self._services = None self._transport = None + self._note = None self._passwd = None self._new = True self._load() @@ -72,16 +73,16 @@ return not self._new def _load(self): - """Load 'uid', 'mid', 'qid', 'ssid' and 'tid' from the database and - set _new to `False` - if the user could be found. """ + """Load 'uid', 'mid', 'qid', 'ssid', 'tid' and 'note' from the + database and set _new to `False` - if the user could be found. """ dbc = self._dbh.cursor() - dbc.execute('SELECT uid, mid, qid, ssid, tid FROM users WHERE gid = ' - '%s AND local_part = %s', (self._domain.gid, - self._addr.localpart)) + dbc.execute('SELECT uid, mid, qid, ssid, tid, note FROM users ' + 'WHERE gid = %s AND local_part = %s', + (self._domain.gid, self._addr.localpart)) result = dbc.fetchone() dbc.close() if result: - self._uid, _mid, _qid, _ssid, _tid = result + self._uid, _mid, _qid, _ssid, _tid, _note = result def load_helper(ctor, own, field, dbresult): cur = None if own is None else getattr(own, field) @@ -96,6 +97,7 @@ self._transport = load_helper(Transport, self._transport, 'tid', _tid) self._mail = MailLocation(self._dbh, mid=_mid) + self._note = _note self._new = False def _set_uid(self): @@ -193,6 +195,11 @@ return self._mail @property + def note(self): + """The Account's note.""" + return self._note + + @property def uid(self): """The Account's unique ID.""" return self._uid @@ -216,6 +223,17 @@ ACCOUNT_MISSING_PASSWORD) self._passwd = password + def set_note(self, note): + """Set the account's (optional) note. + + Argument: + + `note` : basestring or None + The note, or None to remove + """ + assert note is None or isinstance(note, basestring) + self._note = note + def save(self): """Save the new Account in the database.""" if not self._new: @@ -228,13 +246,15 @@ directory=cfg_dget('mailbox.root'))) dbc = self._dbh.cursor() dbc.execute('INSERT INTO users (local_part, passwd, uid, gid, mid, ' - 'qid, ssid, tid) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)', + 'qid, ssid, tid, note) ' + 'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)', (self._addr.localpart, pwhash(self._passwd, user=self._addr), self._uid, self._domain.gid, self._mail.mid, self._qlimit.qid if self._qlimit else None, self._services.ssid if self._services else None, - self._transport.tid if self._transport else None)) + self._transport.tid if self._transport else None, + self._note)) self._dbh.commit() dbc.close() self._new = False @@ -242,16 +262,16 @@ def modify(self, field, value): """Update the Account's *field* to the new *value*. - Possible values for *field* are: 'name', 'password'. + Possible values for *field* are: 'name', 'password', 'note'. Arguments: `field` : basestring - The attribute name: 'name' or 'password' + The attribute name: 'name', 'password' or 'note' `value` : basestring The new value of the attribute. """ - if field not in ('name', 'password'): + if field not in ('name', 'password', 'note'): raise AErr(_(u"Unknown field: '%s'") % field, INVALID_ARGUMENT) self._chk_state() dbc = self._dbh.cursor() @@ -259,7 +279,7 @@ dbc.execute('UPDATE users SET passwd = %s WHERE uid = %s', (pwhash(value, user=self._addr), self._uid)) else: - dbc.execute('UPDATE users SET name = %s WHERE uid = %s', + dbc.execute('UPDATE users SET %s = %%s WHERE uid = %%s' % field, (value, self._uid)) if dbc.rowcount > 0: self._dbh.commit() @@ -377,6 +397,7 @@ info['ql_messages'] = self._domain.quotalimit.messages info['ql_domaindefault'] = True info['transport'] = self._get_info_transport() + info['note'] = self._note info['uid'] = self._uid return info # nearly impossible‽ diff -r 1f9ea5658627 -r 5806fb74130b VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Sat Apr 14 12:58:20 2012 +0200 +++ b/VirtualMailManager/cli/subcommands.py Sat Apr 14 13:29:01 2012 +0200 @@ -31,10 +31,11 @@ 'aliasdomain_switch', 'catchall_add', 'catchall_info', 'catchall_delete', 'config_get', 'config_set', 'configure', 'domain_add', 'domain_delete', 'domain_info', 'domain_quota', - 'domain_services', 'domain_transport', 'get_user', 'help_', 'list_domains', - 'list_pwschemes', 'relocated_add', 'relocated_delete', 'relocated_info', - 'user_add', 'user_delete', 'user_info', 'user_name', 'user_password', - 'user_quota', 'user_services', 'user_transport', 'version', + 'domain_services', 'domain_transport', 'domain_note', 'get_user', 'help_', + 'list_domains', 'list_pwschemes', 'relocated_add', 'relocated_delete', + 'relocated_info', 'user_add', 'user_delete', 'user_info', 'user_name', + 'user_password', 'user_quota', 'user_services', 'user_transport', + 'user_note', 'version', ) _ = lambda msg: msg @@ -407,6 +408,18 @@ ctx.hdlr.domain_transport(ctx.args[2].lower(), ctx.args[3], force) +def domain_note(ctx): + """update the note of the given domain""" + if ctx.argc < 3: + usage(EX_MISSING_ARGS, _(u'Missing domain name.'), + ctx.scmd) + elif ctx.argc < 4: + note = None + else: + note = ' '.join(ctx.args[3:]) + ctx.hdlr.domain_note(ctx.args[2].lower(), note) + + def get_user(ctx): """get the address of the user with the given UID""" if ctx.argc < 3: @@ -611,6 +624,18 @@ ctx.hdlr.user_password(ctx.args[2].lower(), password) +def user_note(ctx): + """update the note of the given address""" + if ctx.argc < 3: + usage(EX_MISSING_ARGS, _(u'Missing e-mail address.'), + ctx.scmd) + elif ctx.argc < 4: + note = None + else: + note = ' '.join(ctx.args[3:]) + ctx.hdlr.user_note(ctx.args[2].lower(), note) + + def user_quota(ctx): """update the quota limit for the given address""" if ctx.argc < 3: @@ -731,6 +756,9 @@ 'usertransport': cmd('usertransport', 'ut', user_transport, 'address transport | address default', _(u'update the transport of the given address')), + 'usernote': cmd('usernote', 'uo', user_note, + 'address note', + _(u'update the note of the given address')), # Alias commands 'aliasadd': cmd('aliasadd', 'aa', alias_add, 'address destination ...', _(u'create a new alias e-mail address with one or more ' @@ -780,6 +808,9 @@ 'domaintransport': cmd('domaintransport', 'dt', domain_transport, 'fqdn transport [force]', _(u'update the transport of the specified domain')), + 'domainnote': cmd('domainnote', 'do', domain_note, + 'fqdn note', + _(u'update the note of the given domain')), 'listdomains': cmd('listdomains', 'ld', list_domains, '[pattern]', _(u'list all domains or search for domains by pattern')), # Relocated commands diff -r 1f9ea5658627 -r 5806fb74130b VirtualMailManager/domain.py --- a/VirtualMailManager/domain.py Sat Apr 14 12:58:20 2012 +0200 +++ b/VirtualMailManager/domain.py Sat Apr 14 13:29:01 2012 +0200 @@ -31,7 +31,7 @@ class Domain(object): """Class to manage e-mail domains.""" __slots__ = ('_directory', '_gid', '_name', '_qlimit', '_services', - '_transport', '_dbh', '_new') + '_transport', '_note', '_dbh', '_new') def __init__(self, dbh, domainname): """Creates a new Domain instance. @@ -57,6 +57,7 @@ self._services = None self._transport = None self._directory = None + self._note = None self._new = True self._load() @@ -68,7 +69,8 @@ domain. """ dbc = self._dbh.cursor() - dbc.execute('SELECT dd.gid, qid, ssid, tid, domaindir, is_primary ' + dbc.execute('SELECT dd.gid, qid, ssid, tid, domaindir, is_primary, ' + 'note ' 'FROM domain_data dd, domain_name dn WHERE domainname = ' '%s AND dn.gid = dd.gid', (self._name,)) result = dbc.fetchone() @@ -81,6 +83,7 @@ self._qlimit = QuotaLimit(self._dbh, qid=result[1]) self._services = ServiceSet(self._dbh, ssid=result[2]) self._transport = Transport(self._dbh, tid=result[3]) + self._note = result[6] self._new = False def _set_gid(self): @@ -127,7 +130,16 @@ raise DomErr(_(u"The domain '%s' already exists.") % self._name, DOMAIN_EXISTS) - def _update_tables(self, column, value, force=False): + def _update_tables(self, column, value): + """Update table columns in the domain_data table.""" + dbc = self._dbh.cursor() + dbc.execute('UPDATE domain_data SET %s = %%s WHERE gid = %%s' % column, + (value, self._gid)) + if dbc.rowcount > 0: + self._dbh.commit() + dbc.close() + + def _update_tables_ref(self, column, value, force=False): """Update various columns in the domain_data table. When *force* is `True`, the corresponding column in the users table will be reset to NULL. @@ -143,17 +155,14 @@ """ if column not in ('qid', 'ssid', 'tid'): raise ValueError('Unknown column: %r' % column) - dbc = self._dbh.cursor() - dbc.execute('UPDATE domain_data SET %s = %%s WHERE gid = %%s' % column, - (value, self._gid)) - if dbc.rowcount > 0: - self._dbh.commit() + self._update_tables(column, value) if force: + dbc = self._dbh.cursor() dbc.execute('UPDATE users SET %s = NULL WHERE gid = %%s' % column, (self._gid,)) if dbc.rowcount > 0: self._dbh.commit() - dbc.close() + dbc.close() @property def gid(self): @@ -185,6 +194,11 @@ """The Domain's transport.""" return self._transport + @property + def note(self): + """The Domain's note.""" + return self._note + def set_directory(self, basedir): |
|
From: <nev...@us...> - 2012-04-14 16:06:54
|
details: http://hg.localdomain.org/vmm/rev/1f9ea5658627 changeset: 538:1f9ea5658627 user: martin f. krafft date: Sat Apr 14 12:58:20 2012 +0200 description: Modify SQL to add note field to domain_data and users diffstat: pgsql/create_tables-dovecot-1.2.x.pgsql | 2 ++ pgsql/create_tables.pgsql | 2 ++ pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql | 7 +++++++ pgsql/update_tables_0.5.x-0.6.pgsql | 7 +++++++ 4 files changed, 18 insertions(+), 0 deletions(-) diffs (72 lines): diff -r 9a23043b0530 -r 1f9ea5658627 pgsql/create_tables-dovecot-1.2.x.pgsql --- a/pgsql/create_tables-dovecot-1.2.x.pgsql Sat Apr 14 16:02:46 2012 +0000 +++ b/pgsql/create_tables-dovecot-1.2.x.pgsql Sat Apr 14 12:58:20 2012 +0200 @@ -104,6 +104,7 @@ ssid bigint NOT NULL DEFAULT 1, -- default service set tid bigint NOT NULL DEFAULT 1, -- default transport domaindir varchar(40) NOT NULL, --/srv/mail/$RAND/4294967294 + note varchar NULL DEFAULT NULL, CONSTRAINT pkey_domain_data PRIMARY KEY (gid), CONSTRAINT fkey_domain_data_qid_quotalimit FOREIGN KEY (qid) REFERENCES quotalimit (qid), @@ -132,6 +133,7 @@ qid bigint NULL DEFAULT NULL, ssid bigint NULL DEFAULT NULL, tid bigint NULL DEFAULT NULL, + note varchar NULL DEFAULT NULL, CONSTRAINT pkey_users PRIMARY KEY (local_part, gid), CONSTRAINT ukey_users_uid UNIQUE (uid), CONSTRAINT fkey_users_gid_domain_data FOREIGN KEY (gid) diff -r 9a23043b0530 -r 1f9ea5658627 pgsql/create_tables.pgsql --- a/pgsql/create_tables.pgsql Sat Apr 14 16:02:46 2012 +0000 +++ b/pgsql/create_tables.pgsql Sat Apr 14 12:58:20 2012 +0200 @@ -104,6 +104,7 @@ ssid bigint NOT NULL DEFAULT 1, -- default service_set tid bigint NOT NULL DEFAULT 1, -- default transport domaindir varchar(40) NOT NULL, --/srv/mail/$RAND/4294967294 + note varchar NULL DEFAULT NULL, CONSTRAINT pkey_domain_data PRIMARY KEY (gid), CONSTRAINT fkey_domain_data_qid_quotalimit FOREIGN KEY (qid) REFERENCES quotalimit (qid), @@ -132,6 +133,7 @@ qid bigint NULL DEFAULT NULL, ssid bigint NULL DEFAULT NULL, tid bigint NULL DEFAULT NULL, + note varchar NULL DEFAULT NULL, CONSTRAINT pkey_users PRIMARY KEY (local_part, gid), CONSTRAINT ukey_users_uid UNIQUE (uid), CONSTRAINT fkey_users_gid_domain_data FOREIGN KEY (gid) diff -r 9a23043b0530 -r 1f9ea5658627 pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql --- a/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Sat Apr 14 16:02:46 2012 +0000 +++ b/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Sat Apr 14 12:58:20 2012 +0200 @@ -195,6 +195,13 @@ WHERE domain_data.gid = users.gid); -- --- +-- Account/domain notes +-- --- + +ALTER TABLE users ADD COLUMN note text NULL DEFAULT NULL; +ALTER TABLE domain_data ADD COLUMN note text NULL DEFAULT NULL; + +-- --- -- Restore view -- --- CREATE VIEW vmm_domain_info AS diff -r 9a23043b0530 -r 1f9ea5658627 pgsql/update_tables_0.5.x-0.6.pgsql --- a/pgsql/update_tables_0.5.x-0.6.pgsql Sat Apr 14 16:02:46 2012 +0000 +++ b/pgsql/update_tables_0.5.x-0.6.pgsql Sat Apr 14 12:58:20 2012 +0200 @@ -173,6 +173,13 @@ ); -- --- +-- Account/domain notes +-- --- + +ALTER TABLE users ADD COLUMN note text NULL DEFAULT NULL; +ALTER TABLE domain_data ADD COLUMN note text NULL DEFAULT NULL; + +-- --- -- Restore view -- --- CREATE VIEW vmm_domain_info AS |
|
From: <nev...@us...> - 2012-04-14 16:03:04
|
details: http://hg.localdomain.org/vmm/rev/9a23043b0530 changeset: 537:9a23043b0530 user: Pascal Volk date: Sat Apr 14 16:02:46 2012 +0000 description: man: vmm.1: subcommand's name argument is optional now. Based on martin f. krafft's v2 of changeset c340ba4bd544. diffstat: man/de/man1/vmm.1 | 7 ++++--- man/man1/vmm.1 | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diffs (52 lines): diff -r c340ba4bd544 -r 9a23043b0530 man/de/man1/vmm.1 --- a/man/de/man1/vmm.1 Sat Apr 14 14:33:21 2012 +0200 +++ b/man/de/man1/vmm.1 Sat Apr 14 16:02:46 2012 +0000 @@ -1,4 +1,4 @@ -.TH "VMM" "1" "2011-11-13" "vmm 0.6" "vmm" +.TH "VMM" "1" "2012-04-14" "vmm 0.6" "vmm" .SH NAME vmm \- Kommandozeilenprogramm zur Verwaltung von E\-Mail\-Domains/\-Konten und \-Aliase. @@ -691,7 +691,8 @@ .fi .\" ------------------------------------ .SS username (un) -.BI "vmm username" " address name" +.BI "vmm username" " address" +.RI [ name ] .PP Der bürgerliche Name des Kontoinhabers mit der angegebenen Adresse kann mit diesem Unterbefehl gesetzt/aktualisiert werden. @@ -978,4 +979,4 @@ .SH COPYING vmm und die dazugehörigen Manualseiten wurden von Pascal Volk <user+vmm AT localhost.localdomain.org> geschrieben und sind unter den Bedingungen der -BSD Lizenz lizenziert. +BSD Lizenz lizenziert. \ No newline at end of file diff -r c340ba4bd544 -r 9a23043b0530 man/man1/vmm.1 --- a/man/man1/vmm.1 Sat Apr 14 14:33:21 2012 +0200 +++ b/man/man1/vmm.1 Sat Apr 14 16:02:46 2012 +0000 @@ -1,4 +1,4 @@ -.TH "VMM" "1" "2012-04-12" "vmm 0.6" "vmm" +.TH "VMM" "1" "2012-04-14" "vmm 0.6" "vmm" .SH NAME vmm \- command line tool to manage email domains/accounts/aliases .\" ----------------------------------------------------------------------- @@ -657,7 +657,8 @@ .fi .\" ------------------------------------ .SS username (un) -.BI "vmm username" " address name" +.BI "vmm username" " address" +.RI [ name ] .PP The user's real .I name @@ -943,4 +944,4 @@ .SH COPYING vmm and its manual pages were written by Pascal Volk <user+vmm AT localhost.localdomain.org> and are licensed under the terms of the BSD -License. +License. \ No newline at end of file |
|
From: <nev...@us...> - 2012-04-14 15:36:08
|
details: http://hg.localdomain.org/vmm/rev/c340ba4bd544 changeset: 536:c340ba4bd544 user: martin f. krafft date: Sat Apr 14 14:33:21 2012 +0200 description: Allow username to take no argument to erase value Once a username has been set, it could not be removed via the UI. Now, if no argument is passed to username, the value stored is replaced with NULL. diffstat: VirtualMailManager/cli/subcommands.py | 8 +++++--- VirtualMailManager/handler.py | 3 --- man/de/man1/vmm.1 | 6 +++++- man/man1/vmm.1 | 4 ++++ 4 files changed, 14 insertions(+), 7 deletions(-) diffs (63 lines): diff -r e956ddc868c0 -r c340ba4bd544 VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Sat Apr 14 12:39:06 2012 +0200 +++ b/VirtualMailManager/cli/subcommands.py Sat Apr 14 14:33:21 2012 +0200 @@ -593,9 +593,11 @@ if ctx.argc < 3: usage(EX_MISSING_ARGS, _(u"Missing e-mail address and user's name."), ctx.scmd) - if ctx.argc < 4: - usage(EX_MISSING_ARGS, _(u"Missing user's name."), ctx.scmd) - ctx.hdlr.user_name(ctx.args[2].lower(), ctx.args[3]) + elif ctx.argc < 4: + name = None + else: + name = ctx.args[3] + ctx.hdlr.user_name(ctx.args[2].lower(), name) def user_password(ctx): diff -r e956ddc868c0 -r c340ba4bd544 VirtualMailManager/handler.py --- a/VirtualMailManager/handler.py Sat Apr 14 12:39:06 2012 +0200 +++ b/VirtualMailManager/handler.py Sat Apr 14 14:33:21 2012 +0200 @@ -752,9 +752,6 @@ def user_name(self, emailaddress, name): """Wrapper for Account.modify('name', ...).""" - if not isinstance(name, basestring) or not name: - raise VMMError(_(u"Could not accept name: '%s'") % name, - INVALID_ARGUMENT) acc = self._get_account(emailaddress) if not acc: raise VMMError(_(u"The account '%s' does not exist.") % diff -r e956ddc868c0 -r c340ba4bd544 man/de/man1/vmm.1 --- a/man/de/man1/vmm.1 Sat Apr 14 12:39:06 2012 +0200 +++ b/man/de/man1/vmm.1 Sat Apr 14 14:33:21 2012 +0200 @@ -693,9 +693,13 @@ .SS username (un) .BI "vmm username" " address name" .PP -Der Bürgerliche Name des Kontoinhabers mit der angegebenen Adresse kann mit +Der bürgerliche Name des Kontoinhabers mit der angegebenen Adresse kann mit diesem Unterbefehl gesetzt/aktualisiert werden. .PP +Wird kein +.I name +übergeben, so wird der Wert in den Kontoinformationen gelöscht. +.PP Beispiel: .PP .nf diff -r e956ddc868c0 -r c340ba4bd544 man/man1/vmm.1 --- a/man/man1/vmm.1 Sat Apr 14 12:39:06 2012 +0200 +++ b/man/man1/vmm.1 Sat Apr 14 14:33:21 2012 +0200 @@ -663,6 +663,10 @@ .I name can be set/updated with this subcommand. .PP +If no +.I name +is given, the value stored for the account is erased. +.PP Example: .PP .nf |
|
From: <nev...@us...> - 2012-04-14 15:33:31
|
details: http://hg.localdomain.org/vmm/rev/e956ddc868c0 changeset: 535:e956ddc868c0 user: martin f. krafft date: Sat Apr 14 12:39:06 2012 +0200 description: Add inheritance as a feature to README diffstat: README | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 6a27c7529cd7 -r e956ddc868c0 README --- a/README Sat Apr 14 12:37:08 2012 +0200 +++ b/README Sat Apr 14 12:39:06 2012 +0200 @@ -55,6 +55,8 @@ ‣ activate or deactivate one/more/all services (SMTP, POP, IMAP and ManageSieve) per account ‣ configurable quota limit (size and/or number of messages) per user + ‣ per-account configuration overrides defaults defined by the domain, + otherwise the setting is inherited ‣ unique user identifier (UID) per user • Alias features |
|
From: <nev...@us...> - 2012-04-14 15:33:23
|
details: http://hg.localdomain.org/vmm/rev/6a27c7529cd7 changeset: 534:6a27c7529cd7 user: martin f. krafft date: Sat Apr 14 12:37:08 2012 +0200 description: Change 'force' argument to reset user records for tid/ssid/qid If domain{quotalimit,transport,serviceset} are run with 'force' and settings are inheritable from the domain, then rather than to copy the ID to the user table, the affected field in the user records should be set to NULL so that the domain default is used. diffstat: VirtualMailManager/domain.py | 28 ++++++++++++++-------------- man/de/man1/vmm.1 | 29 +++++++++++++---------------- man/man1/vmm.1 | 27 +++++++++++++-------------- 3 files changed, 40 insertions(+), 44 deletions(-) diffs (184 lines): diff -r 2676dbf43e1c -r 6a27c7529cd7 VirtualMailManager/domain.py --- a/VirtualMailManager/domain.py Sat Apr 14 00:36:43 2012 +0200 +++ b/VirtualMailManager/domain.py Sat Apr 14 12:37:08 2012 +0200 @@ -129,8 +129,8 @@ def _update_tables(self, column, value, force=False): """Update various columns in the domain_data table. When *force* is - `True` also the corresponding column in the users table will be - updated. + `True`, the corresponding column in the users table will be reset to + NULL. Arguments: @@ -139,7 +139,7 @@ `value` : long The referenced key `force` : bool - enforce the new setting also for existing users. Default: `False` + reset existing users. Default: `False` """ if column not in ('qid', 'ssid', 'tid'): raise ValueError('Unknown column: %r' % column) @@ -149,8 +149,8 @@ if dbc.rowcount > 0: self._dbh.commit() if force: - dbc.execute('UPDATE users SET %s = %%s WHERE gid = %%s' % column, - (value, self._gid)) + dbc.execute('UPDATE users SET %s = NULL WHERE gid = %%s' % column, + (self._gid,)) if dbc.rowcount > 0: self._dbh.commit() dbc.close() @@ -281,9 +281,9 @@ def update_quotalimit(self, quotalimit, force=False): """Update the quota limit of the Domain. - If *force* is `True` the new *quotalimit* will be applied to - all existing accounts of the domain. Otherwise the *quotalimit* - will be only applied to accounts created from now on. + If *force* is `True`, accounts-specific overrides will be reset + for all existing accounts of the domain. Otherwise, the limit + will only affect accounts that use the default. Arguments: @@ -305,9 +305,9 @@ def update_serviceset(self, serviceset, force=False): """Assign a different set of services to the Domain, - If *force* is `True` the *serviceset* will be also assigned to - all existing accounts of the Domain. Otherwise the *serviceset* - will be only the 'default' for accounts created from now on. + If *force* is `True`, accounts-specific overrides will be reset + for all existing accounts of the domain. Otherwise, the service + set will only affect accounts that use the default. Arguments: `serviceset` : VirtualMailManager.serviceset.ServiceSet @@ -325,9 +325,9 @@ def update_transport(self, transport, force=False): """Sets a new transport for the Domain. - If *force* is `True` the new *transport* will be assigned to all - existing accounts. Otherwise the *transport* will be only used for - accounts created from now on. + If *force* is `True`, accounts-specific overrides will be reset + for all existing accounts of the domain. Otherwise, the transport + setting will only affect accounts that use the default. Arguments: diff -r 2676dbf43e1c -r 6a27c7529cd7 man/de/man1/vmm.1 --- a/man/de/man1/vmm.1 Sat Apr 14 00:36:43 2012 +0200 +++ b/man/de/man1/vmm.1 Sat Apr 14 12:37:08 2012 +0200 @@ -444,9 +444,9 @@ .PP Standardmäßig gilt für Konten das Quota\-Limit der .IR vmm.cfg " (" domain.quota_bytes " und " domain.quota_messages ). -Das neue Quota\-Limit wird für alle zukünftig angelegte Konten gelten. -Soll das neue Quota\-Limit auch auf bestehende Konten der Domain angewendet -werden, so ist das optionale Schlüsselwort +Das neue Quota\-Limit gilt für für alle bestehenden Konten, die nicht selbst +ein Quota\-Limit definieren. Soll das neue Quota\-Limit auch für Konten mit +eigenen Limiten angewendet werden, so ist das optionale Schlüsselwort .B force anzugeben. .br @@ -479,12 +479,12 @@ sind: .BR imap ", " pop3 ", " sieve " und " smtp . .br -Wurde das Schlüsselwort +Wird das Schlüsselwort .B force -nicht angegeben, gelten die Service\-Einstellungen als Vorgabewert für neu -angelegte Konten in der Domain. -Andernfalls werden sie zusätzlich auf alle bestehenden Konten der Domain -angewandt werden. +angegeben, so werden alle kontospezifischen Einstellungen gelöscht und es +gelten fortan die Service\-Einstellungen der Domain für alle Konten. Ohne +dieses Schlüsselwort gelten die neuen Einstellungen nur für Konten, bei denen +die Service-Einstellungen nicht individuell geändert wurden. .\" ------------------------------------ .SS domaintransport (dt) .BI "vmm domaintransport" " fqdn transport" @@ -496,15 +496,12 @@ .I fqdn kann mit diesem Unterbefehl festgelegt werden. .PP -Wurde das optionale Schlüsselwort +Wird das Schlüsselwort .B force -angegeben, so werden alle bisherigen Transport\-Einstellungen, der in -dieser Domain vorhandenen Konten, mit dem neuen -.I transport -überschrieben. -Andernfalls gilt der neue -.I transport -nur für Konten, die zukünftig erstellt werden. +angegeben, so werden alle kontospezifischen Einstellungen gelöscht und es +gelten fortan die Transport\-Einstellungen der Domain für alle Konten. Ohne +dieses Schlüsselwort gelten die neuen Einstellungen nur für Konten, bei denen +die Transport-Einstellungen nicht individuell geändert wurden. .PP Beispiel: .PP diff -r 2676dbf43e1c -r 6a27c7529cd7 man/man1/vmm.1 --- a/man/man1/vmm.1 Sat Apr 14 00:36:43 2012 +0200 +++ b/man/man1/vmm.1 Sat Apr 14 12:37:08 2012 +0200 @@ -421,9 +421,10 @@ .PP The default quota limit for accounts is defined in the .IR vmm.cfg " (" domain.quota_bytes " and " domain.quota_messages ). -The new quota limit will be applied to all newly created accounts. -If you want to apply the new quota limit also to existing accounts, you -have to give the optional keyword +.PP +The new quota limit will affect only those accounts for which the limit +has not been overridden. If you want to restore the default to all accounts, +you may pass the keyword .BR force . .br When the argument @@ -455,12 +456,10 @@ Possible service names are: .BR imap ", " pop3 ", " sieve " and " smtp . .br -When the keyword -.B force -was omitted, the service setting will be the default for new created -accounts. -Otherwise it will additionally apply the settings to all existing accounts -of the domain. +The new service set will affect only those accounts for which the set has not +been overridden. If you want to restore the default to all accounts, you may +pass the keyword +.BR force . .\" ------------------------------------ .SS domaintransport (dt) .BI "vmm domaintransport" " fqdn transport" @@ -468,10 +467,10 @@ .PP A new transport for the indicated domain can be set with this subcommand. .PP -If the optional keyword -.B force -is given all account specific transport settings will be also updated. -Otherwise this setting will affect only new created accounts. +The new transport will affect only those accounts for which the transport has +not been overridden. If you want to restore the default to all accounts, you +may pass the keyword +.BR force . .PP Example: .PP @@ -940,4 +939,4 @@ .SH COPYING vmm and its manual pages were written by Pascal Volk <user+vmm AT localhost.localdomain.org> and are licensed under the terms of the BSD -License. \ No newline at end of file +License. |
|
From: <nev...@us...> - 2012-04-14 15:33:14
|
details: http://hg.localdomain.org/vmm/rev/2676dbf43e1c changeset: 533:2676dbf43e1c user: martin f. krafft date: Sat Apr 14 00:36:43 2012 +0200 description: Change UI to accept 'default' to restore inherited values Instead of explicit values for tid/ssid/qid, the UI now accepts 'default', which removed user-pecific settings and hence causes domain defaults to be used. diffstat: VirtualMailManager/cli/subcommands.py | 11 +++++---- VirtualMailManager/handler.py | 39 +++++++++++++++++++++------------- man/de/man1/vmm.1 | 21 ++++++++++++++++-- man/man1/vmm.1 | 15 +++++++++++++ 4 files changed, 63 insertions(+), 23 deletions(-) diffs (203 lines): diff -r 2bb40aaef94e -r 2676dbf43e1c VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Fri Apr 13 23:24:12 2012 +0200 +++ b/VirtualMailManager/cli/subcommands.py Sat Apr 14 00:36:43 2012 +0200 @@ -617,7 +617,8 @@ elif ctx.argc < 4: usage(EX_MISSING_ARGS, _(u'Missing storage value.'), ctx.scmd) try: - bytes_ = size_in_bytes(ctx.args[3]) + bytes_ = ctx.args[3] if ctx.args[3] == 'default' \ + else size_in_bytes(ctx.args[3]) except (ValueError, TypeError): usage(INVALID_ARGUMENT, _(u"Invalid storage value: '%s'") % ctx.args[3], ctx.scmd) @@ -641,7 +642,7 @@ if ctx.argc >= 4: services.extend([service.lower() for service in ctx.args[3:]]) unknown = [service for service in services if service not in SERVICES] - if unknown: + if unknown and ctx.args[3] != 'default': usage(INVALID_ARGUMENT, _(u'Invalid service arguments: %s') % ' '.join(unknown), ctx.scmd) ctx.hdlr.user_services(ctx.args[2].lower(), *services) @@ -719,14 +720,14 @@ 'address [password]', _(u'update the password for the given address')), 'userquota': cmd('userquota', 'uq', user_quota, - 'address storage [messages]', + 'address storage [messages] | address default', _(u'update the quota limit for the given address')), 'userservices': cmd('userservices', 'us', user_services, - 'address [service ...]', + 'address [service ...] | address default', _(u'enables the specified services and disables all ' u'not specified services')), 'usertransport': cmd('usertransport', 'ut', user_transport, - 'address transport', + 'address transport | address default', _(u'update the transport of the given address')), # Alias commands 'aliasadd': cmd('aliasadd', 'aa', alias_add, 'address destination ...', diff -r 2bb40aaef94e -r 2676dbf43e1c VirtualMailManager/handler.py --- a/VirtualMailManager/handler.py Fri Apr 13 23:24:12 2012 +0200 +++ b/VirtualMailManager/handler.py Sat Apr 14 00:36:43 2012 +0200 @@ -763,15 +763,19 @@ def user_quotalimit(self, emailaddress, bytes_, messages=0): """Wrapper for Account.update_quotalimit(QuotaLimit).""" - if not all(isinstance(i, (int, long)) for i in (bytes_, messages)): - raise TypeError("'bytes_' and 'messages' have to be " - "integers or longs.") acc = self._get_account(emailaddress) if not acc: raise VMMError(_(u"The account '%s' does not exist.") % - acc.address, NO_SUCH_ACCOUNT) - acc.update_quotalimit(QuotaLimit(self._dbh, bytes=bytes_, - messages=messages)) + acc.address, NO_SUCH_ACCOUNT) + if bytes_ == 'default': + quotalimit = None + else: + if not all(isinstance(i, (int, long)) for i in (bytes_, messages)): + raise TypeError("'bytes_' and 'messages' have to be " + "integers or longs.") + quotalimit = QuotaLimit(self._dbh, bytes=bytes_, + messages=messages) + acc.update_quotalimit(quotalimit) def user_transport(self, emailaddress, transport): """Wrapper for Account.update_transport(Transport).""" @@ -782,21 +786,26 @@ if not acc: raise VMMError(_(u"The account '%s' does not exist.") % acc.address, NO_SUCH_ACCOUNT) - acc.update_transport(Transport(self._dbh, transport=transport)) + transport = None if transport == 'default' \ + else Transport(self._dbh, transport=transport) + acc.update_transport(transport) def user_services(self, emailaddress, *services): """Wrapper around Account.update_serviceset().""" - kwargs = dict.fromkeys(SERVICES, False) - for service in set(services): - if service not in SERVICES: - raise VMMError(_(u"Unknown service: '%s'") % service, - UNKNOWN_SERVICE) - kwargs[service] = True acc = self._get_account(emailaddress) if not acc: raise VMMError(_(u"The account '%s' does not exist.") % - acc.address, NO_SUCH_ACCOUNT) - serviceset = ServiceSet(self._dbh, **kwargs) + acc.address, NO_SUCH_ACCOUNT) + if len(services) == 1 and services[0] == 'default': + serviceset = None + else: + kwargs = dict.fromkeys(SERVICES, False) + for service in set(services): + if service not in SERVICES: + raise VMMError(_(u"Unknown service: '%s'") % service, + UNKNOWN_SERVICE) + kwargs[service] = True + serviceset = ServiceSet(self._dbh, **kwargs) acc.update_serviceset(serviceset) def relocated_add(self, emailaddress, targetaddress): diff -r 2bb40aaef94e -r 2676dbf43e1c man/de/man1/vmm.1 --- a/man/de/man1/vmm.1 Fri Apr 13 23:24:12 2012 +0200 +++ b/man/de/man1/vmm.1 Sat Apr 14 00:36:43 2012 +0200 @@ -734,10 +734,15 @@ .B 0 (null) als Anzahl von Nachrichten angewendet werden. .PP +Anstelle einer Limite, bewirkt das Wort 'default', daß die Limite des +Kontos gelöscht wird und somit wieder der in der Domain gespeicherte +Wert für das Konto gilt. +.PP Beispiel: .PP .nf .B vmm userquota d....@ex... 750m +.B vmm userquote d....@ex... default .fi .\" ------------------------------------ .SS userservices (us) @@ -750,10 +755,15 @@ Der Zugriff auf alle nicht genannten Services wird dem Anwender, mit der angegebenen Adresse, verwehrt werden. .PP +Anstelle einer Liste, bewirkt das Wort 'default', daß die benutzerspezifische +Liste gelöscht wird und somit wieder die in der Domain gespeicherte +Liste für das Konto gilt. +.PP Beispiel: -.PP\ +.PP .nf .B vmm userservices d....@ex... SMTP IMAP +.B vmm userservices d....@ex... default .\" ------------------------------------ .SS usertransport (ut) .BI "vmm usertransport" " address transport" @@ -762,6 +772,11 @@ .I transport für das Konto mit der angegebenen Adresse bestimmt werden. .PP +Wird als +.I transport +das Wort 'default' übergeben, so wird der explizite Transport des Kontos +wieder gelöscht und der in der Domain gespeicherte Wert benutzt. +.PP Beispiel: .br Angenommen, Sie wollen mit Dovecots @@ -773,8 +788,8 @@ .nf .B vmm ut d....@ex... \(dqretry:4.0.0 Mailbox being migrated\(dq # Konvertieren der Mailbox … -# … danach den Transport auf Dovecots lmtp setzen -.B vmm usertransport d....@ex... lmtp:unix:private/dovecot\-lmtp +# … danach den Transport auf den Domain-Default setzen +.B vmm usertransport d....@ex... default .fi .\" ----------------------------------------------------------------------- .SH ALIAS UNTERBEFEHLE diff -r 2bb40aaef94e -r 2676dbf43e1c man/man1/vmm.1 --- a/man/man1/vmm.1 Fri Apr 13 23:24:12 2012 +0200 +++ b/man/man1/vmm.1 Sat Apr 14 00:36:43 2012 +0200 @@ -700,6 +700,11 @@ .B 0 (zero) will be applied. .PP +Instead of +.I transport +pass 'default' to remove the account-specific override, causing the +domain's value to be in effect. +.PP Example: .PP .nf @@ -716,6 +721,11 @@ given .IR address . .PP +Instead of +.I transport +pass 'default' to remove the account-specific override, causing the +domain's value to be in effect. +.PP Example: .PP\ .nf @@ -728,6 +738,11 @@ .I transport for an account can be specified with this subcommand. .PP +Instead of +.I transport +pass 'default' to remove the account-specific override, causing the +domain's value to be in effect. +.PP Example: .br Assumed you want to use Dovecot's |
|
From: <nev...@us...> - 2012-04-14 15:33:04
|
details: http://hg.localdomain.org/vmm/rev/2bb40aaef94e changeset: 532:2bb40aaef94e user: martin f. krafft date: Fri Apr 13 23:24:12 2012 +0200 description: Modify userinfo output to indicate when domain defaults are displayed When Account instances reference NULL tid/qid/ssid, the data must come from the associated domain, and this should be indicated. For transport and services, this is easy to do as the string passed in the info dict can simply be modified. For quotalimit, however, another method must be used due to the CLI-side formatting. All approaches use a common formatter outsourced to the common.py file. diffstat: VirtualMailManager/account.py | 18 +++++++++++++----- VirtualMailManager/cli/subcommands.py | 20 ++++++++++++-------- VirtualMailManager/common.py | 3 +++ 3 files changed, 28 insertions(+), 13 deletions(-) diffs (108 lines): diff -r cf3eb03c1c4f -r 2bb40aaef94e VirtualMailManager/account.py --- a/VirtualMailManager/account.py Fri Apr 13 23:09:40 2012 +0200 +++ b/VirtualMailManager/account.py Fri Apr 13 23:24:12 2012 +0200 @@ -8,7 +8,8 @@ Virtual Mail Manager's Account class to manage e-mail accounts. """ -from VirtualMailManager.common import version_str +from VirtualMailManager.common import version_str, \ + format_domain_default from VirtualMailManager.constants import \ ACCOUNT_EXISTS, ACCOUNT_MISSING_PASSWORD, ALIAS_PRESENT, \ INVALID_ARGUMENT, INVALID_MAIL_LOCATION, NO_SUCH_ACCOUNT, \ @@ -349,7 +350,8 @@ The keys of the dict are: 'address', 'gid', 'home', 'imap' 'mail_location', 'name', 'pop3', 'sieve', 'smtp', transport', 'uid', - 'uq_bytes', 'uq_messages', 'ql_bytes', and 'ql_messages'. + 'uq_bytes', 'uq_messages', 'ql_bytes', 'ql_messages', and + 'ql_domaindefault'. """ self._chk_state() dbc = self._dbh.cursor() @@ -366,9 +368,15 @@ info['gid'] = self._domain.gid info['home'] = '%s/%s' % (self._domain.directory, self._uid) info['mail_location'] = self._mail.mail_location - info['ql_bytes'] = self._qlimit.bytes - info['ql_messages'] = self._qlimit.messages - info['transport'] = self._transport.transport + if self._qlimit: + info['ql_bytes'] = self._qlimit.bytes + info['ql_messages'] = self._qlimit.messages + info['ql_domaindefault'] = False + else: + info['ql_bytes'] = self._domain.quotalimit.bytes + info['ql_messages'] = self._domain.quotalimit.messages + info['ql_domaindefault'] = True + info['transport'] = self._get_info_transport() info['uid'] = self._uid return info # nearly impossible‽ diff -r cf3eb03c1c4f -r 2bb40aaef94e VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Fri Apr 13 23:09:40 2012 +0200 +++ b/VirtualMailManager/cli/subcommands.py Fri Apr 13 23:24:12 2012 +0200 @@ -16,7 +16,8 @@ from VirtualMailManager import ENCODING from VirtualMailManager.cli import get_winsize, prog, w_err, w_std -from VirtualMailManager.common import human_size, size_in_bytes, version_str +from VirtualMailManager.common import human_size, size_in_bytes, \ + version_str, format_domain_default from VirtualMailManager.constants import __copyright__, __date__, \ __version__, ACCOUNT_EXISTS, ALIAS_EXISTS, ALIASDOMAIN_ISDOMAIN, \ DOMAIN_ALIAS_EXISTS, INVALID_ARGUMENT, EX_MISSING_ARGS, RELOCATED_EXISTS @@ -572,15 +573,17 @@ else: if details in (None, 'du'): info['quota storage'] = _format_quota_usage(info['ql_bytes'], - info['uq_bytes'], True) + info['uq_bytes'], True, info['ql_domaindefault']) info['quota messages'] = _format_quota_usage(info['ql_messages'], - info['uq_messages']) + info['uq_messages'], domaindefault=info['ql_domaindefault']) _print_info(ctx, info, _(u'Account')) else: info[0]['quota storage'] = _format_quota_usage(info[0]['ql_bytes'], - info[0]['uq_bytes'], True) - info[0]['quota messages'] = _format_quota_usage( - info[0]['ql_messages'], info[0]['uq_messages']) + info[0]['uq_bytes'], True, info[0]['ql_domaindefault']) + info[0]['quota messages'] = \ + _format_quota_usage(info[0]['ql_messages'], + info[0]['uq_messages'], + domaindefault=info[0]['ql_domaindefault']) _print_info(ctx, info[0], _(u'Account')) _print_list(info[1], _(u'alias addresses')) @@ -830,7 +833,7 @@ return order -def _format_quota_usage(limit, used, human=False): +def _format_quota_usage(limit, used, human=False, domaindefault=False): """Put quota's limit / usage / percentage in a formatted string.""" if human: q_usage = { @@ -846,7 +849,8 @@ q_usage['percent'] = locale.format('%6.2f', 100. / limit * used, True) else: q_usage['percent'] = locale.format('%6.2f', 0, True) - return _(u'[%(percent)s%%] %(used)s/%(limit)s') % q_usage + fmt = format_domain_default if domaindefault else lambda s: s + return fmt(_(u'[%(percent)s%%] %(used)s/%(limit)s') % q_usage) def _print_info(ctx, info, title): diff -r cf3eb03c1c4f -r 2bb40aaef94e VirtualMailManager/common.py --- a/VirtualMailManager/common.py Fri Apr 13 23:09:40 2012 +0200 +++ b/VirtualMailManager/common.py Fri Apr 13 23:24:12 2012 +0200 @@ -186,4 +186,7 @@ _version_cache[version] = version_string return version_string +def format_domain_default(domaindata): + return _(u'%s [domain default]') % domaindata + del _ |
|
From: <nev...@us...> - 2012-04-14 15:32:55
|
details: http://hg.localdomain.org/vmm/rev/cf3eb03c1c4f changeset: 531:cf3eb03c1c4f user: martin f. krafft date: Fri Apr 13 23:09:40 2012 +0200 description: Modify Account class to handle NULL references This patch modifies the Account class to defer to using the associated domain's tid/ssid/qid fields if the per-instance fields are None/NULL. diffstat: VirtualMailManager/account.py | 86 +++++++++++++++++++++++++++++------------- 1 files changed, 59 insertions(+), 27 deletions(-) diffs (147 lines): diff -r 95dd123b552e -r cf3eb03c1c4f VirtualMailManager/account.py --- a/VirtualMailManager/account.py Fri Apr 13 17:49:14 2012 +0200 +++ b/VirtualMailManager/account.py Fri Apr 13 23:09:40 2012 +0200 @@ -59,9 +59,9 @@ self._addr.domainname, NO_SUCH_DOMAIN) self._uid = 0 self._mail = None - self._qlimit = self._domain.quotalimit - self._services = self._domain.serviceset - self._transport = self._domain.transport + self._qlimit = None + self._services = None + self._transport = None self._passwd = None self._new = True self._load() @@ -81,12 +81,19 @@ dbc.close() if result: self._uid, _mid, _qid, _ssid, _tid = result - if _qid != self._qlimit.qid: - self._qlimit = QuotaLimit(self._dbh, qid=_qid) - if _ssid != self._services.ssid: - self._services = ServiceSet(self._dbh, ssid=_ssid) - if _tid != self._transport.tid: - self._transport = Transport(self._dbh, tid=_tid) + + def load_helper(ctor, own, field, dbresult): + cur = None if own is None else getattr(own, field) + if cur != dbresult: + kwargs = { field : dbresult } + return None if dbresult is None \ + else ctor(self._dbh, **kwargs) + + self._qlimit = load_helper(QuotaLimit, self._qlimit, 'qid', _qid) + self._services = load_helper(ServiceSet, self._services, 'ssid', + _ssid) + self._transport = load_helper(Transport, self._transport, 'tid', + _tid) self._mail = MailLocation(self._dbh, mid=_mid) self._new = False @@ -223,8 +230,10 @@ 'qid, ssid, tid) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)', (self._addr.localpart, pwhash(self._passwd, user=self._addr), self._uid, - self._domain.gid, self._mail.mid, self._qlimit.qid, - self._services.ssid, self._transport.tid)) + self._domain.gid, self._mail.mid, + self._qlimit.qid if self._qlimit else None, + self._services.ssid if self._services else None, + self._transport.tid if self._transport else None)) self._dbh.commit() dbc.close() self._new = False @@ -267,11 +276,13 @@ raise VMMError(_(u'PostgreSQL-based dictionary quota requires ' u'Dovecot >= v1.1.2.'), VMM_ERROR) self._chk_state() - assert isinstance(quotalimit, QuotaLimit) if quotalimit == self._qlimit: return - self._update_tables('qid', quotalimit.qid) self._qlimit = quotalimit + if quotalimit is not None: + assert isinstance(quotalimit, QuotaLimit) + quotalimit = quotalimit.qid + self._update_tables('qid', quotalimit) def update_serviceset(self, serviceset): """Assign a different set of services to the Account. @@ -282,11 +293,13 @@ the new service set. """ self._chk_state() - assert isinstance(serviceset, ServiceSet) if serviceset == self._services: return - self._update_tables('ssid', serviceset.ssid) self._services = serviceset + if serviceset is not None: + assert isinstance(serviceset, ServiceSet) + serviceset = serviceset.ssid + self._update_tables('ssid', serviceset) def update_transport(self, transport): """Sets a new transport for the Account. @@ -297,17 +310,39 @@ the new transport """ self._chk_state() - assert isinstance(transport, Transport) if transport == self._transport: return - if transport.transport.lower() in ('virtual', 'virtual:') and \ - not self._mail.postfix: - raise AErr(_(u"Invalid transport '%(transport)s' for mailbox " - u"format '%(mbfmt)s'.") % - {'transport': transport, 'mbfmt': self._mail.mbformat}, - INVALID_MAIL_LOCATION) - self._update_tables('tid', transport.tid) self._transport = transport + if transport is not None: + assert isinstance(transport, Transport) + if transport.transport.lower() in ('virtual', 'virtual:') and \ + not self._mail.postfix: + raise AErr(_(u"Invalid transport '%(transport)s' for mailbox " + u"format '%(mbfmt)s'.") % + {'transport': transport, 'mbfmt': self._mail.mbformat}, + INVALID_MAIL_LOCATION) + transport = transport.tid + self._update_tables('tid', transport) + + def _get_info_transport(self): + if self._transport: + return self._transport.transport + return format_domain_default(self._domain.transport.transport) + + def _get_info_serviceset(self): + if self._services: + services = self._services.services + fmt = lambda s: s + else: + services = self._domain.serviceset.services + fmt = format_domain_default + + ret = {} + for service, state in services.iteritems(): + # TP: A service (e.g. pop3 or imap) may be enabled/usable or + # disabled/unusable for a user. + ret[service] = fmt((_('disabled'), _('enabled'))[state]) + return ret def get_info(self): """Returns a dict with some information about the Account. @@ -326,10 +361,7 @@ dbc.close() if info: info = dict(zip(('name', 'uq_bytes', 'uq_messages'), info)) - for service, state in self._services.services.iteritems(): - # TP: A service (e.g. pop3 or imap) may be enabled/usable or - # disabled/unusable for a user. - info[service] = (_('disabled'), _('enabled'))[state] + info.update(self._get_info_serviceset()) info['address'] = self._addr info['gid'] = self._domain.gid info['home'] = '%s/%s' % (self._domain.directory, self._uid) |
|
From: <nev...@us...> - 2012-04-14 15:32:39
|
details: http://hg.localdomain.org/vmm/rev/95dd123b552e changeset: 530:95dd123b552e user: martin f. krafft date: Fri Apr 13 17:49:14 2012 +0200 description: Modify SQL update script to accept NULL fields for users The value NULL in the qid/ssid/tid fields of the user table means that the value from the associated domain record should be used instead. This patch modifies the PL/pgSQL functions used by Dovecot and Postfix accordingly. diffstat: pgsql/create_tables-dovecot-1.2.x.pgsql | 47 +++++++++++----- pgsql/create_tables.pgsql | 46 +++++++++++----- pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql | 63 +++++++++++++++++----- pgsql/update_tables_0.5.x-0.6.pgsql | 62 +++++++++++++++++---- 4 files changed, 162 insertions(+), 56 deletions(-) diffs (truncated from 392 to 300 lines): diff -r 916b468cf994 -r 95dd123b552e pgsql/create_tables-dovecot-1.2.x.pgsql --- a/pgsql/create_tables-dovecot-1.2.x.pgsql Fri Apr 13 23:49:26 2012 +0200 +++ b/pgsql/create_tables-dovecot-1.2.x.pgsql Fri Apr 13 17:49:14 2012 +0200 @@ -129,9 +129,9 @@ uid bigint NOT NULL DEFAULT nextval('users_uid'), gid bigint NOT NULL, mid bigint NOT NULL DEFAULT 1, - qid bigint NOT NULL DEFAULT 1, - ssid bigint NOT NULL DEFAULT 1, - tid bigint NOT NULL DEFAULT 1, + qid bigint NULL DEFAULT NULL, + ssid bigint NULL DEFAULT NULL, + tid bigint NULL DEFAULT NULL, CONSTRAINT pkey_users PRIMARY KEY (local_part, gid), CONSTRAINT ukey_users_uid UNIQUE (uid), CONSTRAINT fkey_users_gid_domain_data FOREIGN KEY (gid) @@ -369,12 +369,19 @@ BEGIN FOR record IN SELECT userid, passwd, smtp, pop3, imap, sieve - FROM users, service_set - WHERE gid = (SELECT gid - FROM domain_name - WHERE domainname = the_domain) + FROM users, service_set, domain_data + WHERE users.gid = (SELECT gid + FROM domain_name + WHERE domainname = the_domain) AND local_part = localpart - AND service_set.ssid = users.ssid + AND users.gid = domain_data.gid + AND CASE WHEN + users.ssid IS NOT NULL + THEN + service_set.ssid = users.ssid + ELSE + service_set.ssid = domain_data.ssid + END LOOP RETURN NEXT record; END LOOP; @@ -411,7 +418,13 @@ AND maillocation.mid = users.mid AND mailboxformat.fid = maillocation.fid AND domain_data.gid = did - AND quotalimit.qid = users.qid + AND CASE WHEN + users.qid IS NOT NULL + THEN + quotalimit.qid = users.qid + ELSE + quotalimit.qid = domain_data.qid + END LOOP RETURN NEXT record; END LOOP; @@ -555,16 +568,20 @@ DECLARE record recipient_transport; recipient varchar(320) := localpart || '@' || the_domain; + did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain); + transport_id bigint := (SELECT tid FROM users + WHERE gid = did AND local_part = localpart); BEGIN + IF transport_id IS NULL THEN + SELECT tid INTO STRICT transport_id + FROM domain_data + WHERE gid = did; + END IF; + FOR record IN SELECT recipient, transport FROM transport - WHERE tid = (SELECT tid - FROM users - WHERE gid = (SELECT gid - FROM domain_name - WHERE domainname = the_domain) - AND local_part = localpart) + WHERE tid = transport_id LOOP RETURN NEXT record; END LOOP; diff -r 916b468cf994 -r 95dd123b552e pgsql/create_tables.pgsql --- a/pgsql/create_tables.pgsql Fri Apr 13 23:49:26 2012 +0200 +++ b/pgsql/create_tables.pgsql Fri Apr 13 17:49:14 2012 +0200 @@ -129,9 +129,9 @@ uid bigint NOT NULL DEFAULT nextval('users_uid'), gid bigint NOT NULL, mid bigint NOT NULL DEFAULT 1, - qid bigint NOT NULL DEFAULT 1, - ssid bigint NOT NULL DEFAULT 1, - tid bigint NOT NULL DEFAULT 1, + qid bigint NULL DEFAULT NULL, + ssid bigint NULL DEFAULT NULL, + tid bigint NULL DEFAULT NULL, CONSTRAINT pkey_users PRIMARY KEY (local_part, gid), CONSTRAINT ukey_users_uid UNIQUE (uid), CONSTRAINT fkey_users_gid_domain_data FOREIGN KEY (gid) @@ -346,12 +346,20 @@ BEGIN FOR record IN SELECT userid, passwd, smtp, pop3, imap, managesieve - FROM users, service_set - WHERE gid = (SELECT gid - FROM domain_name - WHERE domainname = the_domain) + FROM users, service_set, domain_data + WHERE users.gid = (SELECT gid + FROM domain_name + WHERE domainname = the_domain) AND local_part = localpart AND service_set.ssid = users.ssid + AND users.gid = domain_data.gid + AND CASE WHEN + users.ssid IS NOT NULL + THEN + service_set.ssid = users.ssid + ELSE + service_set.ssid = domain_data.ssid + END LOOP RETURN NEXT record; END LOOP; @@ -388,7 +396,13 @@ AND maillocation.mid = users.mid AND mailboxformat.fid = maillocation.fid AND domain_data.gid = did - AND quotalimit.qid = users.qid + AND CASE WHEN + users.qid IS NOT NULL + THEN + quotalimit.qid = users.qid + ELSE + quotalimit.qid = domain_data.qid + END LOOP RETURN NEXT record; END LOOP; @@ -532,16 +546,20 @@ DECLARE record recipient_transport; recipient varchar(320) := localpart || '@' || the_domain; + did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain); + transport_id bigint := (SELECT tid FROM users + WHERE gid = did AND local_part = localpart); BEGIN + IF transport_id IS NULL THEN + SELECT tid INTO STRICT transport_id + FROM domain_data + WHERE gid = did; + END IF; + FOR record IN SELECT recipient, transport FROM transport - WHERE tid = (SELECT tid - FROM users - WHERE gid = (SELECT gid - FROM domain_name - WHERE domainname = the_domain) - AND local_part = localpart) + WHERE tid = transport_id LOOP RETURN NEXT record; END LOOP; diff -r 916b468cf994 -r 95dd123b552e pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql --- a/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Fri Apr 13 23:49:26 2012 +0200 +++ b/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql Fri Apr 13 17:49:14 2012 +0200 @@ -91,7 +91,7 @@ ALTER TABLE domain_data ADD CONSTRAINT fkey_domain_data_qid_quotalimit FOREIGN KEY (qid) REFERENCES quotalimit (qid); -ALTER TABLE users ADD COLUMN qid bigint NOT NULL DEFAULT 1; +ALTER TABLE users ADD COLUMN qid bigint NULL DEFAULT NULL; ALTER TABLE users ADD CONSTRAINT fkey_users_qid_quotalimit FOREIGN KEY (qid) REFERENCES quotalimit (qid); @@ -147,7 +147,7 @@ ALTER TABLE domain_data ADD CONSTRAINT fkey_domain_data_ssid_service_set FOREIGN KEY (ssid) REFERENCES service_set (ssid); -ALTER TABLE users ADD COLUMN ssid bigint NOT NULL DEFAULT 1; +ALTER TABLE users ADD COLUMN ssid bigint NULL DEFAULT NULL; -- save current service sets UPDATE users u SET ssid = ss.ssid @@ -177,6 +177,24 @@ ); -- --- +-- Quota/Service/Transport inheritance +-- --- +ALTER TABLE users ALTER COLUMN tid DROP NULL; +ALTER TABLE users ALTER COLUMN tid SET DEFAULT NULL; +-- The qid and ssid columns have already been defined accordingly above. +-- The rest of the logic will take place in the functions. + +-- While qid and ssid are new and it's perfectly okay for existing users to +-- get NULL values (i.e. inherit from the domain's default), tid existed in +-- vmm 0.5.x. A sensible way forward seems thus to NULL all user records' tid +-- fields where the tid duplicates the value stored in the domain's record. +UPDATE users + SET tid = NULL + WHERE tid = (SELECT tid + FROM domain_data + WHERE domain_data.gid = users.gid); + +-- --- -- Restore view -- --- CREATE VIEW vmm_domain_info AS @@ -299,12 +317,19 @@ BEGIN FOR record IN SELECT userid, passwd, smtp, pop3, imap, sieve - FROM users, service_set - WHERE gid = (SELECT gid - FROM domain_name - WHERE domainname = the_domain) + FROM users, service_set, domain_data + WHERE users.gid = (SELECT gid + FROM domain_name + WHERE domainname = the_domain) AND local_part = localpart - AND service_set.ssid = users.ssid + AND users.gid = domain_data.gid + AND CASE WHEN + users.ssid IS NOT NULL + THEN + service_set.ssid = users.ssid + ELSE + service_set.ssid = domain_data.ssid + END LOOP RETURN NEXT record; END LOOP; @@ -335,7 +360,13 @@ AND maillocation.mid = users.mid AND mailboxformat.fid = maillocation.fid AND domain_data.gid = did - AND quotalimit.qid = users.qid + AND CASE WHEN + users.qid IS NOT NULL + THEN + quotalimit.qid = users.qid + ELSE + quotalimit.qid = domain_data.qid + END LOOP RETURN NEXT record; END LOOP; @@ -457,16 +488,20 @@ DECLARE record recipient_transport; recipient varchar(320) := localpart || '@' || the_domain; + did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain); + transport_id bigint := (SELECT tid FROM users + WHERE gid = did AND local_part = localpart); BEGIN + IF transport_id IS NULL THEN + SELECT tid INTO STRICT transport_id + FROM domain_data + WHERE gid = did; + END IF; + FOR record IN SELECT recipient, transport FROM transport - WHERE tid = (SELECT tid - FROM users - WHERE gid = (SELECT gid - FROM domain_name - WHERE domainname = the_domain) - AND local_part = localpart) + WHERE tid = transport_id LOOP RETURN NEXT record; END LOOP; diff -r 916b468cf994 -r 95dd123b552e pgsql/update_tables_0.5.x-0.6.pgsql --- a/pgsql/update_tables_0.5.x-0.6.pgsql Fri Apr 13 23:49:26 2012 +0200 +++ b/pgsql/update_tables_0.5.x-0.6.pgsql Fri Apr 13 17:49:14 2012 +0200 @@ -91,7 +91,7 @@ ALTER TABLE domain_data ADD CONSTRAINT fkey_domain_data_qid_quotalimit FOREIGN KEY (qid) REFERENCES quotalimit (qid); -ALTER TABLE users ADD COLUMN qid bigint NOT NULL DEFAULT 1; +ALTER TABLE users ADD COLUMN qid bigint NULL DEFAULT NULL; ALTER TABLE users ADD CONSTRAINT fkey_users_qid_quotalimit FOREIGN KEY (qid) REFERENCES quotalimit (qid); @@ -125,7 +125,7 @@ ALTER TABLE domain_data ADD CONSTRAINT fkey_domain_data_ssid_service_set FOREIGN KEY (ssid) REFERENCES service_set (ssid); -ALTER TABLE users ADD COLUMN ssid bigint NOT NULL DEFAULT 1; +ALTER TABLE users ADD COLUMN ssid bigint NULL DEFAULT NULL; -- save current service sets UPDATE users u SET ssid = ss.ssid |