Merge branch 'Aufinal/decorators' into 'master'

Utilise les bons décorateurs

See merge request !195
This commit is contained in:
Martin Pepin 2017-03-21 00:25:50 +01:00
commit 33b3d558b5
2 changed files with 5 additions and 14 deletions

View file

@ -1,10 +1,6 @@
# -*- 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
from django.contrib.auth.decorators import user_passes_test
def is_cof(user):
@ -14,9 +10,7 @@ def is_cof(user):
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")
cof_required = user_passes_test(is_cof)
def is_buro(user):
@ -26,4 +20,4 @@ def is_buro(user):
except:
return False
buro_required = user_passes_test(lambda u: is_buro(u))
buro_required = user_passes_test(is_buro)

View file

@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.contrib.auth.decorators import user_passes_test
from django_cas_ng.decorators import user_passes_test
def kfet_is_team(user):
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)