Move permission handling to loadkfetdevdata

This commit is contained in:
Ludovic Stephan 2020-09-07 14:49:41 +02:00
parent d3185f25c3
commit c5d7eb9d30
2 changed files with 10 additions and 14 deletions

View file

@ -12,7 +12,7 @@ from django.utils import timezone
from gestioncof.management.base import MyBaseCommand
from gestioncof.models import CofProfile
from kfet.auth.models import KFetGroup
from kfet.auth.models import KFetGroup, KFetPermission
from kfet.models import (
Account,
Article,
@ -37,8 +37,14 @@ class Command(MyBaseCommand):
group_chef, _ = KFetGroup.objects.get_or_create(name="K-Fêt César")
group_boy, _ = KFetGroup.objects.get_or_create(name="K-Fêt Légionnaire")
group_chef.give_admin_access()
group_chef.give_staff_access()
# Give relevant permissions to both groups
chef_perms = KFetPermission.objects.all()
group_chef.permissions.add(*chef_perms)
boy_perms = KFetPermission.objects.filter(
codename__in=["is_team", "perform_deposit", "add_account", "add_transfer"]
)
group_boy.permissions.add(*boy_perms)
# ---
# Comptes