LDAP failure but auto create works

Hello there,

Just testing the latest SuiteCRM beta with LDAP integration.

I’m using OpenLDAP behind.

The thing is:

  • login doesn’t work (see below for details)
  • … but user auto create is working! (with the right values)

So I wonder what could be the issue and how can I add debug so I can see what’s the real problem.

The log is saying:

[2022-10-08 19:48:21] request.CRITICAL: Uncaught PHP Exception Doctrine\ORM\NonUniqueResultException: "More than one result was found for query although one row or none was expected." at /mypath/suitecrm/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php line 928 {"exception":"[object] (Doctrine\\ORM\\NonUniqueResultException(code: 0): More than one result was found for query although one row or none was expected. at /mypath/suitecrm/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:928)"} []

Since auto create works, I’m relatively confident that my LDAP config is OK (otherwise, I couldn’t fetch the info and have the account created).

My .env.local config:

AUTH_TYPE=ldap

###> LDAP CONFIG ###
LDAP_HOST='myldap.example.com'
LDAP_PORT=389
LDAP_ENCRYPTION=tls
LDAP_PROTOCOL_VERSION=3
LDAP_REFERRALS=false
LDAP_DN_STRING='uid={username},ou=people,dc=example,dc=com'
LDAP_QUERY_STRING=''
LDAP_SEARCH_DN=''
LDAP_SEARCH_PASSWORD=''
###< LDAP CONFIG ###

###> LDAP AUTO CREATE CONFIG ###
LDAP_AUTO_CREATE=enabled
LDAP_PROVIDER_BASE_DN='ou=people,dc=example,dc=com'
LDAP_PROVIDER_SEARCH_DN=''
LDAP_PROVIDER_SEARCH_PASSWORD=''
LDAP_PROVIDER_DEFAULT_ROLES=ROLE_USER
LDAP_PROVIDER_UID_KEY='uid'
LDAP_PROVIDER_FILTER=''

If there’s a way to put a debug string somewhere to understand the content of $result, I’ll be happy to do so :slight_smile:

Thank you!

edit: it seems that I already have some records in the database, despite I removed it from the UI. It’s like there’s a new user record created at each connection. Can I safely remove them from the database?

Okay so answering myself:

  1. I created that bug because the first time I incorrectly mapped some fields (username was mapped on CN and not UID)
  2. So it re-created the user differently but had a collision with the UID
  3. I had to delete from users where id="OLD DUPLICATE UUIDs"
  4. And then, it worked :slight_smile:

Note: when you remove a user, it stays in the DB with deleted value to 1, but this prevented to login. I don’t know if I did right, but now it works correctly after manual removal from the DB!

2 Likes