RootPermission is a subclass of the UserPermission class. The RootPermission class allows you to display and set the permissions for the user of an object contained in the root directory structure.
An object on the root directory structure can set the data authority or the object authority. You can set the data authority to the values listed in the following table. Use the getDataAuthority() method to to display the current values and the setDataAuthority() method to set the data authority.
The following table lists and describes the valid data authority values:
Data authority value | Description |
---|---|
*none | The user has no authority to the object. |
*RWX | The user has read, add, update, delete, and execute authorities. |
*RW | The user has read, add, and delete authorities. |
*RX | The user has read and execute authorities. |
*WX | The user has add, update, delete, and execute authorities. |
*R | The user has read authority. |
*W | The user has add, update, and delete authorities. |
*X | The user has execute authority. |
*EXCLUDE | The user cannot access the object. |
*AUTL | The public authorities on this object come from the authorization list. |
The object authority can be set to one or more of the following values: alter, existence, management, or reference. You can use the setAlter(), setExistence(), setManagement(), or setReference() methods to set the values on or off.
After setting either the data authority or the object authority of an object, it is important that you use the commit() method from the Permissions class to send the changes to the server.
For more information about the different authorities, see Chapter 5: Resource Security in the iSeries™ Security Reference .
Example
This example shows you how to retrieve and print the permissions for a root object.
// Create a system object. AS400 sys = new AS400("MYAS400", "USERID", "PASSWORD"); // Represent the permissions to an object in the root file system. Permission objectInRoot = new Permission(sys, "/fred"); // Print the object pathname and retrieve its permissions. System.out.println("Permissions on "+objectInRoot.getObjectPath()+" are as follows:"); Enumeration enum = objectInRoot.getUserPermissions(); while (enum.hasMoreElements()) { // For each of the permissions, print out the user profile name // and that user's authorities to the object. RootPermission rootPerm = (RootPermission)enum.nextElement(); System.out.println(rootPerm.getUserID()+": "+rootPerm.getDataAuthority()); }