forked from DGNum/gestioCOF
Disambiguation in kfet's permission handling
In some places we used to refer to permissions based on their codename only (the part after the dot "." in the following examples) which can be ambiguous. Typically, we might define permissions like "bds.is_team" or "cof.is_team" in the near future ;)
This commit is contained in:
parent
67e28c704f
commit
64c792b11f
5 changed files with 37 additions and 25 deletions
|
@ -6,7 +6,7 @@ import os
|
|||
import random
|
||||
from datetime import timedelta
|
||||
|
||||
from django.contrib.auth.models import ContentType, Group, Permission, User
|
||||
from django.contrib.auth.models import Group, Permission, User
|
||||
from django.core.management import call_command
|
||||
from django.utils import timezone
|
||||
|
||||
|
@ -41,11 +41,9 @@ class Command(MyBaseCommand):
|
|||
group_chef.save()
|
||||
group_boy.save()
|
||||
|
||||
permissions_chef = Permission.objects.filter(
|
||||
content_type__in=ContentType.objects.filter(app_label="kfet")
|
||||
)
|
||||
permissions_chef = Permission.objects.filter(content_type__app_label="kfet",)
|
||||
permissions_boy = Permission.objects.filter(
|
||||
codename__in=["is_team", "perform_deposit"]
|
||||
content_type__app_label="kfet", codename__in=["is_team", "perform_deposit"]
|
||||
)
|
||||
|
||||
group_chef.permissions.add(*permissions_chef)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue