The user and group classes allow you to get a list of users and user groups on the iSeries™ server as well as information about each user through a Java™ program.
Some of the user information you can retrieve includes previous sign-on date, status, date the password was last changed, date the password expires, and user class. When you access the User object, use the setSystem() method to set the system name and the setName() method to set the user name. After those steps, you use the loadUserInformation() method to get the information from the iSeries.
The UserGroup object represents a special user whose user profile is a group profile. Using the getMembers() method, a list of users that are members of the group can be returned.
The Java program can iterate through the list using an enumeration. All elements in the enumeration are User objects; for example:
// Create an AS400 object. AS400 system = new AS400 ("mySystem.myCompany.com"); // Create the UserList object. UserList userList = new UserList (system); // Get the list of all users and groups. Enumeration enum = userList.getUsers (); // Iterate through the list. while (enum.hasMoreElements ()) { User u = (User) enum.nextElement (); System.out.println (u); }Retrieving information about users and groups
You use a UserList to get a list of the following:
The only property of the UserList object that must be set is the AS400 object that represents the system from which the list of users is to be retrieved.
By default, all users are returned. Use a combination of setUserInfo() and setGroupInfo() to specify exactly which users are returned.