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
  1. Invoke findVPNConfigurations() to retrieve all VPN configurations.
    boolean includePolicyItems=true;
    FindVPNConfigurationsResult VPNConfigurationsResult = coreWebService.findVPNConfigurations(locale, includePolicyItems);
  2. Check the result for errors and handle any errors.
    if (VPNConfigurationsResult.getFindVPNConfigurationsReturnStatus().getCode()!= FindVPNConfigurationsReturnStatusEnumType.SUCCESS) 
    {
           // handle any errors
    }
  3. 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))
               {
  4. Retrieve the VPN configuration ID.
                    int VPNConfigId=VPNConfigurationsResult.getITPolicies().get(0).getPolicyId();
  5. Invoke assignVPNConfigurationToUser().
                     AssignVPNConfigurationToUserResult result= coreWebService.assignVPNConfigurationToUser(VPNConfigId, userId);
                    
  6. 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.