User Management Guide

CHAPTER 7

Managing User Profiles

This chapter describes how to manage user profiles. It contains the following sections:

 
Top of page

About user profiles

The purpose of the User subsystem is the profiling of Web application users. User profiles are persistent collections of data associated with individual users of a Web application. Individual data items within a user profile are called attributes. Your exteNd Director application can obtain attributes and store the information in a profile. Later it can retrieve, act upon, and analyze the information.

For more information    For more information, see Accessing User Attributes.

 
Top of section

How profiles are used

Typically, profiles are used for two general purposes:

A portal application might rely on the information in the user profile to determine what content can or should be delivered to a given user or what operations can be performed.

In a retail business, for example, a profile for a customer could contain:

 
Top of page

Profiles and realm configurations

Profiles are stored differently depending on whether you are using a non-LDAP or an LDAP realm. Here are the main differences:

Non-LDAP realms

LDAP realms

Profile information is stored in the application database, which is also used to store ACL-based security information.

Profile information is stored within the LDAP directory; the application database is used for ACL-based security information.

The profile database exists independently from the authentication realm.

Profile information and authentication information are stored in the same user record.

exteNd Director applications use the JDBC persistence provider to access the database.

exteNd Director uses the JNDI persistence provider to access the LDAP directory.

 
Top of section

Checking the realm configuration

exteNd Director allows you to reconfigure an application to use a different authentication realm. If you need this kind of flexibility, you can write code that is general enough to work with both LDAP and non-LDAP realms.

To find out whether or not your application is configured for an LDAP realm, use:

  EboUserHelper.getUserDataStore()

This method returns a string value indicating whether the User subsystem uses JNDI (LDAP directory) or JDBC (application database).

 
Top of section

Checking for a writable realm

To find out whether or not your application is configured for a writable realm, use:

  EboUserHelper.isReadOnlyUserSchema() 

This method returns a boolean value indicating whether or not the User service schema is modifiable. A JDBC schema can be readable or writable, but a JNDI schema is not modifiable within exteNd Director.

 
Top of page

About the New User portlet

The New User portlet is one of the core portlets used in a Portal application. It allows anonymous users to add themselves to the writable realm and automatically creates a profile for each new user.

The New User portlet is provided as a template for your application. You can copy and customize it or design a new one:

NewUserPortlet

The New User portlet does the following:

The sources for this portlet are located in your exteNd installation directory at: Director/templates/TemplateResources/portal-core-resource.

 
Top of page

Accessing profiles using the API

The User API provides methods to create profiles, find profiles, and store and retrieve user-specific information. These are the key classes for user profiling:

User subsystem class

Provides access to

EbiUserDelegate

Methods for creating and accessing user profiles

EbiUserInfo

User attributes

EbiUserQuery

Methods for querying users based on attributes and other criteria

EboUserHelper

Convenience methods for accessing user information

EboFactory

Methods for instantiating the user delegate and related objects

Accessing profiles using the DAC    You can also use the Director Administration Console (DAC) to access user attributes. For more information, see Using the Profiles Section of the DAC.

 
Top of section

Creating a new profile

This code shows how the New User portlet adds a user profile:

  //
  // Get a profile delegate from the user service.
  //
  EbiUserDelegate userDelegate =  
      com.sssw.fw.usermgr.client.EboFactory.getUserDelegate();
  //
  // Instantiate an empty profile object for this user.
  //
  EbiUserInfo userInfo = (EbiUserInfo)userDelegate.createUserInfo();
  //
  // Add profile info (default attributes) for the user.
  //
  userInfo.setUserID(m_uid);
  userInfo.setUserFirstName(m_firstName);
  userInfo.setUserLastName(m_lastName);
  userInfo.setUserEmailAddress(m_email);
  userInfo.setUserAuthenticatedRealmName
      (dirService.getPrimaryRealmName());
  //
  // Add the new profile.
  //
  boolean status = userDelegate.createUser(context, userInfo);	 

 
Top of section

Looking up user profiles

The User API includes user query and user metadata query classes that you can implement to retrieve a list of user profiles that meet certain criteria.

For more information    For more information, see EbiUserQuery and EbiJndiQuery in the API Reference.

 
Top of section

Getting a user profile

This code shows how to obtain and display a user profile:

  import com.sssw.fw.usermgr.api.*;
  import com.sssw.fw.usermgr.client.*;
  
  try {
      //
      // Get the user identifier.
      //
      String userUUID = EboUserHelper.getUserUUID(context);
      //
      // Get a user delegate object from the factory.
      //
      EbiUserDelegate userDelegate = EboFactory.getUserDelegate();
      //
      // Get a user info object.
      //
      EbiUserInfo userInfo =
          (EbiUserInfo)userDelegate.
              getUserInfoByUserUUID(context,userUUID);
      //
      // Get the registration info and add to output buffer.
      //
      sb.append("UserID: " + userInfo.getUserID() + "<br>");
      sb.append("UserUUID: " + userInfo.getUserUUID() + "<br>");
      sb.append("UserFirstName: " + 
          userInfo.getUserFirstName() + "<br>");
      sb.append("UserLastName: " + 
          userInfo.getUserLastName() + "<br>");
      sb.append("UserEmailAddress: " + 
          userInfo.getUserEmailAddress() + "<br>");
  }
  catch (EboFactoryException e) { sb.append( e.getMessage() ); }
  catch (EboSecurityException e) { sb.append( e.getMessage() ); }

 
Top of page

Rules and user profiling

If you are developing an application that implements profiling extensively, you should consider using exteNd Director's Rule subsystem. The following scenario suggests how rules can be applied to user profiling.

Suppose you have a retail Web site where you want to track the total amounts of customers' Web purchases and specify a threshold amount that triggers a special discount. Here is how you could use rules to develop this application:

  1. Add a user attribute to track the amount—AllPurchasesAmt, for example.

  2. In the Rule Editor, create a rule using the built-in CheckWhiteboard condition that allows you to check user profiles (through the ^attributename syntax). Enter a threshold amount and give it a key value—such as ^threshold. For the action section you can return a boolean or appropriate content.

  3. In your code:

 
Top of section

About conditions and actions

Conditions and actions are available in the exteNd Director rules engine to interact with the User and Content Management subsystems (through the Content Query Action). This means you can easily implement personalization rules like this:

  If "UserAge" > 35
  AND "PortfolioTotal" > 30,000
  Then Select Investing Documents Level 3
  AND set "FinanceLevel" to "Gold"

Through exteNd Director's easy-to-use API, custom tag library, and rules engine conditions and actions, you can quickly deliver personalization services to users.

For more information    For more information about rules, see the chapter on how to use rules in the Rules Guide.



Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.  more ...