Showing posts with label wps615. Show all posts
Showing posts with label wps615. Show all posts

Creating Impersonation URL in the theme

As per the portal Infocenter, we can create a Impersonation link in the theme by adding following code to the theme

<portal-logic:if loggedIn="yes">
<portal-logic:if userImpersonated="false">
<portal-navigation:urlGeneration contentNode="ibm.portal.Impersonation">
<li><a href='<% wpsURL.write(escapeXmlWriter); %>'><portal-fmt:text key='link.impersonate'
bundle='nls.engine'/></a></li>
</portal-navigation:urlGeneration>
</portal-logic:if>
</portal-logic:if>


I tried adding this code to banner_toolbar.jsp in default IBM theme but it does not work, first i got compiler error in portal:logic tag saying the userImpersonated attributed does not exists and when i changed in Info center it seems that portal:logic tag does not have that attribute.

Then i tried without the portal:logic tab and it seems that the ibm.portal.Impersonation content node does not exist either. So portal cant generate url to that page.

Whats new in WebSphere Portal Server Version 6.1.5

WebSphere Portal Server Version 6.1.5 has introduced quite a few new features, i tried playing around with some of them.


  1. Impersonation Service

  2. Enhanced Portal theme

  3. Improved version of enable-develop-mode-startup-performance

  4. The Client side aggregation theme works in IE 8 and Firefox 3.5

  5. Support for Dojo 1.3.2

Sample Impersonation portlet

WebSphere Portal 6.1.5 has a feature called Impersonation that you can use to create a portlet that will let support person impersonate other users.

I built a sample portlet to demonstrate how to use impersonation service. This sample portlet has a form where you can enter uid of the user that you want to impersonate, once you enter uid and click submit, it will impersonate that user. Once your done and want to switch back to the original user you can click on Switch back to original user link. You can download this sample portlet from here

Important Note: I followed the documentation to build this portlet and i could get impersonation part working but switching back to original user is not working. Even after calling ImpersonationService.loginOriginalUser() method it still keeps showing impersonated user. But when i click on logout, it starts showing the original user. I got this problem on WebSphere Portal Version wp6103_201_01 2009-11-07. I am planning to apply fixpack 6.1.5.1 to my portal and see if it helps

This is how my ImpersonationPortlet.java looks like


package com.webspherenotes.misc;

import java.io.IOException;

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.ProcessAction;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import com.ibm.portal.portlet.service.PortletServiceHome;
import com.ibm.portal.portlet.service.impersonation.ImpersonationException;
import com.ibm.portal.portlet.service.impersonation.ImpersonationService;

public class ImpersonationPortlet extends GenericPortlet{

PortletServiceHome psh;
public void init() throws PortletException {
System.out.println("Entering ImpersonationPortlet.init()");
try {
InitialContext context = new InitialContext();
psh= (PortletServiceHome)context.lookup(ImpersonationService.JNDI_NAME);
} catch (NamingException e) {
e.printStackTrace(System.out);
}
System.out.println("Exiting ImpersonationPortlet.init()");
}

protected void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
System.out.println("Entering ImpersonationPortlet.init()");

response.setContentType("text/html");
getPortletContext().getRequestDispatcher("/index.jsp").include(request, response);
System.out.println("Exiting ImpersonationPortlet.init()");
}

@ProcessAction(name="switchUser")
public void switchUser(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
System.out.println("Entering ImpersonationPortlet.switchUser()");
try {
String userId = request.getParameter("USER_NAME");
System.out.println("Value of USER_NAME " + userId);
ImpersonationService impersonationService = psh.getPortletService(ImpersonationService.class);
impersonationService.doImpersonate(request, response, userId);
} catch (ImpersonationException e) {
e.printStackTrace(System.out);
}
System.out.println("Exiting ImpersonationPortlet.switchUser()");
}

@ProcessAction(name="originalUser")
public void originalUser(ActionRequest request, ActionResponse response) throws PortletException, IOException{
System.out.println("Entering ImpersonationPortlet.originalUser()");
try {

ImpersonationService impersonationService = psh.getPortletService(ImpersonationService.class);
System.out.println("Switching back to original user " + impersonationService.getOriginalUser());
System.out.println("Is User Impersonated " + impersonationService.isUserImpersonated());
impersonationService.loginOriginalUser(request, response);
System.out.println("After switching back to original user " + request.getRemoteUser());
} catch (ImpersonationException e) {
e.printStackTrace(System.out);
}
System.out.println("Exiting ImpersonationPortlet.originalUser()");
}
}


The ImpersonationPortlet has following two methods that can handle the Action Request,


  1. switchUser: method will get called whenever user enters a uniqueName for the user that you want to impersonate and click submit. In this method i am reading name the value submitted by user and then calling impersonationService.doImpersonate() method with userName submitted by the user. THis method will switch the user and redirect you to the home page for that user

  2. originalUser: THis method will get called when user clicks on Switch back to original user link, at this point i am calling impersonationService.loginOriginalUser(request, response) method to switch back to the original user.



This is the jsp that gets displayed to the user in the VIEW mode and has methods for impersonating and switching back the user.

<%@page language="java" %>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<portlet:defineObjects />

<%
String userId = request.getRemoteUser();
%>
<portlet:actionURL var="switchUserUrl">
<portlet:param name="javax.portlet.action" value="switchUser" />
</portlet:actionURL>
<h4>Current User - <%=userId %></h4>
<h4>Enter name of the user to impersonate</h4>
<form method="post" action="<%=switchUserUrl %>">
<table>
<tr>
<td>User Id</td>
<td><input type="text" name="USER_NAME" /></td>
</tr>
<tr>

<td><input type="submit" name="submit" /></td>
</tr>

</table>

</form>
<portlet:actionURL var="originalUserUrl">
<portlet:param name="javax.portlet.action" value="originalUser" />
</portlet:actionURL>

<h4>Click on URL to switch back to Original User</h4>
<a href='<%=originalUserUrl %>' >Switch back to original user</a>


This is the screen shot of the impersonation portlet

What is impersonation

Websphere Portal 6.1.5 has a new feature called Impersonation, what it does is allow a user, such as a support specialist, to access another user's system to test out a new page, portlet, etc. and to see any issues as they occur on the end user system. Portal Access Control (PAC) controls the ability to impersonate another user. To be able to impersonate another user, the Delegator role on the virtual resource Users, i.e. Delegator@Users must be assigned. You first need to enable the impersonation feature within IBM WebSphere Portal.

The impersonation feature is disabled by default and you will have to follow these steps to enable it


  • Log on to the WebSphere Application Server Integrated Solutions Console or Network Deployment Administration Console.

  • Perform the following steps to enable the Impersonation feature:

    1. Navigate to Resources > Resource Environment > Resource Environment Providers > WP Authentication Service > Custom Properties.

    2. Click New.

    3. Enter logout.explicit.filterchain in the Name field.

    4. Enter com.ibm.wps.auth.impersonation.impl.ImpersonationLogoutFilter in the Value field.


    5. Click Apply and then click Save to save the changes directly to the master configuration.

    6. Navigate to Resources > Resource Environment > Resource Environment Providers > WP PortletServiceRegistryService > Custom Properties.

    7. Click New.

    8. Enter jndi.com.ibm.portal.portlet.service.impersonation.ImpersonationService in the Name field.

    9. Enter com.ibm.wps.portletservice.impersonation.impl.ImpersonationServiceImpl in the Value field.



    10. Click Apply and then click Save to save the changes directly to the master configuration.

    11. Stop and restart the WebSphere_Portal server.

    12. Perform the following steps to assign the Delegator role to a user:

      • Log on to WebSphere Portal as the Administrator.

      • Click Administration.

      • Click Access > User and Group Permissions.

      • Click Users.

      • Search for the user you want to assign as Delegator.

      • Click the Select Resource Type icon for the required user.

      • Navigate to the page that contains the Virtual Resources option, using the Page Next button and click that link.

      • Navigate to the page that contains the USERS option and click the Assign Access icon.

      • Select the Explicitly Assign checkbox for the Delegator role.



      • Click OK.

      • Verify that the required user now has User and Delegator access.





Enhanced portal theme

WPS 6.1.5 introduces a new theme called Enhanced Portal theme, which introduces lot of new features such as page builder,...

One big change in the enhanced theme is that it makes use of DIV + CSS instead of tables. I am not expert in HTML so i did search on google to find out what is difference between div and table and it seems that there are quite few articles that list out problems with table layout, things like the table layout is difficult to maintain, CSS should be used for managing layout instead of table, some stack overflow problems in the browser,..etc. This is one of the article

I tried using firebug to see the difference in traditional theme and enhanced theme. I did apply it to same page and then outlined all tables using Web developer plugin.
This is screen shot of the enhanced theme


