From 6091f1c187f5dbd9b99a4a82cce1156a29f146ee Mon Sep 17 00:00:00 2001 From: chapeau Date: Thu, 15 Jul 2021 12:22:26 +0200 Subject: [PATCH] fixed ldap sync --- ldap_sync/management/commands/ldap_rebuild.py | 7 ++++--- ldap_sync/management/commands/ldap_sync.py | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ldap_sync/management/commands/ldap_rebuild.py b/ldap_sync/management/commands/ldap_rebuild.py index dbe171eb..f1cb2728 100644 --- a/ldap_sync/management/commands/ldap_rebuild.py +++ b/ldap_sync/management/commands/ldap_rebuild.py @@ -21,9 +21,8 @@ from base64 import decodebytes from django.conf import settings from django.core.management.base import BaseCommand, CommandError -from ldap_sync.models import (synchronise_serviceuser, synchronise_user, - synchronise_usergroup) -from users.models import ListRight, User +from users.models import User, ListRight, ServiceUser +from ldap_sync.models import synchronise_user, synchronise_serviceuser, synchronise_usergroup def split_lines(lines): @@ -95,6 +94,8 @@ def sync_ldap(): synchronise_user(sender=User, instance=u) for lr in ListRight.objects.all(): synchronise_usergroup(sender=ListRight, instance=lr) + for s in ServiceUser.objects.all(): + synchronise_serviceuser(sender=ServiceUser, instance=s) class Command(BaseCommand): diff --git a/ldap_sync/management/commands/ldap_sync.py b/ldap_sync/management/commands/ldap_sync.py index 75af7738..e2d7dc22 100644 --- a/ldap_sync/management/commands/ldap_sync.py +++ b/ldap_sync/management/commands/ldap_sync.py @@ -19,8 +19,8 @@ # from django.core.management.base import BaseCommand, CommandError -from ldap_sync.models import synchronise_user -from users.models import User +from users.models import User, ListRight, ServiceUser +from ldap_sync.models import synchronise_user, synchronise_serviceuser, synchronise_usergroup class Command(BaseCommand): @@ -40,3 +40,7 @@ class Command(BaseCommand): def handle(self, *args, **options): for user in User.objects.all(): 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)