Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Impersonate user option in action button
When i am impersonating a user , it works fine for the home page . But then when i click on something or redirects my page to another page then the view is changed to original user perspective. I want to view all the process as impersonate user . Please someone help.
When you impersonate a user, Liferay adds a "?doAsUserId=<TOKEN>" parameter to the url. When you click somewhere, that parameter is probably lost. In your case, you can:
a) Copy that parameter and add it yourself again, when it is lost (inconvenient, but it might work)
b) I guess, you or some contractor did some customizing. Whoever did that, has to make sure that that parameter is always attached to all urls.
Option a) is probably sufficient, if you just want to check something. Option b) requires some work and probably some changes/fixes on your theme or applications.
a) Copy that parameter and add it yourself again, when it is lost (inconvenient, but it might work)
b) I guess, you or some contractor did some customizing. Whoever did that, has to make sure that that parameter is always attached to all urls.
Option a) is probably sufficient, if you just want to check something. Option b) requires some work and probably some changes/fixes on your theme or applications.
Thanks christopher for your time. First i also did that using copy paste only and that works fine.But i wanted that thing to happen itself(i.e: doAsuserid should come itself attached to the url).
Just to add to what Christoph is saying -- if you are creating <portlet:actionURL/>'s in your view, you could also swap those out to use the ext taglib version that Liferay provides, changing the tag to <liferay-portlet:actionURL/>. If you do that, then you can use attributes on the tag to impersonate either the group or the user.
<attribute>
<name>doAsGroupId</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>doAsUserId</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™