Programmer's Guide:
Using Member Objects

There are two types of eRoom members: Users and Groups. A User object represents an individual with a login account defined at the community level. A Group object represents a collection of members, which can include Users and/or other Groups.

About Members


Members can be created and deleted through the IERUMemberManager interface. Members can be added to and removed from rooms through the IERURoom interface of the room object. Adding and removing a member through the IERURoom interface merely assigns and removes membership in a particular room. You cannot create new members through IERURoom, and the interface does not provide the means to delete members from the community.

Only community administrators and members who have been given rights to modify the community member list can add new users to the community. Only community administrators and room coordinators can add new users to a room.

Users and Groups


A User object represents an individual with a login account defined at the community level. A Group object represents a collection of members, which can include Users and/or other Groups. Member is a generic term that can refer to either a user or a group. In addition to implementing object-specific interfaces -- IERUGroup for Group objects and IERUUser for User objects -- both Group and User objects implement the interface IERUMember:

  • IERUGroup contains properties and methods that apply only to Group objects. For example, you can use IERUGroup::AddMember to add a member to a Group.

  • IERUUser contains properties and methods that apply only to User objects. For example, IERUUser::LoginName returns a specified user's eRoom login name.

  • IERUMember contains properties and methods that apply to both User and Group objects. For example, IERUMember::Delete removes a Group or individual User from a community's member list. Wherever the Server Access API returns an interface pointer to a User or Group, that pointer is an IERUMember pointer. Use the Type property to determine whether the pointer specifies a User or a Group. Once you determine the type of object, you can access the IERUUser or IERUGroup interface pointer to the object with the User or Group property, if you are programming with a scripting language, or the QueryInterface function, if you are programming with C++.
  • The following code snippet returns either the login name or the group name from an IERUMember interface pointer that has already been initialized.

    Dim Member as IERUMember
    Dim Name as String
    .
    .
    .
    'Assume that the Member variable has been initialized.
    If Member.Type == erMemTypeGroup Then
    Set Name = Member.Group.Name
    Else
    ' Member.Type must be erMemTypeUser.
    Set Name = Member.User.LoginName
    End If

    The following code snippet searches for a group named Customers in the member list of a particular room.

    'Get the room interface.
    Dim App as ERUApplication, UC
    Dim Room as IERURoom
    Dim MemberList as IERUCollection
    Dim GroupName as String
    Set App = CreateObject("eRoom.Application")
    Set UC = App.LoginUser("myUser")
    Set Room = App.GetFacilityByName("myfacility").GetRoomByName("myroom")
    'Get the member list from the room.
    Set MemberList = Room.GetMembers(erMemFlagGroupsOnly)
    For each Member in MemberList
    GroupName = Member.Name
    If (GroupName == "Customers")
    'Do something
    Debug.Print "Found it!"
    End If
    Next

    In this snippet, the erMemFlagGroupsOnly parameter tells the GetMembers method to only return a list of groups who are members of the room. See the Reference Guide for more information on other flag values that can be used with this method.

    Enum

    Description

    erMemFlagNone

    Returns groups and users, doesn't expand groups

    erMemFlagExpandGroups

    Expands groups to show their membership

    erMemFlagGroupsOnly

    Returns only groups

    erMemFlagUsersOnly

    Returns only individual Users

    The following code snippet prints out the first names of all the Users in a Facility's member list.

    Private Sub Print()
    Dim App as new ERUApplication
    dim uc as ERUUserContext
    Dim Facility As IERUFacility
    Dim Room As IERURoom
    Dim Member As IERUMember
    Dim Coll As IERUCollection
    Set UC=App.LoginUser("asteele")
    Set Facility = App.GetFacilityByName("fac6")
    Set Coll = Facility.MemberManager.GetMembers(erMemFlagUsersOnly)
    Dim m as member

    For each m in Coll

    Debug.Print m.FirstName   'Note in V7 .User interfaces accessor not needed.
    Next i

    End Sub

    Working with Groups


    Groups provide a way to collect members into a logical set, and to refer to them indirectly. The most common use of Groups is for defining eRoom membership, so that new team members can be admitted to all the Rooms they need to participate in without each eRoom's coordinator having to add them, individually, to that Room's participant list.

    The simplest Group, "All", is created automatically, and includes all the members of a community's member list. As people are added to and deleted from the community's member list, they are automatically added to and removed from the member list for any Room that uses the All Group. Use the Flags property to determine if a Group returned from an API call is the All Group.

    Adding and removing group members
    The AddMember method adds a member to a Group. The RemoveMember method removes a member from a Group. The member can be an individual User or another Group. Remember that the member you add to a Group must already exist in the community's member list.

    Accessing members in a group
    The IERUGroup interface contains two methods that let you learn about and access a Group's members.

    Method

    Description

    ContainsMember

    Determines whether a User or Group is a member of a specified Group.

    GetMembers

    Returns an IERUCollection interface pointer to the members of a Group.

    Working with Member Sets


    A Member Set is a collection of eRoom Users and/or Groups. Member sets can be used for better performance when performing the same operations on many members. For example, if you want to add multiple members to a group, rather than make multiple AddMember calls, you can make a single call to AddMembers after adding the members to a member set.

    The following code sample makes all of the members of Room1 members of Room2.

    Dim Room1 as IERURoom
    Dim Room2 as IERURoom
    Dim User as IERUUser
    Dim Group as IERUGroup
    Dim MemberList as IERUCollection
    Dim MemberSet as New ERUMemberSet

    Set Room1 = Facility.GetRoomByName("room1")
    Set Room2 = Facility.GetRoomByName("room2")

    Set MemberList = Room1.GetMembers()
    For each Member in MemberList
    MemberSet.AddMember(Member)
    Next
    Room2.AddMembers(MemberSet, erRoleParticipant)

    Deleting, Deactivating and Reactivating Users


    Users, once created, can later be deleted or deactivated. Deleting a user removes the user from the community's member list, although the user's name may still appear in some parts of the eRoom user interface. For example, the user still appears as the creator of an object, or in access control lists. Users who have been deleted cannot be undeleted. You can create another user with the same account information, but it will not be the same User object as the original, deleted user. The new user will, for example, have a different ID. To delete a User (or Group), call the Delete method in the IERUMember interface. You can still access deleted Users and Groups through SAAPI, if they are referenced by other objects, for example, as an item's creator. You can tell if a User or Group has been deleted by getting the IsDeleted property in the IERUMember interface.

    Deactivating a User is an alternative to deleting that allows you to reactivate the user later. Deactivated Users do not consume licenses, so deactivating can prove convenient if you have a large user community that comes and goes over time - you can deactivate some users and add or reactivate others as necessary to stay at or below the number of users allowed by your license. Getting the IsDeactivated property in IERUMember indicates whether a User is deactivated, and setting the property deactivates or reactivates the User.

    Note that you can't deactivate and reactivate Groups.

    Working with Custom Roles


    A custom role is a unique title for one of the three standard, built-in eRoom roles (coordinator, participant, observer). Custom roles give coordinators a way to assign members (individuals and groups) to meaningful, functional roles and to grant all members having the same role the same level of access in an eRoom. In addition, you can use custom roles everywhere you can use members or groups in an eRoom: Access control settings, routing permissions, database member list and approval fields, and so on.

    Unlike groups, which are community-wide, custom roles are specific to a particular room.IERURoom contains a CreateCustomRolemethod and a CustomRolesproperty that let you work with custom roles. Use the CreateCustomRole method to create custom roles and the CustomRoles property to get an IERUCollection interface pointer to the collection of custom roles associated with a particular eRoom.

    Custom roles are especially useful when you create template eRooms because you can assign specific functions to particular roles (such as Project Manager, or Editors) ahead of time. You can then use the CreateRoom method to create eRooms based on your template and use AddMember and AddMembers to fill those custom roles with the appropriate members or member sets. Members with custom roles have the access level accorded that role. As always in an eRoom, the highest level of access a member has whether through their individual or group status, takes precedence.

    IERUCustomRole contains methods that let you add and remove members and groups to custom roles and properties that let you get a variety of information about custom roles, including name, description, access level, and the eRoom to which the role belongs.