kpsul/gestioncof/decorators.py

30 lines
683 B
Python
Raw Normal View History

2016-07-15 00:02:56 +02:00
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from django_cas_ng.decorators import user_passes_test
2012-07-11 17:39:20 +02:00
2012-07-11 17:39:20 +02:00
def is_cof(user):
try:
profile = user.profile
2012-07-11 17:39:20 +02:00
return profile.is_cof
except:
return False
cof_required = user_passes_test(lambda u: is_cof(u))
cof_required_customdenied = user_passes_test(lambda u: is_cof(u),
login_url="cof-denied")
2012-07-11 17:39:20 +02:00
def is_buro(user):
try:
profile = user.profile
2012-07-11 17:39:20 +02:00
return profile.is_buro
except:
return False
buro_required = user_passes_test(lambda u: is_buro(u))