OSGI module don't populate userId in audit when add new user Liferay 7.2OSGI module don't populate userId in audit when add new user Liferay 7.2https://liferay.dev/c/message_boards/find_thread?p_l_id=119785333&threadId=1216601922024-03-29T14:01:46Z2024-03-29T14:01:46ZRE: RE: OSGI module don't populate userId in audit when add new user Liferay 7.2Nolberto Luengohttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1216657702023-03-07T18:37:01Z2023-03-07T16:46:13Z<p>Thanks David for your reply.</p>
<p>Actually, we are using the OSGI module to be consumed by external
service, so there is no session when the module is executed.</p>
<p>We noticed that the AuditThreadLocal is populated with user
information using data from a SharedSession object, which is not
populated gived the explaination above.</p>
<p>So, what we did, was to populate the variable realUserId
from AuditThreadLocal in a request filter (liferay user info is
present as header sent to the osgi module) and now we have that info
properly populated in the Event.</p>
<p>Thanks again for your reply, it helps us to solve the problem.</p>Nolberto Luengo2023-03-07T16:46:13ZRE: OSGI module don't populate userId in audit when add new user Liferay 7.2David H Nebingerhttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1216648322023-03-06T17:02:42Z2023-03-06T14:35:43Z<p>I'm not sure how your process is working, but Liferay has an Audit
filter which loads data into an AuditThreadLocal and that is used when
building new Audit messages and submitting them into the Audit
framework (where eventually they will get persisted).</p>
<p>I guess, depending upon how your process works, you're not going
through these regular channels and therefore things are not properly
set up for the Audit framework to work properly, thus leading to these
gaps in your data...</p>David H Nebinger2023-03-06T14:35:43ZOSGI module don't populate userId in audit when add new user Liferay 7.2Nolberto Luengohttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1216601912023-03-01T16:48:53Z2023-03-01T15:47:45Z<p>Hi all,</p>
<p>With my team are developing an osgi module to handle user creation by
external application. But we noticed that audit_auditevent is not
being populated correctly.</p>
<p>We saw that userId and username columns are not being populated.</p>
<p>To provide more context about execution, in the post action to the
osgi module, we send the creator userId, so we force that value into
the httpServletRequest, so when we initialize the ServiceContext, the
user who is performing the action is being populated.</p>
<p>On other hand, when the user is created through the control panel,
the data is propertly populated.</p>
<p>Any clue about what is missing?</p>
<p>Thanks.&l