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:
parent
ed18c0b8ba
commit
4b3f31738c
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