# Path: privagal/core/views.py
# class BackOfficeSendFileView(View):
# 
#     def dispatch(self, request, filepath, *args, **kwargs):
#         if not request.user.is_staff:
#             raise PermissionDenied
# 
#         # No need to check file to serve: we blindly rely on backend. For
#         # example, you need to properly configure nginx to **only** serve
#         # private file from that directory. Same goes for Apache.
#         path = os.path.join(settings.MEDIA_ROOT, filepath)
#         return sendfile(request, path)
# 
# class SendFilePrivateView(PageLoginRequiredMixin, SendFileView):
#     pass


from django.conf.urls import url
from .views import BackOfficeSendFileView, SendFilePrivateView
# -*- coding: utf-8 -*-
from __future__ import unicode_literals



urlpatterns = [
    url(
        r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$',
        SendFilePrivateView.as_view(),
        name='wagtailimages_serve'

# Path: privagal/core/views.py
# class BackOfficeSendFileView(View):
# 
#     def dispatch(self, request, filepath, *args, **kwargs):
#         if not request.user.is_staff:
#             raise PermissionDenied
# 
#         # No need to check file to serve: we blindly rely on backend. For
#         # example, you need to properly configure nginx to **only** serve
#         # private file from that directory. Same goes for Apache.
#         path = os.path.join(settings.MEDIA_ROOT, filepath)
#         return sendfile(request, path)
# 
# class SendFilePrivateView(PageLoginRequiredMixin, SendFileView):
#     pass


# Path: privagal/core/urls.py
from django.conf.urls import url
from .views import BackOfficeSendFileView, SendFilePrivateView

# -*- coding: utf-8 -*-
from __future__ import unicode_literals



urlpatterns = [
    url(
        r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$',
        SendFilePrivateView.as_view(),
        name='wagtailimages_serve'

    ),