mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
@@ -10,6 +10,8 @@ from modoboa.lib.web_utils import (
|
||||
_render_error, ajax_response, render_to_json_response
|
||||
)
|
||||
|
||||
from . import singleton
|
||||
|
||||
|
||||
class AjaxLoginRedirect(object):
|
||||
|
||||
@@ -41,10 +43,13 @@ class CommonExceptionCatcher(object):
|
||||
)
|
||||
|
||||
|
||||
class RequestCatcherMiddleware(object):
|
||||
class RequestCatcherMiddleware(singleton.Singleton):
|
||||
"""Simple middleware to store the current request.
|
||||
|
||||
"""
|
||||
Simple middleware to store the current request.
|
||||
FIXME: the Singleton hack is used to make tests work. I don't know
|
||||
why but middlewares are not dropped between test case runs so more
|
||||
than one instance can be listening to the request_accessor signal
|
||||
and we don't want that!
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -37,7 +37,7 @@ def create_user_limits(sender, instance, **kwargs):
|
||||
ct = ContentType.objects.get_by_natural_key(
|
||||
*definition["content_type"].split("."))
|
||||
max_value = 0
|
||||
if not creator or creator.is_superuser:
|
||||
if creator and creator.is_superuser:
|
||||
max_value = int(
|
||||
parameters.get_admin("DEFLT_{}_LIMIT".format(name.upper())))
|
||||
models.ObjectLimit.objects.create(
|
||||
|
||||
@@ -180,7 +180,6 @@ class ResellerTestCase(ResourceTestCase):
|
||||
cls.user = UserFactory(
|
||||
username='reseller', groups=('Resellers',)
|
||||
)
|
||||
cls.user.objectlimit_set.update(max_value=2)
|
||||
|
||||
def setUp(self):
|
||||
"""Test initialization."""
|
||||
@@ -329,6 +328,7 @@ class ResellerTestCase(ResourceTestCase):
|
||||
self._check_limit('mailbox_aliases', 0, 2)
|
||||
|
||||
def test_restore_resources(self):
|
||||
"""Give resource to a domain admin and restore them."""
|
||||
self._create_domain('domain.tld')
|
||||
dom = Domain.objects.get(name='domain.tld')
|
||||
self._create_account('admin1@domain.tld', role='DomainAdmins')
|
||||
|
||||
Reference in New Issue
Block a user