gestioCOF/kfet/decorators.py
2020-09-22 21:40:34 +02:00

15 lines
367 B
Python

from django.contrib.auth.decorators import user_passes_test
from django.core.exceptions import PermissionDenied
def kfet_is_team(user):
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)