def ajax_website_right(is_superuser):
    def decorator(view_func):
        ''' Decorator that provide the current_site and verify the
        access_right of the user '''
        @wraps(view_func, assigned=available_attrs(view_func))
        def __wrapped_view(request, *args, **kwargs):
            queryset = request.user.websites_owned

            if is_superuser is not None:
                queryset = queryset.filter(is_superuser=is_superuser)

            try:
                request.current_site = \
                    queryset.get(website__id=request.website.id).website
            except WebSiteOwner.DoesNotExist:
                request.current_site = None
                return forbidden_access()

            return view_func(request, *args, **kwargs)
        return login_required(__wrapped_view)
    return decorator
Returns a decorator regarding is_superuser
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/website/decorators.py/ajax_website_right