135 lines
8.2 KiB
HTML
135 lines
8.2 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="Permission classes" />
|
|
<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="prmintro" />
|
|
<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>Permission classes</title>
|
|
</head>
|
|
<body id="prmintro"><a name="prmintro"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Permission classes</h1>
|
|
<div><p></p>
|
|
<div class="section"><p>The permission classes allow you to get and set object authority
|
|
information. Object authority information is also known as permission. The
|
|
Permission class represents a collection of many users' authority to a specific
|
|
object. The UserPermission class represents a single user's authority to a
|
|
specific object.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Permission class</h4><p>The <a href="javadoc/com/ibm/as400/access/Permission.html#NAVBAR_TOP">Permission</a> class allows you to retrieve and change object
|
|
authority information. It includes a collection of many users who are authorized
|
|
to the object. The Permission object allows the Java™ program to cache authority changes
|
|
until the commit() method is called. Once the commit() method is called, all
|
|
changes made up to that point are sent to the server. Some of the functions
|
|
provided by the Permission class include:</p>
|
|
<ul><li><a href="javadoc/com/ibm/as400/access/Permission.html#ADDAUTHORIZEDUSER(JAVA.LANG.STRING)">addAuthorizedUser()</a>: Adds an authorized user.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#COMMIT()">commit()</a>: Commits the permission changes to the server.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#GETAUTHORIZATIONLIST()">getAuthorizationList()</a>: Returns the authorization list
|
|
of the object.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#GETAUTHORIZEDUSERS()">getAuthorizedUsers()</a>: Returns an enumeration of authorized
|
|
users.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#GETOWNER()">getOwner()</a>: Returns the name of the object owner.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#GETSENSITIVITYLEVEL()">getSensitivityLevel()</a>: Returns the sensitivity level
|
|
of the object.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#GETTYPE()">getType()</a>: Returns the object authority type (QDLO, QSYS,
|
|
or Root).</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#GETUSERPERMISSION(JAVA.LANG.STRING)">getUserPermission()</a>: Returns the permission of a specific
|
|
user to the object.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#GETUSERPERMISSIONS()">getUserPermissions()</a>: Returns an enumeration of permissions
|
|
of the users to the object.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#SETAUTHORIZATIONLIST(JAVA.LANG.STRING)">setAuthorizationList()</a>: Sets the authorization list of
|
|
the object.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/Permission.html#SETSENSITIVITYLEVEL(INT)">setSensitivityLevel()</a>: Sets the sensitivity level of
|
|
the object.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section" id="prmintro__ex3"><a name="prmintro__ex3"><!-- --></a><div class="p"><strong>Example: Using Permission</strong><div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm#codedisclaimer">Code example disclaimer</a> for
|
|
important legal information.</div>
|
|
</div>
|
|
<p>The following example shows you
|
|
how to create a permission and add an authorized user to an object.</p>
|
|
<pre>
|
|
// Create AS400 object
|
|
AS400 as400 = new AS400();
|
|
|
|
// Create Permission passing in the AS400 and object
|
|
Permission myPermission = new Permission(as400, "QSYS.LIB/myLib.LIB");
|
|
|
|
// Add a user to be authorized to the object
|
|
myPermission.addAuthorizedUser("User1");
|
|
</pre>
|
|
</div>
|
|
<div class="section" id="prmintro__userpermission"><a name="prmintro__userpermission"><!-- --></a><h4 class="sectiontitle">UserPermission class</h4><p>The <a href="javadoc/com/ibm/as400/access/UserPermission.html"> UserPermission</a> class
|
|
represents the authority of a single, specific user. UserPermission has three
|
|
subclasses that handle the authority based on the object type:</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><thead align="left"><tr class="tablemainheaderbar"><th valign="top" width="50%" id="d0e97">UserPermission class</th>
|
|
<th valign="top" width="50%" id="d0e99">Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td valign="top" width="50%" headers="d0e97 "><a href="dloprmit.htm#dloprmit">DLOPermission</a></td>
|
|
<td valign="top" width="50%" headers="d0e99 ">Represents a user's authority to Document Library Objects (DLOs), which
|
|
are stored in QDLS.</td>
|
|
</tr>
|
|
<tr><td valign="top" width="50%" headers="d0e97 "><a href="qsysprmt.htm#qsysprmt">QSYSPermission</a></td>
|
|
<td valign="top" width="50%" headers="d0e99 ">Represents a user's authority to objects stored in QSYS.LIB and contained
|
|
in the server.</td>
|
|
</tr>
|
|
<tr><td valign="top" width="50%" headers="d0e97 "><a href="rootprmt.htm#rootprmt">RootPermission</a></td>
|
|
<td valign="top" width="50%" headers="d0e99 ">Represents a user's authority to objects contained in the root directory
|
|
structure. RootPermissions objects are those objects not contained in QSYS.LIB
|
|
or QDLS.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p>The UserPermission class allows you to do the following:</p>
|
|
<ul><li>Determine if the user profile is a <a href="javadoc/com/ibm/as400/access/UserPermission.html#GETGROUPINDICATOR()"> group profile</a></li>
|
|
<li>Return the <a href="javadoc/com/ibm/as400/access/UserPermission.html#GETUSERID()">user profile</a> name</li>
|
|
<li>Indicate whether the user <a href="javadoc/com/ibm/as400/access/UserPermission.html#ISAUTHORIZATIONLISTMANAGEMENT()"> has authority</a></li>
|
|
<li><a href="javadoc/com/ibm/as400/access/UserPermission.html#SETAUTHORIZATIONLISTMANAGEMENT(BOOLEAN)"> Set the authority</a> of authorization list management</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><div class="p"><strong>Example: Using UserPermission</strong><div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm#codedisclaimer">Code
|
|
example disclaimer</a> for important legal information.</div>
|
|
</div>
|
|
<p>The
|
|
following example shows you how to retrieve the users and groups that have
|
|
permission on an object and print them out one at a time.</p>
|
|
<pre> // Create a system object.
|
|
AS400 sys = new AS400("MYAS400", "USERID", "PASSWORD");
|
|
|
|
// Represent the permissions to an object on the system, such as a library.
|
|
Permission objectInQSYS = new Permission(sys, "/QSYS.LIB/FRED.LIB");
|
|
|
|
// Retrieve the various users/groups that have permissions set on that object.
|
|
Enumeration enum = objectInQSYS.getUserPermissions();
|
|
while (enum.hasMoreElements())
|
|
{
|
|
// Print out the user/group profile names one at a time.
|
|
UserPermission userPerm = (UserPermission)enum.nextElement();
|
|
System.out.println(userPerm.getUserID());
|
|
}</pre>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |