Open topic with navigation

# SynchronizeGroups

As described in Groups, it is sometimes necessary for a connector to provide group membership information to a group server.

OmniGroupServer might be configured to store group information from a repository with the following settings:

    [MyRepository]
    GroupServerJobType=Connector
    ConnectorHost=localhost
    ConnectorPort=1234
    ConnectorTask=MyFetchTask

When OmniGroupServer needs to get the latest group membership information for the “MyRepository” repository, it sends a `SynchronizeGroups` fetch action to the connector listening at `localhost:1234`.

Before you implement the `SynchronizeGroups` action, enable the action by updating the `features()` function on the connector so that it returns `Features::synchronize_groups`:

           Features::feature_type MyConnector::features()
           {
               return ... | Features::synchronize_groups;
           }

To implement the `SynchronizeGroups` fetch action, a connector implementation must override the `s` `ynchronizeGroups` method in `ConnectorBase`, as illustrated in this sample code:

           void MyConnector::synchronizeGroups(const SynchronizeGroupsTask& task)
           {
               GroupServer gs = task.groupServer();
               gs.addUserMemberOf("Samantha", "Editors");
               gs.addUserMemberOf("George", "Editors");
               gs.addUserMemberOf("Samantha", "Viewers");
               gs.addUserMemberOf("Henry", "Viewers");
               gs.finish();
           }

The `SynchronizeGroupsTask` passed in to the `s` `ynchronizeGroups` method has a `GroupServer` member that allows you to send membership information to the Group Server. In this example the user “Samantha” is a member of the “Editors” group and the “Viewers” group, “George” is a member of the “Editors” group only, and “Henry” is a member of the “Viewers” group only. This information completely replaces any information previously present in the group server `[MyRepository]` repository.

If you want to modify the information that is stored by the group server, use the method `setIncrementalMode` before making any other commands.

           void MyConnector::synchronizeGroups(const SynchronizeGroupsTask& task)
           {
               GroupServer gs = task.groupServer();
               gs.setIncrementalMode();
               gs.addUserMemberOf("Robert", "Viewers");
               gs.finish();
           }

When the connector has updated the group server with all of the group membership information from the repository, the `SynchronizeGroups` task is complete.

© 2018 Micro Focus or one of its affiliates | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm