Commit ca2e9990 authored by jr-garnier's avatar jr-garnier
Browse files

Merge branch '343-ldap_sync-and-ldap_rebuild-do-not-regenerate-service-users-2' into 'dev'

fix: Resolve "ldap_sync and ldap_rebuild do not regenerate service-users"

See merge request re2o/re2o!618
parents 8eeace95 545c370c
Pipeline #9034 passed with stage
in 3 minutes and 12 seconds
......@@ -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 service_user in ServiceUser.objects.all():
synchronise_serviceuser(sender=ServiceUser, instance=service_user)
class Command(BaseCommand):
......
......@@ -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 service_user in ServiceUser.objects.all():
synchronise_serviceuser(sender=ServiceUser, instance=service_user)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment