Use the update(DataObject) method and GroupMemberControl to remove one or more entities from one or more groups.
This example shows how to unassign or remove SalesPerson1 and SalesPerson2 from the Managers group.
To remove SalesPerson1 and SalesPerson2 from the Managers group, add this sample code to you application code and replace the variables with the actual values that you want to use for this request:
DataObject root = SDOHelper.createRootDataObject();
DataObject entity = SDOHelper.createEntityDataObject(root, null, DO_GROUP);
entity.createDataObject(DO_IDENTIFIER).set(PROP_UNIQUE_NAME,
"cn=Managers,cn=groups,dc=yourco,dc=com");
DataObject member1 = SDOHelper.createDataObject(WIM_NS_URI, DO_ENTITY);
member1.createDataObject(DO_IDENTIFIER).setString(PROP_UNIQUE_NAME,
"uid=SalesPerson1,ou=CA,o=Sales,cn=users,dc=yourco,dc=com");
DataObject member2 = SDOHelper.createDataObject(WIM_NS_URI, DO_ENTITY);
member2.createDataObject(DO_IDENTIFIER).setString(PROP_UNIQUE_NAME,
"uid=SalesPerson2,ou=CA,o=Sales,cn=users,dc=yourco,dc=com");
entity.getList(DO_MEMBERS).add(member1);
entity.getList(DO_MEMBERS).add(member2);
DataObject grpMbrCtrl = SDOHelper.createControlDataObject(root, null, DO_GROUP_MEMBER_CONTROL);
// Unassign mode
grpMbrCtrl.setInt(PROP_MODIFY_MODE, VALUE_MODIFY_MODE_UNASSIGN);
root = service.update(root);
<?xml version="1.0" encoding="UTF-8"?>
<sdo:datagraph xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sdo="commonj.sdo"
xmlns:wim="http://www.ibm.com/websphere/wim">
<wim:Root>
<wim:entities>
<wim:identifier uniqueName="uid=SalesPerson1,ou=CA,o=Sales,cn=users,dc=yourco,dc=com"/>
<wim:groups>
<wim:identifier uniqueId="73dc5d64-be44-4db0-9697-9a69056eb699"/>
</wim:groups>
<wim:groups>
<wim:identifier uniqueName="cn=Managers,cn=groups,dc=yourco,dc=com"/>
</wim:groups>
</wim:entities>
<wim:controls xsi:type="wim:GroupMembershipControl" modifyMode="3"/>
</wim:Root>
</sdo:datagraph>
<?xml version="1.0" encoding="UTF-8"?>
<sdo:datagraph xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sdo="commonj.sdo"
xmlns:wim="http://www.ibm.com/websphere/wim">
<wim:Root>
<wim:entities xsi:type="wim:PersonAccount">
<wim:identifier externalId="e7db8c0e-d2b3-43fe-be14-1475125606f4"
externalName="uid=SalesPerson1,ou=CA,o=Sales,cn=users,dc=yourco,dc=com"
repositoryId="LDAP1"
uniqueId="e7db8c0e-d2b3-43fe-be14-1475125606f4"
uniqueName="uid=SalesPerson1,ou=CA,o=Sales,cn=users,dc=yourco,dc=com"/>
</wim:entities>
</wim:Root>
</sdo:datagraph>