Screen shot of the traditional theme


As you can see the enhanced theme does not make use of the tables for layout as heavily as that of the traditional theme

WebSphere Portal 6.1.5 ships with Dojo 1.3.2

Starting from version 6.1.5 WebSphere Portal ships with Dojo 1.3.2 in addition to Dojo version 1.1.1. Starting from portal 6.1 dojo version 1.1.1 is shiped as part of the wps.ear, to be precise it is in wp_profile\installedApps\sunpa\wps.ear\wps.war\themes\dojo\portal_dojo folder, IBM kept it as it is.

In order to include Dojo 1.3.2 they create a Dojo_Resources.ear file which has 1.3.2 version of the dojo



The Dojo_Resources.ear has new version of dojo and few additional dojo classes created by IBM, these classes implement some of the IBM's client side logic. This enterprise application does not have any java classes so its used only for making dojo resources accessible.



As you can see the Dojo_Resources.war is available at /portal_dojo path. The dojo client side theme loads dojo from this path



As you can see the value of baseUrl property in the djConfig is /portal_dojo/dojo/, that means dojo is loaded from this location. You can see that even the tundra.css or other dijit related resources are loaded from Dojo_Resources.war.



You can verify the dojo version by looking at dojo.version properties. As you can see we are using 1.3.2 version

Improved version of enable-develop-mode-startup-performance

WebSphere Portal has concept of Development mode for some time, basic idea is to improve the startup time of portal by delaying the startup of application. The application should be started when it is accessed for first time instead of starting it at the server startup time. As per Marshal Lamb there are close to 75 portlets for administrating portal and some of the companies dont use Portal Admin Console in certain environments such as Production.

When working in Portlet developer role i dont use Portal Admin Console as much, most of my work revolves around updating the portlet application which i can do easily using RAD and RAD makes use of xmlaccess and wsadmin script so i dont need any of the Admin portlets.

WebSphere Portal provides enable-develop-mode-startup-performance to enable development mode and disable-develop-mode-startup-performance task to disable development mode. This part is same as that of WPS 6.1, what has changed is that now this task works more gracefully, before it use to disable Portal Help, Portlet palette, Personalization. As part of WPS 6.1.5, IBM did test this feature to make sure that everything works properly.

I tried using development mode on WPS 6.1.5 and now it works really well. I havent run into any problems so far.

Whats new in Websphere Portal 615

Today morning i did attend the Whats new in WebSphere Portal 6.1.5 call. It was bit early for west coast time zone (7.00 AM) but it was really good.

Marshal Lamb, who is Senior technical staff member was the main speaker in this call, He talked about how IBM WebSphere Portal is used by lots of user facing internet site (Search for /wps/portal in Google and you will find quite few sites) and IBM is planning to make it easier for them to build internet facing sites using WebSphere Portal.

It seems that IBM has made lot of investment in improving IBM's Worplace web content management solution from the perspective of end user, content authors and also for companies by providing lot of pre-built templates. They added social computing by giving support for Blogs and Wikis built on top of IBM' WWCM. The integration in WWCM and portal is much more tighter now. They are also investing on newer technologies such as widgets now widgets are primary citizens in the WebSphere portal world.

In all it seems that WPS 6.1.5 is really cool and seems to have lot of features that we were waiting for. Marshal also indicated that there might be a new version of portal sometime in 2010.

I did install WPS 615 on my machine yesterday and now i am planning to try out some of the newer features

The Client side aggreagation theme works in IE 8 and Firefox 3.5

One of the major problem with the WPS 6.1 was that it ships with Dojo 1.1 and since Dojo 1.1 does not work with Internet Explorer 8 or Mozilla's Firefox 3.5, If you tried using the client side aggregation (CSA) theme it use to throw the this browser is not supported error and it use to automatically switch the theme to Server side aggregation (SSA) theme.

Starting with WPS 6.1.5 the Portal ships Dojo 1.3.2 version and as a result the CSA theme works in both Internet Explorer 8.0 and Mozilla Firefox 3.5




As you can see i am using Firefox 3.5.5 (3.6 beta) and you can see that i am using a CSA theme and portal is making call ATOM service to get parts of the theme.



This is my screen shot of Client side aggregation theme being used in Internet Explorer 8 and as you can see i dont have to switch to the compatibility mode (IE 8 has concept of compatibility mode, if the website that your accessing is not compatible with IE 8 then you can switch into compatibility mode and IE 8 will behave like IE7)