esup-portal-ws - a web service to publish groups and user attributes

Overview

One of the main issues we encountered when developing portlets is that the portal and the portlets run in different Tomcat contexts, which prevents from accessing the portal objects from the portlets, in particular, the groups and the user attributes (Note: hopefully this separation has many advantages).

The package esup-portal-ws solves this issue by providing a web service (executed by uPortal and interrogated by the portlets) which gives access to the portal groups and user attributes.

This project can be useful for the people who develop portlets or port existing uPortal channels to portlets, and who want to keep a close integration between their portlets and the portal Information System.

Licence

esup-portal-ws is an open source development.

As part of the ESUP-Portail project, esup-commons is distributed under the GPL (General Public License). It follows that you can download contents, modify and redistribute them provided you respect the GPL terms.
Details on the licensing policy of the ESUP-Portail project can be found at http://www.esup-portail.org/license.
Be sure that you have well understood the terms of the license before using the contents it covers.

For more information please refer to http://www.esup-portail.org

Copyright (c) 2006 - Consortium ESUP-Portail

Acknowledgements

  • Pascal Aubry (University of Rennes 1, maintainer)
  • Mathieu Larchet (University of Nancy 2)
  • Yohan Colmant (University of Valenciennes)
  • Vincent Mathieu (Univesity of Nancy 2)
  • Julien Marchal (University of Nancy 2)
  • Fabrice Jammes (University of Paris 1)

Download

The complete archive of the package can be downloaded here: https://sourcesup.cru.fr/frs?group_id=311.

ChangeLog

2006/12/07

New feature

  • added methods getContainingGroupsById() and getContainingGroupsByName() (Fabrice Jammes).

Other changes

  • user attributes automatically retrieved when retrieving users (Pascal Aubry).

2006/11/09

Bug fix

  • some loggers not correctly initialized (Mathieu Larchet).
  • no PortalUserNotFoundException thrown when retrieving non existant users (Pascal Aubry).

Other changes

  • user attributes automatically retrieved when retrieving users (Pascal Aubry).

2006/11/08

Enhancements

  • added methods getSubGroups(), getSubGroupsById(), getSubGroupByName(), getGroupHierarchyById() and getGroupHierarchyByName() to PortalService (Pascal Aubry, requested by Mathieu Larchet).
  • added the manifest in JARs (Pascal Aubry, requested by Mathieu Larchet).

2006/11/06

  • initial version (Pascal Aubry).

Usage

Download the two JARs:

  • uportal-ws-server-YYYYMMDD.jar, the server part of the web service.
  • uportal-ws-client-YYYYMMDD.jar, the client part of the web service.

In uPortal (server-side)

  1. Copy uportal-ws-server.jar to your uPortal hierarchy (in a folder like <install-dir>/uPortal/lib).
  2. Activate Axis web services by editing <install-dir>/uPortal/webpages/WEB-INF/server-config.wsdd, which should contains something like:
<service name="UportalService" provider="java:RPC">
    <parameter name="allowedMethods" value="getUser,getUserAttributes,getGroupById,getGroupByName,getSubGroups,getSubGroupsById,getSubGroupsByName,getRootGroup,getGroupHierarchyById,getGroupHierarchyByName,getGroupHierarchy,getUserGroups,isUserMemberOfGroup,getContainingGroupsByName,getContainingGroupsById"/>
    <parameter name="className" value="org.esupportail.portal.ws.server.UportalService"/>
    <parameter name="scope" value="application"/>
</service>

In your application (client-side)

Copy uportal-ws-client.jar to your library folder of your application.

Several implementations of the interface PortalService are available for uPortal:

  • BasicUportalServiceImpl, that interrogates a uPortal web service in order to retrieve uPortal groups and user attributes.
  • TestableSimpleUportalServiceImpl, an extension of BasicUportalServiceImpl that can be tested thanks to the ant target test_portal.
  • CachingUportalServiceImpl, an extension of TestableUportalWebServiceImpl that caches the WS requests in order to improve performance.

Declare a Spring bean:

<bean
    id="portalService"
    class="org.esupportail.portal.ws.client.support.uportal.CachingUportalServiceImpl"
    >
  <property name="url" value="http://localhost/services/UportalService">
    <description>The URL that responds to the portal web service.</description>
  </property>
  <property name="testUserId" value="paubry">
    <description>A test user id, used by the method test().</description>
  </property>
  <property name="testGroupId" value="local.0">
    <description>A test group id, used by the method test().</description>
  </property>
  <property name="testGroupName" value="Tous les groupes de personnes">
    <description>A test group name, used by the method test().</description>
  </property>
  <property name="cacheManager" ref="cacheManager">
    <description>The cache manager, required.</description>
  </property>
  <property name="cacheName" value="">
    <description>The name of the cache, optional.</description>
  </property>
</bean>
<bean
    id="cacheManager"
    class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
    >
  <description>
    This bean is used to configure EhCache.
  </description>
  <property name="configLocation" value="classpath:/properties/cache/ehcache.xml" />
</bean>

Use the methods of PortalService:

PortalService portalService = (PortalService) beanFactory.getBean("portalService");
PortalGroup rootGroup = portalService.getRootGroup();
PortalGroup group = portalService.getGroupById("local.10");
PortalUser user = portalService.getUser("paubry");
List<String> values = portalService.getUserAttributeValues("paubry", "departmentNumber");
if (portalService.isUserMemberOfGroup("paubry", "local.10"))   {
    ....
}

SVN access

esup-portal-ws is hosted by SourceSup at http://subversion.cru.fr/esup-portal-ws.

Browse the SVN repository here: http://sourcesup.cru.fr/cgi/viewvc.cgi/?root=esup-portal-ws.