You are not logged in.
Hello,
I have been trying to find a solution for this issue, I went through the manuals, Googled it, looked through the forum, but I can't find any answers.
The issue:
I have configured LDAP and this works like a charm. I have also configured the Users tab under LDAP Directories to automatically fetch the information from Active Directory, like phone number preferred language, etc.
The issue I now have is that one the users changes one of the settings that is being fed by LDAP, that it gets overwritten. For example: if in GLPI I change the language from French to English, when I press "Force Sync" the language will be reverted to French.
I have also tried with other languages besides English, because English is the default language in GLPI, but the results are the same.
Is there a way to prevent LDAP from overwriting settings that the user has changed themselves?
Last edited by Ziggurat (2022-08-25 14:37:54)
Offline
There is no field locking mechanism for Users or their preferences at this time to prevent automated updates like LDAP syncing from overwriting user-set options.
This may be an interesting addition though.
You can make the suggestion on the UserEcho site for it to be considered for a future version.
https://glpi.userecho.com/
I don't know for sure, but it may also be possible to block these updates with a custom plugin.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Thank you for the information and for the tip to suggest it to the developers.
I came across this issue because in my company only HR has control over preferred language, and they just put in your native tongue and not the one you actually prefer. So in my case it's Dutch while I actually prefer my language to be English.
It should be possible to block those updates with a custom plugin. From the top of my head I think you verify if certain settings from the user are different from the default settings, if so it could indicate that they have changed it themselves.
Another possibility would be to add a table to the GLPI database where those kind of changes are stored. Table would only need 2 columns, userid and setting(id), during a LDAP sync you then check if the combination is in that table and if so you skip the change.
But I am just spitballing here, it might be harder than that.
If I find the time somewhere between work and studies I might try to create such a plugin.
Offline
I haven't tested it, but in a plugin, you may be able to use the pre_item_update hook. Returning false would cancel the update entirely, but you could also selectively do an "unset($item->input['language']);" to remove the language change while allowing everything else. If the language is only needed to be synced from LDAP once, you may be able to use a few checks to determine if the user changed the language or not and if they didn't, selectively block the update of the field. For example, if the $_SERVER['REQUEST_URI'] contains "/front/user.form.php" and $_REQUEST['force_ldap_resynch'] is not set, then the update was triggered in the user form but not by clicking the force sync button. To handle massive actions properly, some other checks would be needed as both the mass update for the language and the mass force sync would come from the same request URI, but there should be a difference in the request data ($_REQUEST). The language should be set from LDAP during the creation of the user so the pre_item_update hook wouldn't be fired for that, only when an existing user is updated.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline