All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.access.Permission

java.lang.Object
   |
   +----com.ibm.as400.access.Permission

public class Permission
extends Object
implements Cloneable, Serializable
The Permission class is provided to retrieve user's authority to an object.
To improve performance, the Permission object caches authority changes until the commit() method is called. When commit()is called, all changes up to that point are sent to the AS/400.
The permission of an object is a collection of many users' authority to that object, and the UserPermission class is used to represent a user's authority to a object. Because there are three kinds of object in the AS/400, three subclasses of UserPermission are defined: Here is a simple example:

 AS400 as400 = new AS400();
 Permission permission = new Permission(as400,"/QSYS.LIB/QJAVA.LIB");
 permission.addAuthorizedUser("user1");
 QSYSPermission userPermission = permission.getUserPermission("user1");
 userPermission.setObjectAuthority("*CHANGE");
 permission.commit();
 

See Also:
UserPermission, DLOPermission, QSYSPermission, RootPermission

Variable Index

 o TYPE_DLO
Constant indicating the object is a Document Library Objects (DLO) stored in QDLS.
 o TYPE_QSYS
Constant indicating the object is contained in the AS/400 library structure and stored in QSYS.LIB.
 o TYPE_ROOT
Constant indicating that the object is contained in the root directory structure.

Constructor Index

 o Permission(AS400, String)
Constructs a Permission object.
 o Permission(IFSFile)
Constructs a Permission object.

Method Index

 o addAuthorizedUser(String)
Adds an authorized user.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a property change listener.
 o addUserPermission(UserPermission)
Adds a user permission.
 o commit()
Commits the permission changes to the AS/400 system.
 o getAuthorizationList()
Returns the authorizations list of the object.
 o getAuthorizedUsers()
Returns an enumeration of authorized users.
 o getName()
Returns the name of the object whose permission is represented by this object.
 o getObjectPath()
Returns the path of the integrated file system object whose permission is represented by this object.
 o getOwner()
Returns the object owner.
 o getPrimaryGroup()
Returns the primary group of the object.
 o getSensitivityLevel()
Returns the sensitivity level of the object.
 o getSystem()
Returns the AS/400 system
 o getType()
Returns the object type.
 o getUserPermission(String)
Returns the specific Permission object.
 o getUserPermissions()
Returns an enumeration of Permission object.
 o isCommitted()
Returns a flag indicating whether the change has been committed.
 o removeAuthorizedUser(String)
Removes an authorized user.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a property change listener.
 o removeUserPermission(UserPermission)
Removes a user permission.
 o setAuthorizationList(String)
Sets the authorizations list of the object.
 o setSensitivityLevel(int)
Sets the sensitivity level of the object.
 o setSystem(AS400)
Sets the system where system value is retrieved.

Variables

 o TYPE_DLO
 public static final int TYPE_DLO
Constant indicating the object is a Document Library Objects (DLO) stored in QDLS.

 o TYPE_QSYS
 public static final int TYPE_QSYS
Constant indicating the object is contained in the AS/400 library structure and stored in QSYS.LIB.

 o TYPE_ROOT
 public static final int TYPE_ROOT
Constant indicating that the object is contained in the root directory structure. This includes everything that is not in QSYS.LIB or QDLS.

Constructors

 o Permission
 public Permission(IFSFile file) throws AS400Exception, AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, UnsupportedEncodingException
Constructs a Permission object.

Parameters:
file - The IFSFile object. For example, The IFSFile object which represents the object "QSYS.LIB/FRED.LIB".
Throws: AS400Exception
If the AS/400 system returns an error message.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ErrorCompletingRequestException
If an error occurs before the request is completed.
Throws: InterruptedException
If this thread is interrupted.
Throws: IOException
If an error occurs while communicationg with the AS/400.
Throws: ObjectDoesNotExistException
If the AS/400 object does not exist.
 o Permission
 public Permission(AS400 as400,
                   String fileName) throws AS400Exception, AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, UnsupportedEncodingException
Constructs a Permission object.

Parameters:
system - The AS/400 system.
fileName - The full path of the object. For example, "/QSYS.LIB/FRED.LIB".
Throws: AS400Exception
If the AS/400 system returns an error message.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ErrorCompletingRequestException
If an error occurs before the request is completed.
Throws: InterruptedException
If this thread is interrupted.
Throws: IOException
If an error occurs while communicationg with the AS/400.
Throws: ObjectDoesNotExistException
If the AS/400 object does not exist.

Methods

 o addAuthorizedUser
 public void addAuthorizedUser(String userProfileName)
Adds an authorized user. The user added will have "*EXCLUDE" authorities on the object.

 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener.

Parameters:
listener - The property change listener to add.
 o addUserPermission
 public void addUserPermission(UserPermission userPermission)
