mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-26 06:54:45 +03:00
fix: skip ldap objects without a valid unique id (#376)
Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
@@ -98,6 +98,13 @@ func (s *LdapService) SyncGroups() error {
|
|||||||
var membersUserId []string
|
var membersUserId []string
|
||||||
|
|
||||||
ldapId := value.GetAttributeValue(uniqueIdentifierAttribute)
|
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
|
ldapGroupIDs[ldapId] = true
|
||||||
|
|
||||||
// Try to find the group in the database
|
// Try to find the group in the database
|
||||||
@@ -216,6 +223,13 @@ func (s *LdapService) SyncUsers() error {
|
|||||||
|
|
||||||
for _, value := range result.Entries {
|
for _, value := range result.Entries {
|
||||||
ldapId := value.GetAttributeValue(uniqueIdentifierAttribute)
|
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
|
ldapUserIDs[ldapId] = true
|
||||||
|
|
||||||
// Get the user from the database
|
// Get the user from the database
|
||||||
|
|||||||
Reference in New Issue
Block a user