<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>OSGI module don't populate userId in audit when add new user Liferay 7.2</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121660192" />
  <subtitle>OSGI module don't populate userId in audit when add new user Liferay 7.2</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121660192</id>
  <updated>2026-04-06T02:22:25Z</updated>
  <dc:date>2026-04-06T02:22:25Z</dc:date>
  <entry>
    <title>RE: RE: OSGI module don't populate userId in audit when add new user Liferay 7.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121665770" />
    <author>
      <name>Nolberto Luengo</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121665770</id>
    <updated>2023-03-07T18:37:01Z</updated>
    <published>2023-03-07T16:46:13Z</published>
    <summary type="html">&lt;p&gt;Thanks David for your reply.&lt;/p&gt;
&lt;p&gt;Actually, we are using the OSGI module to be consumed by external
  service, so there is no session when the module is executed.&lt;/p&gt;
&lt;p&gt;We noticed that the AuditThreadLocal is populated with user
  information using data from a SharedSession object, which is not
  populated gived the explaination above.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Thanks again for your reply, it helps us to solve the problem.&lt;/p&gt;</summary>
    <dc:creator>Nolberto Luengo</dc:creator>
    <dc:date>2023-03-07T16:46:13Z</dc:date>
  </entry>
  <entry>
    <title>RE: OSGI module don't populate userId in audit when add new user Liferay 7.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121664832" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121664832</id>
    <updated>2023-03-06T17:02:42Z</updated>
    <published>2023-03-06T14:35:43Z</published>
    <summary type="html">&lt;p&gt;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).&lt;/p&gt;
&lt;p&gt;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...&lt;/p&gt;</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2023-03-06T14:35:43Z</dc:date>
  </entry>
  <entry>
    <title>OSGI module don't populate userId in audit when add new user Liferay 7.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121660191" />
    <author>
      <name>Nolberto Luengo</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121660191</id>
    <updated>2023-03-01T16:48:53Z</updated>
    <published>2023-03-01T15:47:45Z</published>
    <summary type="html">&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;We saw that userId and username columns are not being populated.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;On other hand, when the user is created through the control panel,
  the data is propertly populated.&lt;/p&gt;
&lt;p&gt;Any clue about what is missing?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</summary>
    <dc:creator>Nolberto Luengo</dc:creator>
    <dc:date>2023-03-01T15:47:45Z</dc:date>
  </entry>
</feed>
