Blame view

src/dashboard/decorator.py 497 Bytes
2c61f856   theopuhl   Url change to pat...
1
from django.core.exceptions import PermissionDenied
f5d4a0c9   theopuhl   Change to users r...
2
3
4
5
6
7
8
9
10
11
12
13
14
from functools import wraps
from django.http import HttpResponseForbidden


def level_required(level=0):
    def wrapper(view_func):
        def _decorator(request, *args, **kwargs):
            if (request.user.user_level.priority < level):
                return HttpResponseForbidden()
            response = view_func(request, *args, **kwargs)
            return response
        return wraps(view_func)(_decorator)
    return wrapper    
2c61f856   theopuhl   Url change to pat...