Add owners and members to a community 

Use scripts accessed using the wsadmin command-line tool to add owners and members to existing communities. You can only add individuals to a community; you cannot add a group to a community. There is no limit on the number of members that you can add to a community.


Before you begin

To use administrative commands, use the wsadmin client. See Starting the wsadmin client for details. The administrative commands for adding owners and members to a community do not require a server restart to take effect, and no file checkout is necessary.

Note: You can also use the commands listed below to add owners and members to subcommunities.


About this task

The config-admin Jython scripts that get and set properties use the implicit AdminConfig object available in IBM WAS Admin (wsadmin) to interact with the Communities server. If an error occurs when you are using the following MBean commands, you can determine what went wrong by examining the SystemOut.log file.


Procedure

  1. From the dmgr host:

      cd $DMGR_PROFILE/bin
      ./wsadmin.sh -jython
      execfile("communitiesAdmin.py")

      If prompted to specify a service to connect to, type 1 to pick the first node in the list. Most commands can run on any node. If the command writes or reads information to or from a file using a local file path, pick the node where the file is stored.

  2. Use the following commands to add additional members or owners to an existing community or subcommunity.

      CommunitiesService.addMembersToCommunityByEmail(String communityName, Integer memberRole, List emailAddresses)

        Adds members to an existing community or subcommunity.

        Note: When you use this command to add owners or members to a subcommunity, the users that you are adding must belong to the parent community in order for them to be added to the subcommunity.

        You use this command in two steps. First, create a comma-separated list of users (using their email addresses) that you want to add to an existing community or subcommunity and assign this list to a variable. This variable is then used as input into the addMembersToCommunity command.

        Note that communityName is a string and must be enclosed in quotation marks ("). This parameter is case-sensitive, so be sure to specify the name of the community or subcommunity exactly.

        memberRole. Valid settings are 0 (member) or 1 (owner). Do not enclose this setting in quotation marks.

        For example:

        wsadmin>threemembers= ["alex_jones@example.com", "mary_smith@example.com", "paul_henderson@example.com"]
        wsadmin>CommunitiesService.addMembersToCommunityByEmail("Ski Club Community",0,threemembers)

        Note: When you use this command, if the community or subcommunity name that you provide as input to the command is not unique, an error similar to the following displays:

        WASX7015E: Exception running command: "CommunitiesService.addMembersToCommunityByEmail("My community",0,threemembers)"; exception information:
         javax.management.RuntimeMBeanException
        java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: CLFRM0091E: Multiple communities found with name: My community

        When you see an error like the above, instead of entering the name of the community or subcommunity in the command, enter the UUID instead. For example:

        wsadmin>CommunitiesService.addMembersToCommunityByEmail("5742c4c8-0010-4e6e-abdb-65015e8a22e1", 0,threemembers)

        You can obtain the UUID for a community or subcommunity by doing one of the following:

        • Use a browser, open the community or subcommunity that you want and copy the UUID from the URL.

        • Run the CommunitiesService.fetchAllComm() wsadmin command to fetch all communities and subcommunities on the server. Copy the UUID from the output.

      CommunitiesService.addMembersToCommunityByMemberUuid(String communityName, Integer memberRole, List UUID of member)

        Adds members to an existing community or subcommunity. Use this command when you want to add users to a community's membership list, but they don't have an email address. The users that you are adding must belong to the parent community in order for them to be added to the subcommunity.

        Note: The member's UUID is the external LDAP identifier for a specific user. Use one of the following commands to return the user's external ID for use in the command above:

        • CommunitiesMemberService.getMemberExtIdByEmail("email")

        • CommunitiesMemberService.getMemberExtIdByLogin("login")

        You use this command in two steps. First, create a comma-separated list of users (using their UUID, the external LDAP ID) that you want to add to an existing community or subcommunity and assign this list to a variable. This variable is then used as input into the addMembersToCommunity command.

        Note that communityName is a string and must be enclosed in quotation marks ("). This parameter is case-sensitive, so be sure to specify the name of the community or subcommunity exactly.

        memberRole: Valid settings are 0 (member) or 1 (owner). Do not enclose this setting in quotation marks.

        For example:

        wsadmin>onemember= ["84b4897d-b4f8-4d95-9621-50bcaa2fd3ca"]
        wsadmin>CommunitiesService.addMembersToCommunityByMemberUuid("Ski Club Community",0,onemember)

        Note: When you use this command, if you get an error telling you that the community or subcommunity name is not unique, instead of entering the name of the community or subcommunity in the command input, enter the UUID instead.

        You can obtain the UUID for a community or subcommunity by doing one of the following:

        • Use a browser, open the community or subcommunity that you want and copy the UUID from the URL.

        • Run the CommunitiesService.fetchAllComm() wsadmin command to fetch all communities and subcommunities on the server. Copy the UUID from the output.


Parent topic

Manage membership in Communities


Related tasks


Create and populating communities
Add an alternate owner to communities


   

 

});