From e45b57071ade659ec0afa836c84caa4076ee5f2f Mon Sep 17 00:00:00 2001 From: Alissa Gerhard Date: Mon, 11 Sep 2023 12:43:10 +0200 Subject: [PATCH] sources/ldap: dont prefetch useless items (#6812) sources/ldap: Fixed fetching of useless data into redis --- authentik/sources/ldap/sync/groups.py | 3 +++ authentik/sources/ldap/sync/membership.py | 3 +++ authentik/sources/ldap/sync/users.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/authentik/sources/ldap/sync/groups.py b/authentik/sources/ldap/sync/groups.py index a10e0a904..68eedcc34 100644 --- a/authentik/sources/ldap/sync/groups.py +++ b/authentik/sources/ldap/sync/groups.py @@ -18,6 +18,9 @@ class GroupLDAPSynchronizer(BaseLDAPSynchronizer): return "groups" def get_objects(self, **kwargs) -> Generator: + if not self._source.sync_groups: + self.message("Group syncing is disabled for this Source") + return iter(()) return self.search_paginator( search_base=self.base_dn_groups, search_filter=self._source.group_object_filter, diff --git a/authentik/sources/ldap/sync/membership.py b/authentik/sources/ldap/sync/membership.py index 432715c5a..134f12380 100644 --- a/authentik/sources/ldap/sync/membership.py +++ b/authentik/sources/ldap/sync/membership.py @@ -24,6 +24,9 @@ class MembershipLDAPSynchronizer(BaseLDAPSynchronizer): return "membership" def get_objects(self, **kwargs) -> Generator: + if not self._source.sync_groups: + self.message("Group syncing is disabled for this Source") + return iter(()) return self.search_paginator( search_base=self.base_dn_groups, search_filter=self._source.group_object_filter, diff --git a/authentik/sources/ldap/sync/users.py b/authentik/sources/ldap/sync/users.py index 4a67c1cdc..68d966022 100644 --- a/authentik/sources/ldap/sync/users.py +++ b/authentik/sources/ldap/sync/users.py @@ -20,6 +20,9 @@ class UserLDAPSynchronizer(BaseLDAPSynchronizer): return "users" def get_objects(self, **kwargs) -> Generator: + if not self._source.sync_users: + self.message("User syncing is disabled for this Source") + return iter(()) return self.search_paginator( search_base=self.base_dn_users, search_filter=self._source.user_object_filter,