forked from DGNum/gestioCOF
Merge branch 'Aufinal/decorators' into 'master'
Utilise les bons décorateurs See merge request !195
This commit is contained in:
commit
33b3d558b5
2 changed files with 5 additions and 14 deletions
|
@ -1,10 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import division
|
from django.contrib.auth.decorators import user_passes_test
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django_cas_ng.decorators import user_passes_test
|
|
||||||
|
|
||||||
|
|
||||||
def is_cof(user):
|
def is_cof(user):
|
||||||
|
@ -14,9 +10,7 @@ def is_cof(user):
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
cof_required = user_passes_test(lambda u: is_cof(u))
|
cof_required = user_passes_test(is_cof)
|
||||||
cof_required_customdenied = user_passes_test(lambda u: is_cof(u),
|
|
||||||
login_url="cof-denied")
|
|
||||||
|
|
||||||
|
|
||||||
def is_buro(user):
|
def is_buro(user):
|
||||||
|
@ -26,4 +20,4 @@ def is_buro(user):
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
buro_required = user_passes_test(lambda u: is_buro(u))
|
buro_required = user_passes_test(is_buro)
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import (absolute_import, division,
|
from django.contrib.auth.decorators import user_passes_test
|
||||||
print_function, unicode_literals)
|
|
||||||
from builtins import *
|
|
||||||
|
|
||||||
from django_cas_ng.decorators import user_passes_test
|
|
||||||
|
|
||||||
def kfet_is_team(user):
|
def kfet_is_team(user):
|
||||||
return user.has_perm('kfet.is_team')
|
return user.has_perm('kfet.is_team')
|
||||||
|
|
||||||
teamkfet_required = user_passes_test(lambda u: kfet_is_team(u))
|
teamkfet_required = user_passes_test(kfet_is_team)
|
||||||
|
|
Loading…
Reference in a new issue