8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Les droits bureau, admin et infra engendrent cableur

This commit is contained in:
chirac 2016-07-10 04:49:09 +02:00
parent 5c3091c1c0
commit aba2df78d0

View file

@ -1,4 +1,5 @@
from django.db import models
from django.db.models import Q
from django.forms import ModelForm, Form
from django import forms
@ -136,6 +137,8 @@ class User(AbstractBaseUser):
def has_perms(self, perms, obj=None):
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:
Right.objects.get(user=self, right__listright=perm)
except Right.DoesNotExist: