Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldap to dolibarr sync throws error if user already exists #22827

Open
maxkreg opened this issue Nov 11, 2022 · 9 comments
Open

ldap to dolibarr sync throws error if user already exists #22827

maxkreg opened this issue Nov 11, 2022 · 9 comments
Labels
Bug This is a bug (something does not work as expected)

Comments

@maxkreg
Copy link

maxkreg commented Nov 11, 2022

Bug

Dolibarr is installed via Cloudron. Their ldap sync script calls sync_users_ldap2dolibarr.php.

In its first run, sync works fine. If I add another user to the LDAP server, the script remarks that the users synced before exist, that the new user does not and that it will create it (all good so far), and then it stalls with an error, revoking the newly synced user (see below). Is there anything I am doing wrong or is this expected bahaviour? Many thanks!

root@c8d9a4b7-94bc-4850-ade5-xxxxxxxxxxx:~# /usr/sbin/sync-users.sh
==> Syncing LDAP users into dolibarr
***** sync_users_ldap2dolibarr.php (16.0.1) pid=1048 *****
Mails sending disabled (useless in batch mode)
----- Synchronize all records from LDAP database:
host=172.18.0.1
port=3002
login=cn=c8d9a4b7-94bc-4850-xxxxxxxxxxxxxxxx,ou=apps,dc=cloudron
pass=********************************************************************************************************************************
DN to extract=ou=users,dc=cloudron
Filter=(&(objectclass=user))
----- To Dolibarr database:
type=mysqli
host=mysql
port=3306
login=ee86bxxxxxxxxxxx
database=ee86bfxxxxxxxxxxxx
----- Options:
commitiferror=0
excludeuser=
Mapped LDAP fields=cn,sn,givenName,username,telephonenumber,facsimiletelephonenumber,mobile,mail
UserCreate # Mxxxxxxxxx Kxxxxxxxx: login=m.xxxxxxxxxxxx, fullname=Mxxxxxxx Kxxxxxxxxxxx --> -6 Benutzername m.kxxxxxxxxxx existiert bereits.
UserCreate # test: login=test, fullname=test --> -6 Benutzername test existiert bereits.
UserCreate # testi: login=test2, fullname=testi --> Created user id=29 login=test2
Einige Fehler wurden gefunden. Änderungen wurden rückgängig gemacht.

Environment Version

16.0.1

Environment OS

No response

Environment Web server

No response

Environment PHP

7.4.3

Environment Database

MySQL or MariaDB 8.0.30-0ubuntu0.20.04.2

Environment URL(s)

No response

Expected and actual behavior

No response

Steps to reproduce the behavior

No response

Attached files

No response

@maxkreg maxkreg added the Bug This is a bug (something does not work as expected) label Nov 11, 2022
@hregis
Copy link
Contributor

hregis commented Nov 11, 2022

@maxkreg the script is to run only once, then when add a new dolibarr user you can associate it with an ldap user

@hregis
Copy link
Contributor

hregis commented Nov 11, 2022

@maxkreg can you check (llx_const table) if

LDAP_KEY_USERS = LDAP_FIELD_SID
or
LDAP_KEY_USERS = LDAP_FIELD_LOGIN

if LDAP_KEY_USERS = LDAP_FIELD_SID can you check if the field "ldap_sid" has a value in llx_user table ?

@maxkreg
Copy link
Author

maxkreg commented Nov 11, 2022

@maxkreg the script is to run only once, then when add a new dolibarr user you can associate it with an ldap user

okay, so it is a transmission, not a synchronization ;)

mysql> SELECT * FROM dolibarr_const WHERE name = 'LDAP_FIELD_LOGIN';
+-------+------------------+--------+----------+--------+---------+------+---------------------+
| rowid | name | entity | value | type | visible | note | tms |
+-------+------------------+--------+----------+--------+---------+------+---------------------+
| 537 | LDAP_FIELD_LOGIN | 1 | username | chaine | 1 | NULL | 2022-11-11 12:07:39 |
+-------+------------------+--------+----------+--------+---------+------+---------------------+

LDAP_KEY_USERS and LDAP_FIELD_SID return an empty set.
ldap_sid is empty (not NULL) for all existing users.

@hregis
Copy link
Contributor

hregis commented Nov 11, 2022

@maxkreg what is the finality ? dolibarr -> ldap or ldap ->dolibarr ?

@hregis
Copy link
Contributor

hregis commented Nov 11, 2022

@maxkreg have you activated and configured the ldap module in Dolibarr?
it must be configured before using the ldap user import script in Dolibarr !

@maxkreg
Copy link
Author

maxkreg commented Nov 11, 2022

I am trying to sync ldap -> dolibarr (using sync_users_ldap2dolibarr.php).

LDAP is configured, proven by the fact I can see entries from my LDAP server in Dolibarr´s user creation panel:
grafik

@hregis
Copy link
Contributor

hregis commented Nov 11, 2022

@maxkreg it's very dificult to see a problem without to see the context... can you send me a private mail to see with remote maintenance please ?

@maxkreg
Copy link
Author

maxkreg commented Nov 12, 2022

I can´t find a way to contact you, please shoot me an email (see profile). I will be back in office on monday. Thank you!

@ksar-ksar
Copy link
Contributor

Hello,

Is it still the case on V18 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

3 participants