Assign a VPN configuration to a user account
To assign a VPN configuration to a user account, you can use the
assignVPNConfigurationToUser() method.
Before you begin: Retrieve the following variables:
- userID integer for the user account that you want to assign the VPN configuration to
-
configName string for the name of the VPN configuration
-
Invoke
findVPNConfigurations() to retrieve all VPN configurations.
boolean includePolicyItems=true;
FindVPNConfigurationsResult VPNConfigurationsResult = coreWebService.findVPNConfigurations(locale, includePolicyItems);
-
Check the result for errors and handle any errors.
if (VPNConfigurationsResult.getFindVPNConfigurationsReturnStatus().getCode()!= FindVPNConfigurationsReturnStatusEnumType.SUCCESS)
{
// handle any errors
}
- Search for the VPN configuration that you want to assign to the user account.
if (VPNConfigurationsResult.getITPolicies().size()> 0)
{
for (ITPolicy itr:VPNConfigurationsResult.getITPolicies())
{
if(itr.getPolicyName().equalsIgnoreCase(configName))
{
- Retrieve the VPN configuration ID.
int VPNConfigId=VPNConfigurationsResult.getITPolicies().get(0).getPolicyId();
- Invoke
assignVPNConfigurationToUser().
AssignVPNConfigurationToUserResult result= coreWebService.assignVPNConfigurationToUser(VPNConfigId, userId);
- Check the result for errors and handle any errors.
if (result.getAssignVPNConfigurationToUserReturnStatus().getCode() != AssignVPNConfigurationToUserReturnStatusEnumType.SUCCESS) {
{
//handle any errors
}
return;
}
}
}
Was this information helpful? Send us your comments.