mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-24 06:48:35 +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>
|
||||
|
||||
Reference in New Issue
Block a user