Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions authentik/sources/ldap/sync/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,11 @@ def sync(self, page_data: list) -> int:
if parent:
ak_group.parents.add(parent)
self._logger.debug("Created group with attributes", **defaults)
if not GroupLDAPSourceConnection.objects.filter(
source=self._source, identifier=uniq
):
GroupLDAPSourceConnection.objects.create(
source=self._source, group=ak_group, identifier=uniq
)
GroupLDAPSourceConnection.objects.update_or_create(
source=self._source,
group=ak_group,
defaults={"identifier": uniq},
)
except SkipObjectException:
continue
except PropertyMappingExpressionException as exc:
Expand Down
11 changes: 5 additions & 6 deletions authentik/sources/ldap/sync/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ def sync(self, page_data: list) -> int:
ak_user, created = User.update_or_create_attributes(
{f"attributes__{LDAP_UNIQUENESS}": uniq}, defaults
)
if not UserLDAPSourceConnection.objects.filter(
source=self._source, identifier=uniq
):
UserLDAPSourceConnection.objects.create(
source=self._source, user=ak_user, identifier=uniq
)
UserLDAPSourceConnection.objects.update_or_create(
source=self._source,
user=ak_user,
defaults={"identifier": uniq},
)
except PropertyMappingExpressionException as exc:
raise StopSync(exc, None, exc.mapping) from exc
except SkipObjectException:
Expand Down