Oracle WebCenter Interaction Web Service Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Querying Users Using Oracle WebCenter Interaction Development Kit (IDK) Remote APIs

To query for the current user's ID and group information from a remote application, use the IUserManager interface in the Oracle WebCenter Interaction Development Kit (IDK).

The IUserManager interface only provides access to user-specific administrative functionality. To access user settings and user profile information, use the methods in the com.plumtree.remote.util package. To manipulate user objects, create an Object Manager of type ObjectClass.User. For details, see Retrieving Object Managers Using Oracle WebCenter Interaction Development Kit (IDK) Remote APIs.

To query for the properties for an existing user, follow the steps below. (To retrieve a user ID, you can also execute a standard object query with type ObjectClass.User.)

  1. Create a session with the portal. For details, see Initiating a PRC Session to Use Oracle WebCenter Interaction Development Kit (IDK) Remote APIs.
  2. Retrieve an IUserManager by calling IRemoteSession.getUserManager.
  3. Query the current user's groups, as shown in the sample code below.
    Note: The current user is the user initially used to create the PRC session, the user associated with the login token.
This example retrieves the current user's group associations and prints out the group IDs.
Note: To print out the names of groups, you must look up each group using an IUserGroupManager (IObjectManager with ObjectClass.UserGroup); group names are available on each IObjectQueryRow.

Java

public static void printGroupIDs(IUserManager userManager)
 throws PortalException, MalformedURLException, RemoteException
{
 int[] ids = userManager.getCurrentUserGroups();
 for(int i = 0 ; i < ids.length ; i++)
 {
  System.out.println("Current user belongs to group with ID: " + ids[i]);
 } 
}

.NET (C#)

public static void PrintGroupIDs(IUserManager userManager)
 throws PortalException, MalformedURLException, RemoteException
{
 int[] ids = userManager.GetCurrentUserGroups();
 for(int i = 0 ; i < ids.length ; i++)
 {
  Console.WriteLine("Current user belongs to group with ID: " + ids[i]);
 } 
}

.NET (VB)

Public Shared Sub PrintGroupIDs(ByVal userManager As IUserManager)

 Dim ids() As Integer = userManager.GetCurrentUserGroups()

 Dim i As Integer 
 For i = 0 To ids.Length
  Console.WriteLine("Current user belongs to group with ID: " & ids[i])

EndSub

  Back to Top      Previous Next