Remove a WLAN configuration from a user account

To remove a WLAN configuration from a user account, you can use the unassignWLANConfigurationFromUser() method.
Before you begin: Retrieve the following variables:
  • userID integer for the user account that you want to remove the WLAN configuration from
  • configName string for the name of the WLAN configuration
  1. Specify the attributes to load with the user account that you want to remove the WLAN configuration from. To load the WLAN configurations of the user account, you must specify the loadUserWLANVPNVOIPConfigurations attribute as true.
    boolean loadUserServiceAttributes = false;
    boolean loadUserDeviceConfigurationServiceAttributes = false;
    boolean loadUserResolvedGroups = false;
    boolean loadUserResolvedGroupIds = false;
    boolean loadUserGroups = false;
    boolean loadUserWLANVPNVOIPConfigurations = true;
  2. Retrieve the user account object.
    GetUserResult result = coreWebService.getUser(userId, locale, loadUserServiceAttributes, loadUserDeviceConfigurationServiceAttributes, loadUserResolvedGroups, loadUserResolvedGroupIds, loadUserGroups, loadUserWLANVPNVOIPConfigurations);
  3. Check the result for errors and handle any errors.
    if (result.getGetUserReturnStatus().getCode() != GetUserReturnStatusEnumType.SUCCESS) 
    {
          // handle any errors
    }
  4. Retrieve the user account object.
    User user=result.getUser();
  5. Search the result for the WLAN configuration you want to remove from the user account.
    for (ITPolicyWLANVPNVOIPAttributes itr:user.getITPolicyWLANVPNVOIPAttributes()) 
    {
           for (WLANConfigurations itr2:itr.getWLANConfigurations()) {
               if(itr2.getPolicyName().equalsIgnoreCase(configName))
               {
  6. Retrieve the WLAN Configuration ID and invoke unassignWLANConfigurationFromUser().
                        int wlanConfigId=itr2.getWLANBaseConfigSetsId();
                        UnassignWLANConfigurationFromUserResult wlanResult= coreWebService.unassignWLANConfigurationFromUser(wlanConfigId, userId);
  7. Check the result for errors, and handle any errors.
                         if (wlanResult.getUnassignWLANConfigurationFromUserReturnStatus().getCode() != UnassignWLANConfigurationFromUserReturnStatusEnumType.SUCCESS) 
                        {
                               // handle any errors
                        }
                        break;
                   }
               }
           }
    }

Was this information helpful? Send us your comments.