Sometimes the save method takes an admin user as current user - Printable Version +- CoreBOSBB (https://discussions.corebos.org) +-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18) +--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4) +--- Thread: Sometimes the save method takes an admin user as current user (/showthread.php?tid=748) |
Sometimes the save method takes an admin user as current user - Guido1982 - 10-12-2017 I frequently use the 'save' CRMEntity method to alter records through AJAX calls. This way we can easily track (through the 'view history' button) who did what at what time. I also use it in my custom webservice methods. No harm there, but sometimes the user swtiches to myself (because I am the first available admin user). This seemd to be regardless of the user doing the actual change: sometimes the user stays intact, sometimes it changes, even though he is on the same profile as other users, where this does not happen. Am I missing some rights management here? RE: Sometimes the save method takes an admin user as current user - joebordes - 10-12-2017 It is rather odd as the application usually does try to keep the user connected in order to maintain that history information. That said I am sure that there are places where we check for the current_user variable and if it is not set we will pick the first admin user we find which would adapt to the case you describe. Does this happen only with the custom webservice? Can you reproduce the issue consistently? RE: Sometimes the save method takes an admin user as current user - Guido1982 - 10-12-2017 No, it doesn't only happen when from webservices, also when I save records through workflows and for instance in my Schedular module through an AJAX call. Haven't found any common things yet, but I'll keep an eye open and report back. RE: Sometimes the save method takes an admin user as current user - joebordes - 10-12-2017 Strange. Can you share the URL of the AJAX call? RE: Sometimes the save method takes an admin user as current user - Guido1982 - 10-15-2017 Well this is one of the webservice calls, no real standard URL's since they are all custom: PHP Code: $worksheet = json_decode($_REQUEST['data'], true); And here is an event listener for after a relation has been created, that does some specific functions on the related module record. Sometimes this related record gets related to me, sometimes it doesn't... RE: Sometimes the save method takes an admin user as current user - joebordes - 10-16-2017 I don't see any obvious reason why the user would change there. More or less what commit are you on in that install? I remember we changed a user override in the workflows but that was a LONG time ago. RE: Sometimes the save method takes an admin user as current user - Guido1982 - 10-16-2017 This install is probably around a year old, maybe older... RE: Sometimes the save method takes an admin user as current user - joebordes - 10-16-2017 I searched for the fix and found it September 2015. That was a while back!! commit 6f132cedb61223db8b0dc5cc14ade9d0d5df3a0a Author: Omar Llorens <omar@tsolucio.com> Date: Thu Sep 17 15:00:40 2015 +0200 So I suppose this isn't your issue. I would suggest activating debugging and adding a log->fatal of current_user in the CRMEntity->save() function to see when it changes RE: Sometimes the save method takes an admin user as current user - Guido1982 - 10-16-2017 Then I suppose that's not the issue. The weird thing is, when I click the 'view history' link for the affected records, I see the original change I made done by the correct user, and right after that I see another change (always about ten seconds interval) where the users gets switched to me, and that's the only action... Maybe some forgotten workflow... |