src.com.ibm.as400.access.RootPermission Maven / Gradle / Ivy
Show all versions of jt400-jdk8 Show documentation
///////////////////////////////////////////////////////////////////////////////
//
// JTOpen (IBM Toolbox for Java - OSS version)
//
// Filename: RootPermission.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 1997-2000 International Business Machines Corporation and
// others. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////
package com.ibm.as400.access;
/**
The RootPermission class represents the permissions for the specified 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. The data authority can be set to one of the following values: *none, *RWX,
*RW, *RX, *WX, *R, *W, *X, *EXCLUDE, or *AUTL. Use getDataAuthority() to display
the current values and the setDataAuthority() to set the data authority to one of
the valid values. Use commit() from the Permission class to send the changes
to the system.
The object authority can be set to one or more of the following values:
alter, existence, management, or reference. Use the appropriate
set methods (setAlter(), setExistence(), setManagement(),
or setReference()) to turn the value on or off. After all the values
are set, use the commit() method from the Permissions class to send the changes
to the system.
**/
public class RootPermission extends UserPermission
{
static final long serialVersionUID = 4L;
/**
* Constructs a RootPermission object. This is the permission of the specified user.
* @param userProfileName The name of the user profile.
*
**/
public RootPermission(String userProfileName)
{
super(userProfileName);
return;
}
/**
* Returns the data authority of the user.
* @return The data authority of the user. The possible values are:
- *RWX The user has object
operational, read, add, update, delete, and execute authorities to the
object.
- *RW The user has object operational, read, add, delete authorities to the object.
- *RX
The user has object operational, read, and execute authorities to the object.
- *WX The
user has object operational, add, update, delete, and execute authorities
to the object.
- *R
The user has object operational and read authorities to the object.
- *W
The user has object operational, add, update, delete authorities to the
object.
- *X
The user has object operational and execute authorities to the object.
- *EXCLUDE The user cannot access the object.
- *AUTL The public authorities
to the object comes from the public authority on the authorization list
that secures the object. The value can be returned only if there an authorization
list that secures the object and the authorized user is *PUBLIC.
- *NONE The user has no authority to the object.
* @see #setDataAuthority(String)
*
**/
public String getDataAuthority()
{
return dataAuthority_;
}
/**
* Indicates if the user has the object authority of alter.
* @return true if the user has the object authority of alter;
* false otherwise.
*
**/
public boolean isAlter()
{
return authorities_[OBJECT_ALTER];
}
/**
* Indicates if the user has the object authority of existence.
* @return true if the user has the object authority of existence;
* false otherwise.
**/
public boolean isExistence()
{
return authorities_[OBJECT_EXIST];
}
/**
* Indicates if the user has the object authority of management.
* @return true if the user has the object authority of management;
* false otherwise.
**/
public boolean isManagement()
{
return authorities_[OBJECT_MANAGEMENT];
}
/**
* Indicates if the user has the object authority of reference.
* @return true if the user has the object authority of reference;
* false otherwise.
*
**/
public boolean isReference()
{
return authorities_[OBJECT_REFERENCE];
}
/**
* Sets the alter object authority.
* @param authority true to set the object authority of alter on;
* false to set the object authority of alter off.
* @see #isAlter
*
**/
public synchronized void setAlter(boolean authority)
{
changeAuthority();
authorities_[OBJECT_ALTER] = authority;
if (dataAuthority_.equals("*EXCLUDE")&&authority==true)
dataAuthority_ = "*NONE";
return;
}
/**
* Sets the data authority of the user.
* @param authority The data authority of the user.
Valid values are:
- *RWX The user has object
operational, read, add, update, delete, and execute authorities to the
object.
- *RW The user has object operational, read, add, delete authorities to the object.
- *RX
The user has object operational, read, and execute authorities to the object.
- *WX The
user has object operational, add, update, delete, and execute authorities
to the object.
- *R
The user has object operational and read authorities to the object.
- *W
The user has object operational, add, update, delete authorities to the
object.
- *X
The user has object operational and execute authorities to the object.
- *EXCLUDE The user cannot access the object.
- *AUTL The public authorities
to the object comes from the public authority on the authorization list
that secures the object. The value can be returned only if there an authorization
list that secures the object and the authorized user is *PUBLIC.
- *NONE The user has no authority to the object.
**/
public synchronized void setDataAuthority(String authority)
{
if (authority == null)
throw new NullPointerException("authority");
changeAuthority();
dataAuthority_ = authority.toUpperCase().trim();
if (dataAuthority_.equals("*EXCLUDE"))
{
authorities_[OBJECT_ALTER] = false;
authorities_[OBJECT_EXIST] = false;
authorities_[OBJECT_MANAGEMENT] = false;
authorities_[OBJECT_REFERENCE] = false;
}
if(dataAuthority_.equals("*AUTL")) // @1JU - if *AUTL, then setFromAuthorizationList
setFromAuthorizationList(true); // @1JU
return;
}
/**
* Sets the existence object authority.
* @param authority true to set the object authority of existence on;
* false to set the object authority of existence off.
* @see #isExistence
**/
public synchronized void setExistence(boolean authority)
{
changeAuthority();
authorities_[OBJECT_EXIST] = authority;
if (dataAuthority_.equals("*EXCLUDE")&&authority==true)
dataAuthority_ = "*NONE";
return;
}
/**
* Sets the management object authority.
* @param authority true to set the object authority of management on;
* false to set the object authority of management off.
* @see #isManagement
**/
public synchronized void setManagement(boolean authority)
{
changeAuthority();
authorities_[OBJECT_MANAGEMENT] = authority;
if (dataAuthority_.equals("*EXCLUDE")&&authority==true)
dataAuthority_ = "*NONE";
return;
}
/**
* Sets the reference object authority.
* @param authority true to set the object authority of reference on;
* false to set the object authority of reference off.
* @see #isReference
*
**/
public synchronized void setReference(boolean authority)
{
changeAuthority();
authorities_[OBJECT_REFERENCE] = authority;
if (dataAuthority_.equals("*EXCLUDE")&&authority==true)
dataAuthority_ = "*NONE";
return;
}
}