8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 23:22:25 +00:00

fixed ldap sync

This commit is contained in:
chapeau 2021-07-15 12:22:26 +02:00 committed by jr-garnier
parent 8eeace95ce
commit 6091f1c187
2 changed files with 10 additions and 5 deletions

View file

@ -21,9 +21,8 @@ from base64 import decodebytes
from django.conf import settings from django.conf import settings
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from ldap_sync.models import (synchronise_serviceuser, synchronise_user, from users.models import User, ListRight, ServiceUser
synchronise_usergroup) from ldap_sync.models import synchronise_user, synchronise_serviceuser, synchronise_usergroup
from users.models import ListRight, User
def split_lines(lines): def split_lines(lines):
@ -95,6 +94,8 @@ def sync_ldap():
synchronise_user(sender=User, instance=u) synchronise_user(sender=User, instance=u)
for lr in ListRight.objects.all(): for lr in ListRight.objects.all():
synchronise_usergroup(sender=ListRight, instance=lr) synchronise_usergroup(sender=ListRight, instance=lr)
for s in ServiceUser.objects.all():
synchronise_serviceuser(sender=ServiceUser, instance=s)
class Command(BaseCommand): class Command(BaseCommand):

View file

@ -19,8 +19,8 @@
# #
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from ldap_sync.models import synchronise_user from users.models import User, ListRight, ServiceUser
from users.models import User from ldap_sync.models import synchronise_user, synchronise_serviceuser, synchronise_usergroup
class Command(BaseCommand): class Command(BaseCommand):
@ -40,3 +40,7 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
for user in User.objects.all(): for user in User.objects.all():
synchronise_user(sender=User, instance=user) synchronise_user(sender=User, instance=user)
for lr in ListRight.objects.all():
synchronise_usergroup(sender=ListRight, instance=lr)
for s in ServiceUser.objects.all():
synchronise_serviceuser(sender=ServiceUser, instance=s)