<?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>How to impersonate liferay user using API?</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=2135442" />
  <subtitle>How to impersonate liferay user using API?</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=2135442</id>
  <updated>2026-04-06T07:47:59Z</updated>
  <dc:date>2026-04-06T07:47:59Z</dc:date>
  <entry>
    <title>RE: How to impersonate liferay user using API?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=7228942" />
    <author>
      <name>Chris Chan</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=7228942</id>
    <updated>2011-01-24T18:20:20Z</updated>
    <published>2011-01-24T18:20:20Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div class="quote-title"&gt;Igor Popik:&lt;/div&gt;&lt;blockquote&gt;To impersonate user outside from Control Panel you just need to generate "magic" parameter (doAsUserId=) which contains encrypted target user id. I used liferay-security tag for that:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
&amp;lt;liferay-security:doasurl doAsUserId="${command.doAsUserId}" var="impersonateUserURL" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;You can  manually "encrypt" paroper parameter value, just look for examples in com.liferay.taglib.security.DoAsURLTag sources :-)&lt;br&gt;&lt;br&gt;Real user needs to have permission to impersonate. This can be defined in custom role (regular) with portal permission User: Impersonate: scope=portal&lt;/blockquote&gt;&lt;br&gt;&lt;br&gt;Can you elaborate how to use this within the context of a portlet form?&lt;br&gt;I'm trying to create a list of users in a select box and on change, initiate the impersonation of that user.&lt;br&gt;&lt;br&gt;Thanks in advance.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Chris Chan</dc:creator>
    <dc:date>2011-01-24T18:20:20Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to impersonate liferay user using API?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=6591409" />
    <author>
      <name>Neha Goel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=6591409</id>
    <updated>2010-11-24T08:40:53Z</updated>
    <published>2010-11-24T08:40:53Z</published>
    <summary type="html">Hi,&lt;br /&gt;&lt;br /&gt;I want to update some data in table when the impersonation happens.Any idea on this.&lt;br /&gt;&lt;br /&gt;regard&lt;br /&gt;neha</summary>
    <dc:creator>Neha Goel</dc:creator>
    <dc:date>2010-11-24T08:40:53Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to impersonate liferay user using API?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=5384086" />
    <author>
      <name>Igor Popik</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=5384086</id>
    <updated>2010-07-22T14:01:00Z</updated>
    <published>2010-07-22T14:01:00Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;To impersonate user outside from Control Panel you just need to generate "magic" parameter (doAsUserId=) which contains encrypted target user id. I used liferay-security tag for that:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
&amp;lt;liferay-security:doasurl doAsUserId="${command.doAsUserId}" var="impersonateUserURL" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;You can  manually "encrypt" paroper parameter value, just look for examples in com.liferay.taglib.security.DoAsURLTag sources :-)&lt;br&gt;&lt;br&gt;Real user needs to have permission to impersonate. This can be defined in custom role (regular) with portal permission User: Impersonate: scope=portal&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Igor Popik</dc:creator>
    <dc:date>2010-07-22T14:01:00Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to impersonate liferay user using API?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=2154258" />
    <author>
      <name>renato guiglia</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=2154258</id>
    <updated>2009-02-11T12:06:57Z</updated>
    <published>2009-02-11T12:06:57Z</published>
    <summary type="html">I have the same problem.&lt;br /&gt;Anyone has a solution?</summary>
    <dc:creator>renato guiglia</dc:creator>
    <dc:date>2009-02-11T12:06:57Z</dc:date>
  </entry>
  <entry>
    <title>How to impersonate liferay user using API?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=2135441" />
    <author>
      <name>L P Bharat</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=2135441</id>
    <updated>2009-02-09T18:22:39Z</updated>
    <published>2009-02-09T18:22:39Z</published>
    <summary type="html">Hi,&lt;br /&gt;&lt;br /&gt;I need to impersonate user using JSF portlet.&lt;br /&gt;Please suggest me how to impersonate user using liferay API.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Lok</summary>
    <dc:creator>L P Bharat</dc:creator>
    <dc:date>2009-02-09T18:22:39Z</dc:date>
  </entry>
</feed>
