forked from DGNum/gestioCOF
Break a redirection loop in teamkfet_required
This commit is contained in:
parent
a98e56d316
commit
7b8d1575c0
1 changed files with 8 additions and 1 deletions
|
@ -1,8 +1,15 @@
|
||||||
from django.contrib.auth.decorators import user_passes_test
|
from django.contrib.auth.decorators import user_passes_test
|
||||||
|
from django.core.exceptions import PermissionDenied
|
||||||
|
|
||||||
|
|
||||||
def kfet_is_team(user):
|
def kfet_is_team(user):
|
||||||
return user.has_perm("kfet.is_team")
|
if user.is_authenticated:
|
||||||
|
if user.has_perm("kfet.is_team"):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
raise PermissionDenied
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
teamkfet_required = user_passes_test(kfet_is_team)
|
teamkfet_required = user_passes_test(kfet_is_team)
|
||||||
|
|
Loading…
Reference in a new issue