mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
New parameter to choose between dovecot and postfix as LDA.
The CREATE_DIRECTORIES parameter has been removed. Mailboxes will only be created when postfix is the LDA. fix #388
This commit is contained in:
@@ -33,24 +33,29 @@ parameters.register_admin(
|
||||
help=ugettext_lazy("The backend used for authentication")
|
||||
)
|
||||
parameters.register_admin(
|
||||
"CREATE_DIRECTORIES", type="list_yesno", deflt="yes",
|
||||
help=ugettext_lazy("Modoboa will handle mailbox creation on filesystem")
|
||||
"LDA", type="list", deflt="dovecot",
|
||||
values=[('dovecot', "Dovecot"), ('postfix', 'Postfix')],
|
||||
help=ugettext_lazy("Local Delivery Agent")
|
||||
)
|
||||
parameters.register_admin(
|
||||
"STORAGE_PATH", type="string", deflt="/var/vmail",
|
||||
visible_if="LDA=postfix",
|
||||
help=ugettext_lazy("Path to the root directory where messages are stored")
|
||||
)
|
||||
parameters.register_admin(
|
||||
"VIRTUAL_UID", type="string", deflt="vmail", modify_cb=update_uid,
|
||||
visible_if="LDA=postfix",
|
||||
help=ugettext_lazy("UID of the virtual user which owns domains/mailboxes/messages on the filesystem")
|
||||
)
|
||||
parameters.register_admin(
|
||||
"VIRTUAL_GID", type="string", deflt="vmail", modify_cb=update_gid,
|
||||
visible_if="LDA=postfix",
|
||||
help=ugettext_lazy("GID of the virtual user which owns domains/mailboxes/messages on the filesystem")
|
||||
)
|
||||
parameters.register_admin(
|
||||
"MAILBOX_TYPE", type="list", deflt="maildir",
|
||||
values=[("maildir", "maildir"), ("mbox", "mbox")],
|
||||
visible_if="LDA=postfix",
|
||||
help=ugettext_lazy("Mailboxes storage format")
|
||||
)
|
||||
parameters.register_admin(
|
||||
|
||||
@@ -549,21 +549,21 @@ class Domain(DatesAware):
|
||||
return [oa.user for oa in self.owners.filter(user__is_superuser=False)]
|
||||
|
||||
def create_dir(self):
|
||||
if parameters.get_admin("CREATE_DIRECTORIES") == "yes":
|
||||
if parameters.get_admin("LDA") == "postfix":
|
||||
path = "%s/%s" % (parameters.get_admin("STORAGE_PATH"), self.name)
|
||||
return exec_as_vuser("mkdir -p %s" % path)
|
||||
|
||||
return True
|
||||
|
||||
def rename_dir(self, oldname):
|
||||
if parameters.get_admin("CREATE_DIRECTORIES") == "yes":
|
||||
if parameters.get_admin("LDA") == "postfix":
|
||||
stpath = parameters.get_admin("STORAGE_PATH")
|
||||
return exec_as_vuser("mv %s/%s %s/%s" \
|
||||
% (stpath, oldname, stpath, self.name))
|
||||
return True
|
||||
|
||||
def delete_dir(self):
|
||||
if parameters.get_admin("CREATE_DIRECTORIES") == "yes":
|
||||
if parameters.get_admin("LDA") == "postfix":
|
||||
return exec_as_vuser("rm -r %s/%s" \
|
||||
% (parameters.get_admin("STORAGE_PATH"),
|
||||
self.name))
|
||||
@@ -716,7 +716,7 @@ class Mailbox(DatesAware):
|
||||
self.path = "%s/Inbox" % self.address
|
||||
else:
|
||||
self.path = "%s/" % self.address
|
||||
if parameters.get_admin("CREATE_DIRECTORIES") == "yes":
|
||||
if parameters.get_admin("LDA") == "postfix":
|
||||
relpath = "%s/%s" % (self.domain.name, self.address)
|
||||
abspath = os.path.join(parameters.get_admin("STORAGE_PATH"), relpath)
|
||||
if os.path.exists(abspath):
|
||||
@@ -736,7 +736,7 @@ class Mailbox(DatesAware):
|
||||
return True
|
||||
|
||||
def rename_dir(self, newdomain, newaddress):
|
||||
if parameters.get_admin("CREATE_DIRECTORIES") == "yes":
|
||||
if parameters.get_admin("LDA") == "postfix":
|
||||
if self.domain.name == newdomain and newaddress == self.address:
|
||||
return True
|
||||
oldpath = "%s/%s" % (parameters.get_admin("STORAGE_PATH"), self.domain.name)
|
||||
@@ -753,7 +753,7 @@ class Mailbox(DatesAware):
|
||||
return True
|
||||
|
||||
def delete_dir(self):
|
||||
if parameters.get_admin("CREATE_DIRECTORIES") == "yes":
|
||||
if parameters.get_admin("LDA") == "postfix":
|
||||
return exec_as_vuser("rm -r %s/%s/%s" \
|
||||
% (parameters.get_admin("STORAGE_PATH"),
|
||||
self.domain.name, self.address))
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
"pk": 5,
|
||||
"model": "lib.parameter",
|
||||
"fields": {
|
||||
"name": "admin.CREATE_DIRECTORIES",
|
||||
"value": "yes"
|
||||
"name": "admin.LDA",
|
||||
"value": "dovecot"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -47,15 +47,30 @@ TwocolsNav.prototype = {
|
||||
$('#' + this.options.divid + ' select').change();
|
||||
},
|
||||
|
||||
propagate_change: function($node) {
|
||||
var $select = $node.find("select");
|
||||
if ($select.length) {
|
||||
$select.change();
|
||||
}
|
||||
},
|
||||
|
||||
select_change: function(e) {
|
||||
var instance = this;
|
||||
var $target = $(e.target);
|
||||
var $parent = $target.parents("div.control-group");
|
||||
|
||||
$('div[data-visibility-field="' + $target.attr("id") + '"]').each(function(idx) {
|
||||
var $this = $(this);
|
||||
if ($this.attr("data-visibility-value") == $target.attr("value")) {
|
||||
|
||||
if ($parent.attr("disabled") === undefined &&
|
||||
$this.attr("data-visibility-value") == $target.attr("value")) {
|
||||
$this.attr("disabled", null);
|
||||
$this.show();
|
||||
instance.propagate_change($this)
|
||||
} else {
|
||||
$this.hide();
|
||||
$this.attr("disabled", "disabled");
|
||||
instance.propagate_change($this);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user