示例#1
0
 def dispatch(self, request, *args, **kwargs):
     if has_tutor_permissions(request.user):
         tutor = getTutorUserFromRequest(request)
         if tutor.is_admin:
             request.session['isAdmin'] = True
         return super(IndexView, self).dispatch(request, *args, **kwargs)
     else:
         return HttpResponseForbidden(
             'User has no access rights for viewing this page')
示例#2
0
 def dispatch(self, request, *args, **kwargs):
     if has_tutor_permissions(request.user):
         return super(PostDelete, self).dispatch(request, *args, **kwargs)
     else:
         return HttpResponseForbidden(
             'User has no access rights for viewing this page')