Fix need account si request.user has_permkfet.is_team

This commit is contained in:
Aurélien Delobelle 2016-09-02 01:24:14 +02:00
parent f1444b2462
commit 723a35b7ad

View file

@ -4,6 +4,7 @@ from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.http import HttpResponseForbidden
from kfet.backends import KFetBackend
class KFetAuthenticationMiddleware(object):
@ -13,3 +14,8 @@ class KFetAuthenticationMiddleware(object):
if temp_request_user:
request.real_user = request.user
request.user = temp_request_user
if request.user.has_perm('kfet.is_team'):
try:
request.user.profile.account_kfet
except RelatedObjectDoesNotExist:
return HttpResponseForbidden