From 0a52d2b9a364ba1340759da3553eff50c0a17f17 Mon Sep 17 00:00:00 2001
From: Julian Rother <julian@cccv.de>
Date: Wed, 6 Apr 2022 15:50:58 +0200
Subject: [PATCH] Fix bc3b187: filter out disabled users

---
 .../management/commands/syncldapmemberships.py                | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/postorius_ldap_membership_management/management/commands/syncldapmemberships.py b/postorius_ldap_membership_management/management/commands/syncldapmemberships.py
index 9f7e672..82f58f4 100644
--- a/postorius_ldap_membership_management/management/commands/syncldapmemberships.py
+++ b/postorius_ldap_membership_management/management/commands/syncldapmemberships.py
@@ -19,7 +19,7 @@ def execute_ldap_search_without_hiding_errors(search, connection, filterargs=(),
 	an empty list of results. This behavor is indistinguishable from a query
 	with no results.'''
 	if not isinstance(search, LDAPSearch):
-		raise NotImplementedError(f'{type(search)} is not supported by django_auth_ldap_remoteuser')
+		raise NotImplementedError(f'{type(search)} is not supported by postorius_ldap_membership_management')
 	# This is a copy of django_auth_ldap.config.LDAPSearch.execute without the
 	# ldap.LDAPError eating try-except block
 	if escape:
@@ -43,7 +43,7 @@ class Command(BaseCommand):
 
 		client = get_mailman_client()
 
-		django_users = get_user_model().objects.all()
+		django_users = get_user_model().objects.filter(is_active=True)
 		backref_mapping = {'member': 'members', 'moderator': 'moderators', 'owner': 'owners'}
 		mm_users = {}
 
-- 
GitLab