From aba2df78d04faf3b96df55be08925320f77a3285 Mon Sep 17 00:00:00 2001 From: chirac 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: