Hi,
I am trying to auto map users to respective UMS groups using API. Rather dragging and droping users in groups we would like to do it using API.
Managed till below but need to find the way to map them to different user groups. Does anyone has the code snippet to do that or let me know if there is any better way to achieve this?
/**
*
*/
package UMS;
import java.rmi.RemoteException;
import org.apache.axis.AxisFault;
import org.xmlsoap.schemas.soap.encoding.ServiceInterfaceUserGroupBindingStub;
import org.xmlsoap.schemas.soap.encoding.ServiceInterfaceUserGroupPortTypeProxy;
public class ImportUsersAndGroups{
public static void main(String[] args) {
// TODO Auto-generated method stub
/*
* Using UserGroup stub get AllGroups, AllUsers
* Compare users in domain to organisation and
* if user doesn't exist then import user to organisation
*
*/
try {
ServiceInterfaceUserGroupPortTypeProxy siugStub = new ServiceInterfaceUserGroupPortTypeProxy("UMSSERVER URL");
/*
* Access token is session id and needs to generate every time
* we run this job
*/
//siugStub.getAllGroups("accessToken", "org");
String accessToken = siugStub.getAllGroups("accessToken", "org");
String[] allUsers = siugStub.getAllUsers("ccessToken, "orgaization", "clientele", "*");
//String[] importedUsers = siugStub.getImportedUsers("", "org", "clientele");
for(int i=0; i<allUsers.length;i++){
//String record = allUsers[i];
String record = allUsers[i];
if (record.equalsIgnoreCase("_name")){
String isImported = siugStub.isImportedUser(accessToken, "org", "clientele", allUsers[i+1]);
System.out.println(i+1+ " -->"+allUsers[i+1]+" isImported -->"+isImported);
}
/*if(!isImported.equalsIgnoreCase("true")){
siugStub.importUser("accessToken", "org", "clientele", "name");
}*/
}
} catch (AxisFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Thanks,
Kartheek