+

Search Tips   |   Advanced Search


PUMA - User and group management


Overview

The Portal User Management Architecture (PUMA) SPI finds, creates, modifies and deletes User and Group profiles.

User and Group interfaces inherit the getObjectID() method from com.ibm.portal.Identifiable, which is used to obtain the ObjectID


Provider objects

Before using provider objects, portlets retrieve the appropriate home interface...


Example: Use standard portlet to obtain the identifier of a User as a String

PortletServiceHome serviceHome; 

try
{
   javax.naming.Context ctx = new javax.naming.InitialContext();
   serviceHome = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");

   if (serviceHome != null)
   {
      PumaHome pHome       = (PumaHome) serviceHome.getPortletService(PumaHome.class);
      PumaProfile pProfile = pHome.getProfile(request);
      User user            = pProfile.getCurrentUser();
      String user_objid    = pProfile.getIdentifier(user);
   }
} 
catch (PumaException pe)
{
   // ... error handling ...
} 
catch(javax.naming.NameNotFoundException ex) 
{
   // ... error handling ...
} 
catch(javax.naming.NamingException ex) 
{
   // ... error handling ...
}

Do not store PumaProfile, PumaLocator and PumaController objects in a session or anywhere else. Retrieve them from PumaHome each time you use them. PumaHome can be stored.


Example: Use a standard portlet to search for read and write attributes

List<User> usersStartingWithA = pumaLocator.findUsersByAttribute("uid", "a*");

// if no value for ibm-primaryEmail attribute is set, then set it List<String> 

requestedAttributes = new ArrayList<String>(2);
requestedAttributes.add("uid");
requestedAttributes.add("primaryEmail");

for(User user: usersStartingWithA) 
{ 
    Map<String, Object> attributes = pumaProfile.getAttributes(user, requestedAttributes);

    if (attributes.get("primaryEmail")==null || "".equals(attributes.get("ibm-primaryEmail")))
    { 
        pumaController.setAttributes(user, Collections.singletonMap("ibm-primaryEmail", attributes.get("uid")+"@ibm.com"));
    }
}


Parent topics:

Customize the portal
Develop portlets


Related concepts

Remote PUMA SPI REST Service
Portal style classes
Work with portal navigation
Use JSTL tags in the portal JSPs
Create a new theme
Import a theme
Deploy the theme
Create a new skin
Enable automatic JSP reloading
Support new clients
Support new markup languages
Change banner text
Use the color palette in themes
Performance guidelines for themes and skins
Change the page help