95 lines
6.1 KiB
HTML
95 lines
6.1 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="reference" />
|
||
|
<meta name="DC.Title" content="Users and groups" />
|
||
|
<meta name="abstract" content="" />
|
||
|
<meta name="description" content="" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="usrgrp" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Users and groups</title>
|
||
|
</head>
|
||
|
<body id="usrgrp"><a name="usrgrp"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Users and groups</h1>
|
||
|
<div><p></p>
|
||
|
<div class="section"><p>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.</p>
|
||
|
</div>
|
||
|
<div class="section"><div class="note"><span class="notetitle">Note:</span> IBM<sup>®</sup> Toolbox
|
||
|
for Java also
|
||
|
provides <a href="resources.htm#resources">resource classes</a> that
|
||
|
present a generic framework and consistent programming interface for working
|
||
|
with various iSeries objects
|
||
|
and lists. After reading about the classes in the <a href="javadoc/com/ibm/as400/access/package-summary.html#NAVBAR_TOP">access package</a> and the <a href="javadoc/com/ibm/as400/resource/package-summary.html#NAVBAR_TOP">resource package</a>, you can choose the object that works
|
||
|
best for your application. The resource classes for working with users are <a href="javadoc/com/ibm/as400/resource/RUser.html#NAVBAR_TOP"> RUser</a> and <a href="javadoc/com/ibm/as400/resource/RUserList.html#NAVBAR_TOP"> RUserList</a>.</div>
|
||
|
</div>
|
||
|
<div class="section"><p>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 <a href="javadoc/com/ibm/as400/access/User.html">User</a> object, use the <a href="javadoc/com/ibm/as400/access/User.html#SETSYSTEM(COM.IBM.AS400.ACCESS.AS400)"> setSystem()</a> method to set the system name and the <a href="javadoc/com/ibm/as400/access/User.html#SETNAME(JAVA.LANG.STRING)"> setName()</a> method to set the user name. After those steps,
|
||
|
you use the <a href="javadoc/com/ibm/as400/access/User.html#LOADUSERINFORMATION()"> loadUserInformation()</a> method to get the information
|
||
|
from the iSeries.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>The <a href="javadoc/com/ibm/as400/access/UserGroup.html"> UserGroup</a> object represents a special user whose user
|
||
|
profile is a group profile. Using the <a href="javadoc/com/ibm/as400/access/UserGroup.html#GETMEMBERS()"> getMembers()</a> method, a list of users that are members
|
||
|
of the group can be returned.</p>
|
||
|
</div>
|
||
|
<div class="section"><p><span class="synph" id="usrgrp__usgex1"><a name="usrgrp__usgex1"><!-- --></a><span class="kwd"></span></span>The Java program
|
||
|
can iterate through the list using an enumeration. All elements in the enumeration
|
||
|
are <a href="javadoc/com/ibm/as400/access/User.html#NAVBAR_TOP">User</a> objects; for example:</p>
|
||
|
</div>
|
||
|
<div class="section"><div class="p"><pre> // 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);
|
||
|
}</pre>
|
||
|
<strong><span class="synph" id="usrgrp__userlist"><a name="usrgrp__userlist"><!-- --></a><span class="kwd"></span></span>Retrieving information
|
||
|
about users and groups</strong></div>
|
||
|
</div>
|
||
|
<div class="section"><p>You use a <a href="javadoc/com/ibm/as400/access/UserList.html#NAVBAR_TOP"> UserList</a> to get a list of the following:</p>
|
||
|
</div>
|
||
|
<div class="section"><ul><li><a href="javadoc/com/ibm/as400/access/UserList.html#ALL"> All</a> users and groups</li>
|
||
|
<li>Only <a href="javadoc/com/ibm/as400/access/UserList.html#GROUP">groups</a></li>
|
||
|
<li>All users who are <a href="javadoc/com/ibm/as400/access/UserList.html#MEMBER">members</a> of groups</li>
|
||
|
<li>All users who are <a href="javadoc/com/ibm/as400/access/UserList.html#USER">not members</a> of groups</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="section"><p>The only property of the UserList object that must be set is the <a href="javadoc/com/ibm/as400/access/AS400.html#NAVBAR_TOP">
|
||
|
AS400</a> object that represents the system from which the list of users
|
||
|
is to be retrieved.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>By default, all users are returned. Use a combination of <a href="javadoc/com/ibm/as400/access/UserList.html#SETUSERINFO(JAVA.LANG.STRING)"> setUserInfo()</a> and <a href="javadoc/com/ibm/as400/access/UserList.html#SETGROUPINFO(JAVA.LANG.STRING)"> setGroupInfo()</a> to specify exactly which users are returned.</p>
|
||
|
</div>
|
||
|
<div class="section"><p><strong><span class="synph" id="usrgrp__ugrpexample"><a name="usrgrp__ugrpexample"><!-- --></a><span class="kwd"></span></span>Example: <a href="userlistexample.htm#userlistexample">Using
|
||
|
a UserList to list all of the users in a given group.</a></strong></p>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</body>
|
||
|
</html>
|