matomo-org / matomo-org/plugin-LoginLdap
Cannot sync users from AD
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 37
- Forks
- 30
- Avg merge
- 22h 53m
- Merged PRs (30d)
- 19
Description
I've configured the plugin as attached.


If i try to sync now via he Webinterface or commandline he tells me that he cannot find the users.

But if i use it without the --login parameter he will find the other users but will skip them.
Last time i've removed one user from the AD group and added him today again.
If i now change the user id field to mail it works fine.
Is there any offical solution?
Log without login-parameter.
```
root@cloud:/var/www/piwik# ./console loginldap:synchronize-users -vvv
DEBUG [2018-03-14 14:42:31] UserSynchronizer::makeConfigured(): LDAP access synchronization not enabled.
DEBUG [2018-03-14 14:42:31] UserSynchronizer::makeConfigured: configuring with defaultSitesWithViewAccess = all
DEBUG [2018-03-14 14:42:31] Model\LdapUsers: start getAllUserLogins() with
DEBUG [2018-03-14 14:42:31] Calling ldap_connect('rz-dc01.DOMAIN.de', 389)
DEBUG [2018-03-14 14:42:31] ldap_connect result is [resource]
DEBUG [2018-03-14 14:42:31] anonymous ldap_bind call finished; connection ok
INFO [2018-03-14 14:42:31] LdapUsers::makeLdapClient: Using LDAP server rz-dc01.DOMAIN.de:389
DEBUG [2018-03-14 14:42:31] Calling ldap_bind([resource], 'CN=svc-rz-piwik,OU=Service,OU=User,OU=DOMAIN,DC=DOMAIN,DC=de', )
DEBUG [2018-03-14 14:42:31] ldap_bind result is '1'
DEBUG [2018-03-14 14:42:31] Calling ldap_search([resource], 'dc=DOMAIN,dc=de', '(&(objectclass=person)(memberOf=CN=u-gbl-Global-Piwik,OU=Groups,OU=Glob al,OU=System Object,DC=DOMAIN,DC=de))')
DEBUG [2018-03-14 14:42:31] ldap_search result is [resource]
DEBUG [2018-03-14 14:42:31] Calling ldap_get_entries([resource], [resource])
DEBUG [2018-03-14 14:42:31] ldap_get_entries result is not null
DEBUG [2018-03-14 14:42:31] Calling ldap_close([resource])
DEBUG [2018-03-14 14:42:31] ldap_close returned true
DEBUG [2018-03-14 14:42:31] Model\LdapUsers: end getAllUserLogins() with [array]
Synchronizing 'maik.name@DOMAIN.de'... DEBUG [2018-03-14 14:42:31] Model\LdapUsers: start getUser() with [array]
DEBUG [2018-03-14 14:42:31] Calling ldap_connect('rz-dc01.DOMAIN.de', 389)
DEBUG [2018-03-14 14:42:31] ldap_connect result is [resource]
DEBUG [2018-03-14 14:42:31] anonymous ldap_bind call finished; connection ok
INFO [2018-03-14 14:42:31] LdapUsers::makeLdapClient: Using LDAP server rz-dc01.DOMAIN.de:389
DEBUG [2018-03-14 14:42:31] Calling ldap_bind([resource], 'CN=svc-rz-piwik,OU=Service,OU=User,OU=DOMAIN,DC=DOMAIN,DC=de', )
DEBUG [2018-03-14 14:42:31] ldap_bind result is '1'
DEBUG [2018-03-14 14:42:31] Model\LdapUsers::addUsernameSuffix: Adding suffix '@DOMAIN.de' to username 'maik.name@DOMAIN.de'.
DEBUG [2018-03-14 14:42:31] Calling ldap_search([resource], 'dc=DOMAIN,dc=de', '(&(objectclass=person)(memberOf=CN=u-gbl-Global-Piwik,OU=Groups,OU=Glob al,OU=System Object,DC=DOMAIN,DC=de)(userprincipalname=maik.name@DOMAIN.de@DOMAIN.de))')
DEBUG [2018-03-14 14:42:31] ldap_search result is [resource]
DEBUG [2018-03-14 14:42:31] Calling ldap_get_entries([resource], [resource])
DEBUG [2018-03-14 14:42:31] ldap_get_entries result is not null
DEBUG [2018-03-14 14:42:31] Calling ldap_close([resource])
DEBUG [2018-03-14 14:42:31] ldap_close returned true
DEBUG [2018-03-14 14:42:31] Model\LdapUsers: end getUser() with null
failed!
Synchronizing 's.nameEXT@DOMAIN.de'... DEBUG [2018-03-14 14:42:31] Model\LdapUsers: start getUser() with [array]
DEBUG [2018-03-14 14:42:31] Calling ldap_connect('rz-dc01.DOMAIN.de', 389)
DEBUG [2018-03-14 14:42:31] ldap_connect result is [resource]
DEBUG [2018-03-14 14:42:31] anonymous ldap_bind call finished; connection ok
INFO [2018-03-14 14:42:31] LdapUsers::makeLdapClient: Using LDAP server rz-dc01.DOMAIN.de:389
DEBUG [2018-03-14 14:42:31] Calling ldap_bind([resource], 'CN=svc-rz-piwik,OU=Service,OU=User,OU=DOMAIN,DC=DOMAIN,DC=de', )
DEBUG [2018-03-14 14:42:31] ldap_bind result is '1'
DEBUG [2018-03-14 14:42:31] Model\LdapUsers::addUsernameSuffix: Adding suffix '@DOMAIN.de' to username 's.nameEXT@DOMAIN.de'.
DEBUG [2018-03-14 14:42:31] Calling ldap_search([resource], 'dc=DOMAIN,dc=de', '(&(objectclass=person)(memberOf=CN=u-gbl-Global-Piwik,OU=Groups,OU=Glob al,OU=System Object,DC=DOMAIN,DC=de)(userprincipalname=s.nameEXT@DOMAIN.de@DOMAIN.de))')
DEBUG [2018-03-14 14:42:31] ldap_search result is [resource]
DEBUG [2018-03-14 14:42:31] Calling ldap_get_entries([resource], [resource])
DEBUG [2018-03-14 14:42:31] ldap_get_entries result is not null
DEBUG [2018-03-14 14:42:31] Calling ldap_close([resource])
DEBUG [2018-03-14 14:42:31] ldap_close returned true
DEBUG [2018-03-14 14:42:31] Model\LdapUsers: end getUser() with null
failed!
Synchronizing 'p.kayserADM@DOMAIN.de'... DEBUG [2018-03-14 14:42:31] Model\LdapUsers: start getUser() with [array]
DEBUG [2018-03-14 14:42:31] Calling ldap_connect('rz-dc01.DOMAIN.de', 389)
DEBUG [2018-03-14 14:42:31] ldap_connect result is [resource]
DEBUG [2018-03-14 14:42:31] anonymous ldap_bind call finished; connection ok
INFO [2018-03-14 14:42:31] LdapUsers::makeLdapClient: Using LDAP server rz-dc01.DOMAIN.de:389
DEBUG [2018-03-14 14:42:31] Calling ldap_bind([resource], 'CN=svc-rz-piwik,OU=Service,OU=User,OU=DOMAIN,DC=DOMAIN,DC=de', )
DEBUG [2018-03-14 14:42:31] ldap_bind result is '1'
DEBUG [2018-03-14 14:42:31] Model\LdapUsers::addUsernameSuffix: Adding suffix '@DOMAIN.de' to username 'p.kayserADM@DOMAIN.de'.
DEBUG [2018-03-14 14:42:31] Calling ldap_search([resource], 'dc=DOMAIN,dc=de', '(&(objectclass=person)(memberOf=CN=u-gbl-Global-Piwik,OU=Groups,OU=Glob al,OU=System Object,DC=DOMAIN,DC=de)(userprincipalname=p.kayserADM@DOMAIN.de@DOMAIN.de))')
DEBUG [2018-03-14 14:42:31] ldap_search result is [resource]
DEBUG [2018-03-14 14:42:31] Calling ldap_get_entries([resource], [resource])
DEBUG [2018-03-14 14:42:31] ldap_get_entries result is not null
DEBUG [2018-03-14 14:42:31] Calling ldap_close([resource])
DEBUG [2018-03-14 14:42:31] ldap_close returned true
DEBUG [2018-03-14 14:42:31] Model\LdapUsers: end getUser() with null
failed!
Synchronized 0 users!
Could not synchronize the following users in LDAP:
maik.name@DOMAIN.de User "maik.name@DOMAIN.de" not found!
s.nameEXT@DOMAIN.de User "s.nameEXT@DOMAIN.de" not found!
p.kayserADM@DOMAIN.de User "p.kayserADM@DOMAIN.de" not found!
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the `loginldap:synchronize-users` command and the `Model\LdapUsers` methods shown in the log, especially `addUsernameSuffix()` and `getUser()`. Reproduce the synchronization with a login already containing `@DOMAIN.de`, then verify that the LDAP lookup no longer appends the suffix twice and that the affected users synchronize successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100