forked from DGNum/gestioCOF
Meilleur décorateur
This commit is contained in:
parent
4f15b820a5
commit
46e7305953
1 changed files with 4 additions and 0 deletions
|
@ -60,6 +60,8 @@ def buro_required(view_func):
|
||||||
|
|
||||||
class CofRequiredMixin(PermissionRequiredMixin):
|
class CofRequiredMixin(PermissionRequiredMixin):
|
||||||
def has_permission(self):
|
def has_permission(self):
|
||||||
|
if not self.request.user.is_authenticated:
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
return self.request.user.profile.is_cof
|
return self.request.user.profile.is_cof
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -68,6 +70,8 @@ class CofRequiredMixin(PermissionRequiredMixin):
|
||||||
|
|
||||||
class BuroRequiredMixin(PermissionRequiredMixin):
|
class BuroRequiredMixin(PermissionRequiredMixin):
|
||||||
def has_permission(self):
|
def has_permission(self):
|
||||||
|
if not self.request.user.is_authenticated:
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
return self.request.user.profile.is_buro
|
return self.request.user.profile.is_buro
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
Loading…
Reference in a new issue