From 4b3f31738c3fb12e6a10f866c5d50f3f971718e4 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sun, 10 Jul 2016 04:49:09 +0200 Subject: [PATCH] Les droits bureau, admin et infra engendrent cableur --- users/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/users/models.py b/users/models.py index bb0bc799..80e4c089 100644 --- a/users/models.py +++ b/users/models.py @@ -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: