Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Gwowen Fu
Get impersonated User ID using Javascript
April 5, 2013 2:32 PM
Answer

Gwowen Fu

Rank: Expert

Posts: 302

Join Date: December 27, 2010

Recent Posts

Hi,
I am using Liferay Javascript API to create a resource URL. It works fine with my account. When I impersonate someone else then the link won't work.

I think I need to add "doAsUserId" to the URL, my question is how do I get the encrypted impersonated user ID?

Does Liferay Javascript API provides a way to get that?

1   
2var resourceURL= Liferay.PortletURL.createResourceURL();
3resourceURL.setResourceId(methodName);
4resourceURL.setPortletMode("view");
5resourceURL.setWindowState("normal");
6resourceURL.setPortletId("fusion_WAR_learnplugin");


Thanks!
Gwowen
Mika Koivisto
RE: Get impersonated User ID using Javascript
April 5, 2013 4:58 PM
Answer

Mika Koivisto

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1505

Join Date: August 7, 2006

Recent Posts

The themeDisplay javascript object has the doAsUserId in encrypted form and you can pass it as is in the ajax call using parameter name doAsUserId.
Gwowen Fu
RE: Get impersonated User ID using Javascript
April 6, 2013 3:11 PM
Answer

Gwowen Fu

Rank: Expert

Posts: 302

Join Date: December 27, 2010

Recent Posts

Thanks, I will try that.