Change or view a user account's information

You can retrieve a user account using the getUser() method and change or view the attributes of the user account object. The following code sample changes the user account's display name and retrieves the WLAN configuration for the user account, if a WLAN configuration is assigned.
Before you begin: Retrieve the following variables:
  • userID integer for the ID of the user account that you want to access
  • newDisplayName string for the value you want to change the user account's display name to
  1. Specify the getUser() parameters, including whether to load each of the classes that the user acccount's information is stored in. The following code sample uses the displayName attribute in the UserServiceAttributes class and the policyName attribute in the UserWLANVPNVOIPConfigurations class so it loads only those two classes.
    String wlanConfig;
    boolean loadUserServiceAttributes = true;
    boolean loadUserDeviceConfigurationServiceAttributes = false;
    boolean loadUserResolvedGroups = false;
    boolean loadUserResolvedGroupIds = false;
    boolean loadUserGroups = false;
    boolean loadUserWLANVPNVOIPConfigurations = true;
  2. Invoke getUser() to retrieve the user account object.
    GetUserResult result = coreWebService.getUser(
         userId, locale, loadUserServiceAttributes, 
         loadUserResolvedGroups, loadUserResolvedGroupIds, 
         loadUserGroups, loadUserWLANVPNVOIPConfigurations);
  3. Check the result for errors and handle any errors.
    if (result.getGetUserReturnStatus().getCode() != GetUserReturnStatusEnumType.SUCCESS)
           // handle any errors
  4. Change the display name and check for any errors.
    User user = result.getUser();
    SetUserResult setUserResult = coreWebService.setUser(user, locale);
    if (setUserResult.getSetUserReturnStatus().getCode() != SetUserReturnStatusEnumType.SUCCESS) 
           // handle any errors
  5. Retrieve the WLAN configurations that are assigned to this user account.
    for (ITPolicyWLANVPNVOIPAttributes itr:user.getITPolicyWLANVPNVOIPAttributes()) 
           for (WLANConfigurations itr2:itr.getWLANConfigurations()) 
                   wlanConfig = itr2.getPolicyName());
                   // do something with policyName here. 
Previous topic: Delete user accounts

Was this information helpful? Send us your comments.