glpi
glpi copied to clipboard
Log full profile information to user record on profile add or suppression
When a profile is attached to a user account, it is defined by both entity and the profile itseilf. Actually, only this second part is logged to the user history and this information is meaningless without the entity environment it is attached to.
The proposd approach is probably not the best one and any other way to do this is welcome.
It looks like the issue is just that the post_addItem
function in CommonDBRelation
uses the 1st item of the relation, which in this case is the Profile, when adding the log event so the friendly name of the Profile is used rather than the Profile_User (which already accounts for the entity and recursivity). You mentioned on Discord that is used to show this information in the log, but I cannot find the version where this may have changed.
I'm wondering if there could be something simple missing somewhere to restore the functionality if it was there before, or at least avoid having a specific exception here and duplicating logic already done in the Profile_User's computeFriendlyName
.
It looks like the issue is just that the
post_addItem
function inCommonDBRelation
uses the 1st item of the relation, which in this case is the Profile,
This is a Profile_User object with the first item is a User Object and the second one: a Profile Object... Or we don't talk about the same thing.
when adding the log event so the friendly name of the Profile is used rather than the Profile_User (which already accounts for the entity and recursivity). You mentioned on Discord that is used to show this information in the log, but I cannot find the version where this may have changed.
As loyal user of GLPI since 2008, I used several versions... The trace I talked about was from 2014, so probably a very old implementation of GLPI...
I'm wondering if there could be something simple missing somewhere to restore the functionality if it was there before, or at least avoid having a specific exception here and duplicating logic already done in the Profile_User's
computeFriendlyName
.
No idea...
@kabassanov are you going to work on this or should we close?
@kabassanov are you going to work on this or should we close?
Need to fix it before closing... And move it forward in my todo list...
I wonder where we should keep histories for these modifications? In the user history, in the profile history, in the entity history?
@trasher , I changed the way this patch completes user-profile-entity logs. It is OK for me. I had to force IDs displays while retreiving User, Profile or Entity informations, because without this some tests fail. The reason is that post_addItem method is called during login procedure (for user synchronisation) and getNameID function is looking for not existing (at this time) $_SESSION["glpiis_ids_visible"] if not forcing display...
Apart this, seems good 👍🏽
@kabassanov
I rebased branch, simplified code and added tests. Could I force-push to your branch, or should I create a new pull request ?
@kabassanov
I rebased branch, simplified code and added tests. Could I force-push to your branch, or should I create a new pull request ?
Yes, you can.