Adds a user permission.

Parameters:
userPermission - The UserPermission object.
 o commit
 public synchronized void commit() throws AS400Exception, AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException
Commits the permission changes to the AS/400 system.

Throws: AS400Exception
If the AS/400 system returns an error message.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ErrorCompletingRequestException
If an error occurs before the request is completed.
Throws: InterruptedException
If this thread is interrupted.
Throws: IOException
If an error occurs while communicationg with the AS/400.
Throws: ObjectDoesNotExistException
If the AS/400 object does not exist.
Throws: ServerStartupException
If the AS/400 server cannot be started.
 o getAuthorizationList
 public String getAuthorizationList()
Returns the authorizations list of the object.

Returns:
The authorizations list of the object.
See Also:
setAuthorizationList
 o getAuthorizedUsers
 public Enumeration getAuthorizedUsers()
Returns an enumeration of authorized users.

Returns:
An enumeration of authorized users.
 o getObjectPath
 public String getObjectPath()
Returns the path of the integrated file system object whose permission is represented by this object.

Returns:
The integrated file system path name.
 o getName
 public String getName()
Returns the name of the object whose permission is represented by this object.

Returns:
The name of the object.
 o getOwner
 public String getOwner()
Returns the object owner.

Returns:
The object owner.
 o getPrimaryGroup
 public String getPrimaryGroup()
Returns the primary group of the object.

Returns:
The primary group of the object.
 o getSensitivityLevel
 public int getSensitivityLevel()
Returns the sensitivity level of the object.

Returns:
The sensitivity level of the object.
  • 0 : This value does not apply to this object.
  • 1 : (*NONE) The document has no sensitivity restrictions.
  • 2 : (*PERSONAL) The document is intended for the user as an individual.
  • 3 : (*PRIVATE) The document contains information that should be accessed only by the owner. This value cannot be specified if the access code zero (0) is assigned to the object.
  • 4 : (*CONFIDENTIAL) The document contains information that should be handled according to company procedures.
See Also:
setSensitivityLevel
 o getSystem
 public AS400 getSystem()
Returns the AS/400 system

Returns:
The AS/400 system instance.
 o getType
 public int getType()
Returns the object type.

Returns:
The object type. The possible values are:
  • TYPE_DLO - Indicating the object is a Document Library Objects (DLO) stored in QDLS.
  • TYPE_QSYS - Indicating the object is contained in the AS/400 library structure and stored in QSYS.LIB.
  • TYPE_ROOT - Indicating the object is contained in the root directory structure. This includes everything that is not in QSYS.LIB or QDLS.
 o getUserPermission
 public UserPermission getUserPermission(String userProfileName)
Returns the specific Permission object.

Returns:
The specific Permission object.
 o getUserPermissions
 public Enumeration getUserPermissions()
Returns an enumeration of Permission object.

Returns:
An enumeration of Permission object.
 o isCommitted
 public boolean isCommitted()
Returns a flag indicating whether the change has been committed.

Returns:
The flag indicating whether the change has been committed.
 o removeAuthorizedUser
 public void removeAuthorizedUser(String userProfileName)
Removes an authorized user.

 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.

Parameters:
listener - The property change listener to remove.
 o removeUserPermission
 public void removeUserPermission(UserPermission permission)
Removes a user permission.

 o setAuthorizationList
 public synchronized void setAuthorizationList(String autList)
Sets the authorizations list of the object. For example:

 Permission permisson = new Permisson(new AS400(),"/QSYS.LIB/FRED.LIB";
 permission.setAuthorizatinList("testautl");
 System.out.println("The authorization list of fred.lib is " + permissin.geAuthorizationList();
 permission.setAuthorizatinList("*NONE");
 System.out.println("The authorization list of fred.lib is " + permissin.geAuthorizationList();
 

Parameters:
authorizationList - The authorizations list of the object.
 o setSensitivityLevel
 public synchronized void setSensitivityLevel(int sensitivityLevel)
Sets the sensitivity level of the object.

Parameters:
sensitivityLevel - The sensitivity level of the object.The possible values :
  • 0 : This value does not apply to this object.
  • 1 : (*NONE) The document has no sensitivity restrictions.
  • 2 : (*PERSONAL) The document is intended for the user as an individual.
  • 3 : (*PRIVATE) The document contains information that should be accessed only by the owner. This value cannot be specified if the access code zero (0) is assigned to the object.
  • 4 : (*CONFIDENTIAL) The document contains information that should be handled according to company procedures.
See Also:
getSensitivityLevel
 o setSystem
 public synchronized void setSystem(AS400 system)
Sets the system where system value is retrieved.

Parameters:
system - The AS/400 system object.
See Also:
getSystem

All Packages  Class Hierarchy  This Package  Previous  Next  Index