forked from DGNum/gestioCOF
29 lines
703 B
Python
29 lines
703 B
Python
# -*- 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
|
|
|
|
|
|
def is_cof(user):
|
|
try:
|
|
cofprofile = user.profile.cof
|
|
return cofprofile.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")
|
|
|
|
|
|
def is_buro(user):
|
|
try:
|
|
cofprofile = user.profile.cof
|
|
return cofprofile.is_buro
|
|
except:
|
|
return False
|
|
|
|
buro_required = user_passes_test(lambda u: is_buro(u))
|