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:
parent
5c3091c1c0
commit
aba2df78d0
1 changed files with 3 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue