Change 'force' argument to reset user records for tid/ssid/qid v0.6.x
authormartin f. krafft <madduck@madduck.net>
Sat, 14 Apr 2012 12:37:08 +0200
branchv0.6.x
changeset 534 6a27c7529cd7
parent 533 2676dbf43e1c
child 535 e956ddc868c0
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.
VirtualMailManager/domain.py
man/de/man1/vmm.1
man/man1/vmm.1
--- 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:
 
--- 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
--- 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.