mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
Merge branch 'master' into split_applications
Conflicts: modoboa/extensions/admin/models/alias.py modoboa/extensions/admin/tests/alias.py modoboa/extensions/admin/tests/domain_alias.py modoboa/extensions/amavis/general_callbacks.py modoboa/extensions/amavis/management/commands/amnotify.py modoboa/extensions/amavis/management/commands/qcleanup.py modoboa/extensions/limits/tests.py modoboa/extensions/postfix_autoreply/management/commands/autoreply.py modoboa/extensions/postfix_relay_domains/tests.py modoboa/extensions/radicale/management/commands/generate_rights.py modoboa/extensions/stats/management/commands/logparser.py modoboa/extensions/stats/modo_extension.py modoboa/extensions/webmail/forms.py modoboa/extensions/webmail/lib/imaputils.py modoboa/extensions/webmail/templates/webmail/compose.html
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ copyright = u'2014, Antoine Nguyen'
|
||||
# The short X.Y version.
|
||||
version = '1.2'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.2.0'
|
||||
release = '1.2.1'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -90,6 +90,7 @@ class User(PermissionsMixin):
|
||||
for ooentry in self.objectaccess_set.filter(is_owner=True):
|
||||
if ooentry.content_object is not None:
|
||||
grant_access_to_object(owner, ooentry.content_object, True)
|
||||
ungrant_access_to_object(ooentry.content_object, self)
|
||||
|
||||
events.raiseEvent("AccountDeleted", self, fromuser, **kwargs)
|
||||
ungrant_access_to_object(self)
|
||||
|
||||
@@ -344,17 +344,19 @@ class TabForms(object):
|
||||
#
|
||||
|
||||
|
||||
def is_valid_host(host):
|
||||
"""IDN compatible domain validator."""
|
||||
host = host.encode('idna').lower()
|
||||
if not hasattr(is_valid_host, '_re'):
|
||||
is_valid_host._re = re.compile(
|
||||
r'^([0-9a-z][-\w]*[0-9a-z]\.)+[a-z0-9\-]{2,15}$')
|
||||
return bool(is_valid_host._re.match(host))
|
||||
def is_valid_hostname(hostname):
|
||||
"""Domain name validaton."""
|
||||
if len(hostname) > 255:
|
||||
return False
|
||||
if hostname[-1] == ".":
|
||||
hostname = hostname[:-1] # strip exactly one dot from the
|
||||
# right, if present
|
||||
allowed = re.compile(r"(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE)
|
||||
return all(allowed.match(x) for x in hostname.split("."))
|
||||
|
||||
|
||||
def validate_domain_name(value):
|
||||
if not is_valid_host(value):
|
||||
if not is_valid_hostname(value):
|
||||
raise ValidationError(_('Enter a valid domain name'), 'invalid')
|
||||
|
||||
|
||||
|
||||
+10
-20
@@ -48,22 +48,15 @@ def grant_access_to_object(user, obj, is_owner=False):
|
||||
:param obj: an admin. object (Domain, Mailbox, ...)
|
||||
:param is_owner: the user is the unique object's owner
|
||||
"""
|
||||
ct = ContentType.objects.get_for_model(obj)
|
||||
try:
|
||||
entry = user.objectaccess_set.get(content_type=ct, object_id=obj.id)
|
||||
entry.is_owner = is_owner
|
||||
entry.save()
|
||||
except ObjectAccess.DoesNotExist:
|
||||
pass
|
||||
else:
|
||||
return
|
||||
|
||||
ObjectAccess.objects.create(
|
||||
user=user, content_type=ct, object_id=obj.id, is_owner=is_owner
|
||||
)
|
||||
if not is_owner:
|
||||
return
|
||||
from modoboa.core.models import User
|
||||
|
||||
ct = ContentType.objects.get_for_model(obj)
|
||||
entry, created = ObjectAccess.objects.get_or_create(
|
||||
user=user, content_type=ct, object_id=obj.id)
|
||||
entry.is_owner = is_owner
|
||||
entry.save()
|
||||
if not created or not is_owner:
|
||||
return
|
||||
for su in User.objects.filter(is_superuser=True):
|
||||
if su == user:
|
||||
continue
|
||||
@@ -83,11 +76,8 @@ def grant_access_to_objects(user, objects, ct):
|
||||
:param ct: the content type
|
||||
"""
|
||||
for obj in objects:
|
||||
try:
|
||||
ObjectAccess.objects.create(
|
||||
user=user, content_type=ct, object_id=obj.id)
|
||||
except IntegrityError:
|
||||
pass
|
||||
ObjectAccess.objects.get_or_create(
|
||||
user=user, content_type=ct, object_id=obj.id)
|
||||
|
||||
|
||||
def ungrant_access_to_object(obj, user=None):
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
<html lang="{{ LANGUAGE_CODE }}">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>{% trans "Welcome to Modoboa" %}</title>
|
||||
<link rel="icon" type="image/png" href="{% static 'css/logo-icon.png' %}" />
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'bootstrap/dist/css/bootstrap.min.css' %}" />
|
||||
|
||||
Reference in New Issue
Block a user