Tuesday, November 5, 2013

Contextual User Impersonation in Liferay

It has been little more than a year since I started working on Liferay. As a horizontal portal, it does several things and is real good at many of those things it does. One such feature is called User Impersonation and I can't tell you how under appreciated this feature is.

In a nutshell User Impersonation is a feature which allows administrative users to impersonate any other Liferay user from control panel  -> user and organization. And this allows the administrative user to view the portal application as the person they are impersonating. This is cool way to troubleshoot any user specific issues without doing a screen sharing or having to visit the user.

Now, bear in mind that this feature is available only within control panel under user and organization portlet. So every time you need to use this feature you have to navigate to control panel first and once you have impersonated the user then you navigate to the page where some troubleshooting is required.

Wouldn't it be nice to have this feature at your fingertip irrespective of which page you are on at a given point in time? Well, ABSOLUTELY!!

So why the wait, just download the plug-in and make some minor entries to your existing theme(s) and you are good to go. You may also add this to your control panel theme and this way not only the end user pages, but the control panel pages can be impersonated right within their context.

Contextual User Impersonation in Action:





Notice how it disappears when non admin user views the page
Code to embed in theme:
Replace your dock bar code with this. Make sure to keep the admin check because this is a run time include and you don't want too many run time includes in your theme for regular users.
#if ($is_signed_in)
       #dockbar()
       #if($themeDisplay.getPermissionChecker().isOmniadmin())
              $theme.runtime("userimpersonation_WAR_userimpersonationportlet")
       #end
#end
 


Download This Plugin


If you liked this plug-in, a simple link back to this blog would be appreciated. Also provide your feedback if any. May be in future we'll see this feature built right into the docbar itself.

No comments:

Post a Comment