fix: skip ldap objects without a valid unique id (#376)

Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
Kyle Mendell
2025-03-23 18:30:12 +00:00
committed by GitHub
co-authored by Elias Schneider
parent e2f74e5687
commit cdfe8161d4
+14
View File
@@ -98,6 +98,13 @@ func (s *LdapService) SyncGroups() error {
var membersUserId []string
ldapId := value.GetAttributeValue(uniqueIdentifierAttribute)
// Skip groups without a valid LDAP ID
if ldapId == "" {
log.Printf("Skipping LDAP group without a valid unique identifier (attribute: %s)", uniqueIdentifierAttribute)
continue
}
ldapGroupIDs[ldapId] = true
// Try to find the group in the database
@@ -216,6 +223,13 @@ func (s *LdapService) SyncUsers() error {
for _, value := range result.Entries {
ldapId := value.GetAttributeValue(uniqueIdentifierAttribute)
// Skip users without a valid LDAP ID
if ldapId == "" {
log.Printf("Skipping LDAP user without a valid unique identifier (attribute: %s)", uniqueIdentifierAttribute)
continue
}
ldapUserIDs[ldapId] = true
// Get the user from the database