kpsul/kfet/decorators.py
Ludovic Stephan a947b9d3f2 Fix decorator
2021-06-15 14:07:43 +02:00

16 lines
349 B
Python

from django.contrib.auth.decorators import user_passes_test
def kfet_is_team(user):
if (
hasattr(user, "profile")
and hasattr(user.profile, "account_kfet")
and user.profile.account_kfet.is_frozen
):
return False
return user.has_perm("kfet.is_team")
teamkfet_required = user_passes_test(kfet_is_team)