8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-27 01:13:46 +00:00

Les droits bureau, admin et infra engendrent cableur

This commit is contained in:
Gabriel Detraz 2016-07-10 04:49:09 +02:00
parent ed18c0b8ba
commit 4b3f31738c

View file

@ -1,4 +1,5 @@
from django.db import models from django.db import models
from django.db.models import Q
from django.forms import ModelForm, Form from django.forms import ModelForm, Form
from django import forms from django import forms
@ -136,6 +137,8 @@ class User(AbstractBaseUser):
def has_perms(self, perms, obj=None): def has_perms(self, perms, obj=None):
for perm in perms: for perm in perms:
if perm == 'cableur' and Right.objects.filter(Q(user=self) & (Q(right__listright='admin') | Q(right__listright='bureau') | Q(right__listright='infra'))):
return True
try: try:
Right.objects.get(user=self, right__listright=perm) Right.objects.get(user=self, right__listright=perm)
except Right.DoesNotExist: except Right.DoesNotExist: