8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 03:43:12 +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.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: