AquaLogic User Interaction Development Guide

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

Creating Groups and Adding Users Using IDK Remote APIs

To create new groups and manage group membership from a remote application, use the IUserGroupManager interface in the IDK.

To create a new group and add a user, follow the steps below.
Note: The PRC IUserGroupManager interface only provides access to group-specific administrative functionality. To manipulate group objects, create an Object Manager of type ObjectClass.UserGroup.
  1. Create a session with the portal. For details, see Initiating a PRC Session to Use IDK Remote APIs.
  2. Retrieve an IUserGroupManager by calling IRemoteSession.getUserGroupManager.
  3. Create a new method to create a group.
  4. Create a new group using the folder ID as shown in the sample code below. There are two ways to retrieve an administrative folder ID: (1) Use PRC search to perform a search for administrative folder objects, or (2) Let the user select a folder by using a pt:treeLink tag with classID = 20. (There is no IObjectManager for administrative folders.) For details on tags, see About Adaptive Tags.
  5. Return the group ID for the newly created group.
  6. Create a new method to add a user.
  7. Add the user to the new group, using the group ID returned in the previous method. (To query for an existing group ID, execute a standard object query using ObjectClass.Group.)

Java

public static int createEmptyGroup(IUserGroupManager userGroupManager, int adminFolderID)
 throws PortalException, RemoteException
{
 int newGroupID = userGroupManager.createGroup(
  "IDK Group",
  "Created in IDK example",
  adminFolderID,
  new int[0], //no member users
  new int[0]); //no member groups
 return newGroupID;
}

public static void addUserToGroup(IUserGroupManager userGroupManager, int userIDToAdd,
int newGroupID)
 throws PortalException, RemoteException
{
 userGroupManager.addMemberUsers(newGroupID, new int[]{userIDToAdd});
}

.NET (C#)

public static int CreateEmptyGroup(IUserGroupManager userGroupManager, int adminFolderID)
{
 int newGroupID = userGroupManager.CreateGroup(
  "IDK Group",
  "Created in IDK example",
  adminFolderID,
  new int[0], //no member users
  new int[0]); //no member groups
 return newGroupID;
}

public static void AddUserToGroup(IUserGroupManager userGroupManager, int userIDToAdd,
int newGroupID)
{
 userGroupManager.AddMemberUsers(newGroupID, new int[]{userIDToAdd});
}

.NET (VB)

Public Shared Function CreateEmptyGroup(ByVal userGroupManager As IUserGroupManager,
ByVal adminFolderID As Integer)

 Dim emptyIntegerArray(0) As Integer
 Dim newGroupID As Integer = userGroupManager.CreateGroup( _
  "IDK Group", _
  "Created in IDK example", _
  adminFolderID, _
  emptyIntegerArray, _
  emptyIntegerArray) 'no member users or groups
 Return newGroupID

EndFunction

Public Shared Sub AddUserToGroup( _
 (ByVal userGroupManager As IUserGroupManager, ByVal userIDToAdd As Integer, ByVal newGroupID As Integer)

 Dim singleUserArray() As Integer= {userIDToAdd}

 userGroupManager.AddMemberUsers(newGroupID, singleUserArray)

EndSub

  Back to Top      Previous Next