mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
+11
-11
@@ -760,24 +760,24 @@ class Mailbox(DatesAware):
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def resolve_uid(value):
|
||||
def resolve_id(value, idname, errmsg):
|
||||
if value.isdigit():
|
||||
return value
|
||||
try:
|
||||
uid = pwd.getpwnam(value).pw_uid
|
||||
rid = getattr(pwd.getpwnam(value), idname)
|
||||
except KeyError:
|
||||
raise AdminError(_("%s is not a valid uid/username" % value))
|
||||
return uid
|
||||
raise AdminError(errmsg)
|
||||
return rid
|
||||
|
||||
@staticmethod
|
||||
def resolve_uid(value):
|
||||
err = _("%s is not a valid uid/username" % value)
|
||||
return Mailbox.resolve_id(value, "pw_uid", err)
|
||||
|
||||
@staticmethod
|
||||
def resolve_gid(value):
|
||||
if value.isdigit():
|
||||
return value
|
||||
try:
|
||||
gid = pwd.getpwnam(value).pw_gid
|
||||
except KeyError:
|
||||
raise AdminError(_("%s is not a valid gid/groupname" % value))
|
||||
return gid
|
||||
err = _("%s is not a valid gid/groupname" % value)
|
||||
return Mailbox.resolve_id(value, "pw_gid", err)
|
||||
|
||||
def set_ownership(self):
|
||||
"""Set uid and gid for this mailbox
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% load i18n %}{% load url from future %}
|
||||
{% url "modoboa.admin.views.saveparameters" as action %}
|
||||
<h2>{% trans "Parameters" %} <small>{% trans "Configure Modoboa" %}</small></h2><hr />
|
||||
<form id="settings_form" method="POST" action="{{ action }}" class="form-horizontal">
|
||||
<form id="settings_form" method="POST" action="{% url 'modoboa.admin.views.saveparameters' %}" class="form-horizontal">
|
||||
{% include "common/parameters.html" %}
|
||||
</form>
|
||||
<hr>
|
||||
|
||||
@@ -33,10 +33,15 @@ TwocolsNav.prototype = {
|
||||
},
|
||||
|
||||
update_content: function(data) {
|
||||
$('#' + this.options.divid).html(data.content);
|
||||
if (data.content) {
|
||||
$('#' + this.options.divid).html(data.content);
|
||||
}
|
||||
if (data.onload_cb) {
|
||||
eval(data.onload_cb + '()');
|
||||
}
|
||||
if (data.respmsg) {
|
||||
$("body").notify("error", data.respmsg);
|
||||
}
|
||||
$('#' + this.options.divid + ' select').change($.proxy(this.select_change, this));
|
||||
$(".help").popover().click(function(e) {e.preventDefault();});
|
||||
$('#' + this.options.divid + ' select').change();
|
||||
|
||||
Reference in New Issue
Block a user