mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-12-02 12:13:54 +01:00
At last, ticket #48 is done! It's really going to simplify installation and management.
This commit is contained in:
@@ -77,6 +77,11 @@ def is_not_localadmin(errortpl="error"):
|
||||
% {"user" : request.user.username})
|
||||
})
|
||||
return f(request, *args, **kwargs)
|
||||
|
||||
wrapped_f.__name__ = f.__name__
|
||||
wrapped_f.__dict__ = f.__dict__
|
||||
wrapped_f.__doc__ = f.__doc__
|
||||
wrapped_f.__module__ = f.__module__
|
||||
return wrapped_f
|
||||
return dec
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
from django.http import Http404
|
||||
from modoboa.admin.models import Extension
|
||||
|
||||
class ExtControlMiddleware(object):
|
||||
def process_view(self, request, view, args, kwargs):
|
||||
m = re.match("modoboa\.extensions\.(\w+)", view.__module__)
|
||||
if m is None:
|
||||
return None
|
||||
ext = Extension.objects.get(name=m.group(1))
|
||||
if ext is None:
|
||||
return None
|
||||
if ext.enabled:
|
||||
return None
|
||||
raise Http404
|
||||
|
||||
|
||||
Reference in New Issue
Block a user