wip: resellers and limits

I've finally started to rethink the database structure. The goal I'm trying to reach: only use User objects to manage permissions and accesses to the webui and associate other objects to them if needed (like mailboxes).

see #105
This commit is contained in:
Antoine Nguyen
2012-01-20 17:33:05 +01:00
parent 2a0e9fdf3a
commit 3681bb4198
41 changed files with 1311 additions and 478 deletions
+13
View File
@@ -3,6 +3,8 @@
import re
from django.http import Http404, HttpResponseRedirect
from modoboa.admin.models import Extension
from modoboa.lib.webutils import _render_error, ajax_response
from modoboa.lib.exceptions import ModoboaException
class ExtControlMiddleware(object):
def process_view(self, request, view, args, kwargs):
@@ -22,3 +24,14 @@ class AjaxLoginRedirect(object):
if type(response) == HttpResponseRedirect:
response.status_code = 278
return response
class CommonExceptionCatcher(object):
def process_exception(self, request, exception):
if not isinstance(exception, ModoboaException):
return None
if not request.is_ajax():
return _render_error(request, errortpl="error_simple",
user_context=dict(error=str(exception)))
return ajax_response(request, status="ko", respmsg=str(exception))