+

Search Tips   |   Advanced Search

Create and populate communities using wsadmin

The administrative commands for creating communities do not require a server restart to take effect, and no file checkout is necessary.

Use wsadmin to create a community and populate it with a set of members based on user login name or email address.

The communities created s allow public access. However, community owners can edit the communities from the Communities user interface after they are created and change the access level to moderated or restricted as needed.

To create and populate a new community.

  1. Start the Communities Jython script interpreter.

  2. Create a community and populate it with a set of members:

    CommunitiesService.createCommunityWithEmail(String community name, String ownerName, int memberRole, String dsmlFile)

    Create a public community whose membership list is initialized from a Directory Services Markup Language (DSML) file exported from the LDAP directory. The DSML file must be local to the system running the script. The script parses the DSML file and extracts the mail values. These values are used to populate the membership list of the community. For more information about how to create DSML files from the LDAP directory, see http://www.dsmltools.org/.

    A typical mail attribute in a DSML file looks like the following:

    <attr 
     name="mail">
     <value>john_doe@myco.com</value>
    </attr>

    The command takes the following parameters:

    communityName

    Name of the community that we are creating.

    ownerName

    Name of the new community's owner. Enter the email address of the user who will be the owner of the community.

    memberRole

    An integer that specifies the role of the users added to the new community. This property can be set to 0 to specify the member role or 1 to specify the owner role. Do not enclose this setting in quotation marks.

    dsmlFile

    A string value that specifies that name of the DSML file containing the mail values used to populate the community membership.

    In the following example, a community named AJ's Community is created with Ann Jones as the community owner/creator. The command parses the file /opt/myDSML.xml, looks for each of the mail attributes, and adds those email addresses to the new community with member access.

      CommunitiesService.createCommunityWithEmail("AJ's Community", "ann_jones@myco.com", 0, "/opt/myDSML.xml")

    • This command only creates parent communities; it cannot be used to create subcommunities.

    • This command creates a public community by default. To change the visibility of the community, the community owner must edit the community from the user interface and change the access level to moderated or restricted as needed.

    CommunitiesService.createCommunityWithLoginName(String communityName, String ownerName, int memberRole, String dsmlFile)

    Create a public community whose membership list is initialized from a DSML file exported from the LDAP directory. The DSML file must be local to the system running the script. The script parses the DSML XML file and extracts the login name values. These values are used to populate the membership list of the community. For more information about how to create DSML files from the LDAP directory, see http://www.dsmltools.org/.

    The command takes the following parameters:

    communityName

    Name of the community that we are creating.

    ownerName

    Name of the new community's owner. Enter the loginName of the user who will be the owner of the community.

    memberRole

    An integer that specifies the role of the users added to the new community. This property can be set to 0 to specify the member role or 1 to specify the owner role. Do not enclose this setting in quotation marks.

    dsmlFile

    Name of the DSML file containing the loginName values used to populate the community membership.

    In the following example, a community named AJ's Community is created with Ann Jones as the community owner/creator. The command parses the file /opt/myDSML.xml, and looks for each of the login attributes and adds those login names to the new community with member access.

      CommunitiesService.createCommunityWithLoginName("AJ's Community", "ann_jones", 0, "/opt/myDSML.xml")

    • This command only creates parent communities; it cannot be used to create subcommunities.

    • This command creates a public community by default. To change the visibility of the community, the community owner must edit the community from the user interface and change the access level to moderated or restricted as needed.


Parent topic:
Administer Communities


Related:

Add owners and members to a community