Java AFS Admin API v1.3

org.openafs.jafsadm
Class User

java.lang.Object
  |
  +--org.openafs.jafsadm.User
All Implemented Interfaces:
Comparable, PTSEntry, Serializable

public class User
extends Object
implements PTSEntry, Serializable, Comparable

An abstract representation of an AFS user. It holds information about the user, such as what groups it belongs to.

Constructing an instance of a User does not mean an actual AFS user is created in a cell -- usually a User object is a representation of an already existing AFS user. If, however, the User is constructed with the name of a user that does not exist in the cell represented by the provided Cell, a new user with that name can be created in that server by calling the create(String, int) or create(String) method. If such a user does already exist when one of these methods is called, an exception will be thrown.

Each User object has its own individual set of Groups that it owns and Groups for which it is a member. These represents the properties and attributes of an actual AFS user.

Since this User object is a union of both the PTS and KAS properties of AFS users, some methods meant for users with a PTS entry will throw exceptions if used on a user with only a KAS entry, and vice versa.

Associated with an AFS user are many attributes, such as whether or not it can change its own password, or who is allowed to find out the groups to which this user belongs. The User class has many "set" methods to indicate values for these attributes (i.e. setChangePassword(boolean) and setListMembership(int)). However, in order for these values to be written to the actual AFS user, the flushInfo() method needs to be called. This writes all user attributes set through this API to AFS. This is done to minimize calls through JNI.

The following is a simple example of how to construct and use a User object. It iterates through the list of users (a union of pts and kas users) for a cell, and prints out the name and id of each.

 import org.openafs.jafsadm.Cell;
 import org.openafs.jafsadm.AFSAdminException;
 import org.openafs.jafsadm.User;
 ...
 public class ...
 {
   ...
   private Cell cell;
   ...
   public static void main(String[] args) throws Exception
   {
     String username   = arg[0];
     String password   = arg[1];
     String cellName   = arg[2];
 
     cell   = new Cell(cellName, username, password);
     server = cell.getServer(serverName);
 
     System.out.println("Users in Cell " + cell.getName() + ":");
     User[] users = cell.getUsers();
     for (int i = 0; i < users.length; i++) {
       System.out.println(" -> " + users[i] + ": " users[i].getID());
     }
   }
   ...
 }
 

Version:
1.0, 2/15/02
See Also:
Serialized Form

Field Summary
static int ADMIN
          User has administrative kas privileges
static int CHANGE_PASSWORD
          User can change their password
static int ENCRYPT
          TGS can use user's key for an encryption key
static int GRANT_TICKETS
          TGS will grant tickets for user
static int NO_ADMIN
          User has no administrative kas privileges
static int NO_CHANGE_PASSWORD
          User cannot change their password
static int NO_ENCRYPT
          TGS cannot use user's key for an encryption key
static int NO_GRANT_TICKETS
          TGS will not grant tickets for user
static int NO_REUSE_PASSWORD
          User cannot reuse their password
static int REUSE_PASSWORD
          User can reuse their password
static int USER_ANYUSER_ACCESS
          Any user has access
static int USER_OWNER_ACCESS
          Only the owner of the user has access
 
Fields inherited from interface org.openafs.jafsadm.PTSEntry
PTS_GROUP, PTS_USER
 
Constructor Summary
User(String name, Cell cell)
          Constructs a new User object instance given the name of the AFS user and the AFS cell, represented by cell, to which it belongs.
User(String name, Cell cell, boolean preloadAllMembers)
          Constructs a new User object instance given the name of the AFS user and the AFS cell, represented by cell, to which it belongs.
 
Method Summary
 boolean canChangePassword()
          KAS: Returns whether or not the user can change their password
 boolean canEncrypt()
          KAS: Returns whether or not TGS can use this users ticket for an encryption key
 boolean canReusePassword()
          KAS: Returns whether or not the user can reuse their password
 int compareTo(Object obj)
          Comparable interface method.
 int compareTo(User user)
          Compares two User objects respective to their names and does not factor any other attribute.
 void create(String password)
          Creates the kas and pts entries for a new user in this cell.
 void create(String password, int uid)
          Creates the kas and pts entries for a new user in this cell.
 void delete()
          Deletes the pts and kas entries for a user in this cell.
 boolean equals(User otherUser)
          Tests whether two User objects are equal, based on their names.
 void flushInfo()
          Flushes the current information of this User object to disk.
 Cell getCell()
          Returns the Cell this user belongs to.
 PTSEntry getCreator()
          PTS: Returns the creator of this user in the form of a PTSEntry.
 int getDaysToPasswordExpire()
          KAS: Returns the number of days a password is valid before it expires.
 String getEncryptionKey()
          KAS: Returns the encryption key, in octal form, of this user.
 int getFailLoginCount()
          KAS: Returns the number of failed login attempts this user is allowed before being locked out.
 int getGroupCreationQuota()
          PTS: Returns how many more groups this user is allowed to create.
 int getGroupMembershipCount()
          PTS: Returns the number of groups to which this user belongs.
 String[] getGroupNames()
          PTS: Returns a String array of the group names to which this user belongs.
 Group[] getGroups()
          PTS: Returns an array of the Group objects to which this user belongs.
 Group[] getGroupsOwned()
          PTS: Returns an array of the Group objects this user owns.
 int getGroupsOwnedCount()
          PTS: Returns the total count of groups this user owns.
 String[] getGroupsOwnedNames()
          PTS: Returns a String array of the group names this user owns.
 long getKeyCheckSum()
          KAS: Returns the check sum of this user's key.
 int getKeyVersion()
          KAS: Returns the version number of the user's key.
 int getLastChangePasswordTime()
          KAS: Returns the last date and time (in UTC) the user changed its password.
 GregorianCalendar getLastChangePasswordTimeDate()
          KAS: Returns the last date and time the user changed its password.
 String getLastModName()
          KAS: Returns the name of the user that last modified this user.
 int getLastModTime()
          KAS: Returns the date and time (in UTC) the user's KAS entry was last modified.
 GregorianCalendar getLastModTimeDate()
          KAS: Returns the date and time the user was last modified.
 int getListGroupsOwned()
          PTS: Returns who can list the groups owned (pts listowned) by this user.
 int getListMembership()
          PTS: Returns who can list the groups (pts membership) to which this user belongs.
 int getListStatus()
          PTS: Returns who can list the status (pts examine) of this user.
 int getLockedUntil()
          KAS: Returns the date and time (in UTC) at which the user stops being locked out.
 GregorianCalendar getLockedUntilDate()
          KAS: Returns the date and time at which the user stops being locked out.
 int getLockTime()
          KAS: Returns the amount of time (in seconds) a user is locked out when it exceeds the maximum number of allowable failed login attempts.
 int getMaxTicketLifetime()
          KAS: Returns the maximum lifetime of a ticket issued to this user (in seconds).
 String getName()
          Returns the name of this user.
 PTSEntry getOwner()
          PTS: Returns the owner of this user in the form of a PTSEntry.
 short getType()
          Returns the type of PTSEntry this object represents.
 int getUID()
          PTS: Returns the numeric AFS id of this user.
 int getUserExpiration()
          KAS: Returns the date and time the user expires.
 GregorianCalendar getUserExpirationDate()
          KAS: Returns the date and time the user expires.
 boolean isAdmin()
          KAS: Returns whether or not this user has kas administrative privileges
 boolean isKAS()
          Returns whether or not this user has a kas entry.
 boolean isPTS()
          Returns whether or not this user has a pts entry.
 void refresh()
          Refreshes the properties of this User object instance with values from the AFS user it represents.
 void rename(String newName)
          Change the name of this user.
 void setAdmin(boolean setting)
          KAS: Sets whether or not this user has kas administrative privileges
 void setChangePassword(boolean setting)
          KAS: Sets whether or not the user can change their password
 void setDaysToPasswordExpire(int days)
          KAS: Sets the number of days a password is valid before it expires.
 void setEncrypt(boolean setting)
          KAS: Sets whether or not TGS can use this users ticket for an encryption key
 void setFailLoginCount(int logins)
          KAS: Sets the number of failed login attempts this user is allowed before being locked out.
 void setGrantTickets(boolean setting)
          KAS: Sets whether or not TGS will issue tickets for this user
 void setGroupCreationQuota(int quota)
          PTS: Sets how many more groups this user is allowed to create.
 void setListGroupsOwned(int value)
          PTS: Sets who can list the groups owned (pts listowned) by this user.
 void setListMembership(int value)
          PTS: Sets who can list the groups (pts membership) to which this user belongs.
 void setListStatus(int value)
          PTS: Sets who can list the status (pts examine) of this user.
 void setLockTime(int seconds)
          KAS: Sets the amount of time (in seconds) a user is locked out when it exceeds the maximum number of allowable failed login attempts.
 void setMaxTicketLifetime(int seconds)
          KAS: Sets the maximum lifetime of a ticket issued to this user (in seconds).
 void setPassword(String newPassword)
          Sets the password of this user to something new.
 void setReusePassword(boolean setting)
          KAS: Sets whether or not the user can reuse their password
 void setUserExpiration(GregorianCalendar expirationDate)
          KAS: Sets the date and time the user expires.
 String toString()
          Returns the name of this User
 void unlock()
          Unlocks the given user if they were locked out of the cell.
 boolean willGrantTickets()
          KAS: Returns whether or not TGS will issue tickets for this user
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

USER_OWNER_ACCESS

public static final int USER_OWNER_ACCESS
Only the owner of the user has access

USER_ANYUSER_ACCESS

public static final int USER_ANYUSER_ACCESS
Any user has access

ADMIN

public static final int ADMIN
User has administrative kas privileges

NO_ADMIN

public static final int NO_ADMIN
User has no administrative kas privileges

GRANT_TICKETS

public static final int GRANT_TICKETS
TGS will grant tickets for user

NO_GRANT_TICKETS

public static final int NO_GRANT_TICKETS
TGS will not grant tickets for user

ENCRYPT

public static final int ENCRYPT
TGS can use user's key for an encryption key

NO_ENCRYPT

public static final int NO_ENCRYPT
TGS cannot use user's key for an encryption key

CHANGE_PASSWORD

public static final int CHANGE_PASSWORD
User can change their password

NO_CHANGE_PASSWORD

public static final int NO_CHANGE_PASSWORD
User cannot change their password

REUSE_PASSWORD

public static final int REUSE_PASSWORD
User can reuse their password

NO_REUSE_PASSWORD

public static final int NO_REUSE_PASSWORD
User cannot reuse their password
Constructor Detail

User

public User(String name,
            Cell cell)
     throws AFSAdminException
Constructs a new User object instance given the name of the AFS user and the AFS cell, represented by cell, to which it belongs. This does not actually create a new AFS user, it just represents one. If name is not an actual AFS user, exceptions will be thrown during subsequent method invocations on this object, unless the create(String, int) or create(String) method is explicitly called to create it.
Parameters:
name - the name of the user to represent
cell - the cell to which the user belongs.
Throws:
AFSAdminException - If an error occurs in the native code

User

public User(String name,
            Cell cell,
            boolean preloadAllMembers)
     throws AFSAdminException
Constructs a new User object instance given the name of the AFS user and the AFS cell, represented by cell, to which it belongs. This does not actually create a new AFS user, it just represents one. If name is not an actual AFS user, exceptions will be thrown during subsequent method invocations on this object, unless the create(String, int) or create(String) method is explicitly called to create it. Note that if the process doesn't exist and preloadAllMembers is true, an exception will be thrown.

This constructor is ideal for point-in-time representation and transient applications. It ensures all data member values are set and available without calling back to the filesystem at the first request for them. Use the refresh() method to address any coherency concerns.

Parameters:
name - the name of the user to represent
cell - the cell to which the user belongs.
preloadAllMembers - true will ensure all object members are set upon construction; otherwise members will be set upon access, which is the default behavior.
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()
Method Detail

create

public void create(String password)
            throws AFSAdminException
Creates the kas and pts entries for a new user in this cell. Automatically assigns a user id. *
Parameters:
password - the password for the new user
Throws:
AFSAdminException - If an error occurs in the native code

create

public void create(String password,
                   int uid)
            throws AFSAdminException
Creates the kas and pts entries for a new user in this cell.
Parameters:
password - the password for the new user
uid - the user id to assign to the new user
Throws:
AFSAdminException - If an error occurs in the native code

delete

public void delete()
            throws AFSAdminException
Deletes the pts and kas entries for a user in this cell. Deletes this user from the membership list of the groups to which it belonged, but does not delete the groups owned by this user. Also nullifies this corresponding Java object.
Throws:
AFSAdminException - If an error occurs in the native code

unlock

public void unlock()
            throws AFSAdminException
Unlocks the given user if they were locked out of the cell.
Parameters:
userName - the name of the user to unlock
Throws:
AFSAdminException - If an error occurs in the native code

flushInfo

public void flushInfo()
               throws AFSAdminException
Flushes the current information of this User object to disk. This will update the information of the actual AFS user to match the settings that have been modified within this User object. This function must be called before any changes made to the information fields of this user will be seen by AFS.
Throws:
AFSAdminException - If an error occurs in the native code

rename

public void rename(String newName)
            throws AFSAdminException
Change the name of this user. Automatically flushes the info of this user in order to update kas entry of the new name. NOTE: renaming a locked user will unlock that user.
Parameters:
newName - the new name for this user
Throws:
AFSAdminException - If an error occurs in the native code

refresh

public void refresh()
             throws AFSAdminException
Refreshes the properties of this User object instance with values from the AFS user it represents. All properties that have been initialized and/or accessed will be renewed according to the values of the AFS user this User object instance represents.

Since in most environments administrative changes can be administered from an AFS command-line program or an alternate GUI application, this method provides a means to refresh the Java object representation and thereby ascertain any possible modifications that may have been made from such alternate administrative programs. Using this method before an associated instance accessor will ensure the highest level of representative accuracy, accommodating changes made external to the Java application space. If administrative changes to the underlying AFS system are only allowed via this API, then the use of this method is unnecessary.

Throws:
AFSAdminException - If an error occurs in the native code

getName

public String getName()
Returns the name of this user.
Specified by:
getName in interface PTSEntry
Returns:
the name of this user

getCell

public Cell getCell()
Returns the Cell this user belongs to.
Specified by:
getCell in interface PTSEntry
Returns:
the Cell this user belongs to

isKAS

public boolean isKAS()
              throws AFSAdminException
Returns whether or not this user has a kas entry.
Returns:
whether or not this user has a kas entry
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

isPTS

public boolean isPTS()
              throws AFSAdminException
Returns whether or not this user has a pts entry.
Returns:
whether or not this user has a pts entry
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getGroups

public Group[] getGroups()
                  throws AFSAdminException
PTS: Returns an array of the Group objects to which this user belongs.
Returns:
an array of the groups to which this user belongs
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getGroupsOwnedCount

public int getGroupsOwnedCount()
                        throws AFSAdminException
PTS: Returns the total count of groups this user owns.

If the total list of groups or group names have already been collected (see getGroupsOwned()), then the returning value will be calculated based upon the current list. Otherwise, PTS will be explicitly queried for the information.

Returns:
total count of groups this user owns
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
getGroupsOwned(), getGroupsOwnedNames()

getGroupsOwned

public Group[] getGroupsOwned()
                       throws AFSAdminException
PTS: Returns an array of the Group objects this user owns.
Returns:
an array of the Groups this user owns
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getGroupNames

public String[] getGroupNames()
                       throws AFSAdminException
PTS: Returns a String array of the group names to which this user belongs.
Returns:
a String array of the groups to which this user belongs
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getGroupsOwnedNames

public String[] getGroupsOwnedNames()
                             throws AFSAdminException
PTS: Returns a String array of the group names this user owns.
Returns:
a String array of the groups this user owns
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getUID

public int getUID()
           throws AFSAdminException
PTS: Returns the numeric AFS id of this user.
Specified by:
getUID in interface PTSEntry
Returns:
the AFS id of this user
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getGroupCreationQuota

public int getGroupCreationQuota()
                          throws AFSAdminException
PTS: Returns how many more groups this user is allowed to create. -1 indicates unlimited.
Returns:
the group creation quota
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getGroupMembershipCount

public int getGroupMembershipCount()
                            throws AFSAdminException
PTS: Returns the number of groups to which this user belongs.
Returns:
the group membership count
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getOwner

public PTSEntry getOwner()
                  throws AFSAdminException
PTS: Returns the owner of this user in the form of a PTSEntry.

The returning object could be either a User or Group; to determine what type of object the PTSEntry represents, call the PTSEntry.getType() method.

Specified by:
getOwner in interface PTSEntry
Returns:
the owner of this user
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
PTSEntry, PTSEntry.getType(), refresh()

getCreator

public PTSEntry getCreator()
                    throws AFSAdminException
PTS: Returns the creator of this user in the form of a PTSEntry.

The returning object could be either a User or Group; to determine what type of object the PTSEntry represents, call the PTSEntry.getType() method.

Specified by:
getCreator in interface PTSEntry
Returns:
the creator of this user
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
PTSEntry, PTSEntry.getType(), refresh()

getType

public short getType()
Returns the type of PTSEntry this object represents.

This method will always return PTSEntry.PTS_USER.

Specified by:
getType in interface PTSEntry
Returns:
the type of PTSEntry this object represents (will always return PTSEntry.PTS_USER)
See Also:
PTSEntry, PTSEntry.getType()

getListStatus

public int getListStatus()
                  throws AFSAdminException
PTS: Returns who can list the status (pts examine) of this user. Valid values are:
Returns:
the status listing permission
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getListGroupsOwned

public int getListGroupsOwned()
                       throws AFSAdminException
PTS: Returns who can list the groups owned (pts listowned) by this user. Valid values are:
Returns:
the groups owned listing permission
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getListMembership

public int getListMembership()
                      throws AFSAdminException
PTS: Returns who can list the groups (pts membership) to which this user belongs. Valid values are:
Returns:
the membership listing permission
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

isAdmin

public boolean isAdmin()
                throws AFSAdminException
KAS: Returns whether or not this user has kas administrative privileges
Returns:
whether or not this user has kas administrative priveleges
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

willGrantTickets

public boolean willGrantTickets()
                         throws AFSAdminException
KAS: Returns whether or not TGS will issue tickets for this user
Returns:
whether or not TGS will issue tickets for this user
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

canEncrypt

public boolean canEncrypt()
                   throws AFSAdminException
KAS: Returns whether or not TGS can use this users ticket for an encryption key
Returns:
whether or not TGS can use this users ticket for an encryption key
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

canChangePassword

public boolean canChangePassword()
                          throws AFSAdminException
KAS: Returns whether or not the user can change their password
Returns:
whether or not the user can change their password
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

canReusePassword

public boolean canReusePassword()
                         throws AFSAdminException
KAS: Returns whether or not the user can reuse their password
Returns:
whether or not the user can reuse their password
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getUserExpiration

public int getUserExpiration()
                      throws AFSAdminException
KAS: Returns the date and time the user expires. A null value indicates the user never exipres (or that there is no kas entry for this user).
Returns:
the date and time the user expires
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getUserExpirationDate

public GregorianCalendar getUserExpirationDate()
                                        throws AFSAdminException
KAS: Returns the date and time the user expires. A null value indicates the user never expires (or that there is no kas entry for this user).
Returns:
the date and time the user expires
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getLastModTime

public int getLastModTime()
                   throws AFSAdminException
KAS: Returns the date and time (in UTC) the user's KAS entry was last modified.
Returns:
the date and time (in UTC) the user was last modified
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getLastModTimeDate

public GregorianCalendar getLastModTimeDate()
                                     throws AFSAdminException
KAS: Returns the date and time the user was last modified.
Returns:
the date and time the user was last modified
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getLastModName

public String getLastModName()
                      throws AFSAdminException
KAS: Returns the name of the user that last modified this user.
Returns:
the name of this user that last modified this user.
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getLastChangePasswordTimeDate

public GregorianCalendar getLastChangePasswordTimeDate()
                                                throws AFSAdminException
KAS: Returns the last date and time the user changed its password.
Returns:
the last date and time the user changed its password.
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getLastChangePasswordTime

public int getLastChangePasswordTime()
                              throws AFSAdminException
KAS: Returns the last date and time (in UTC) the user changed its password.
Returns:
the last date and time (in UTC) the user changed its password.
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getMaxTicketLifetime

public int getMaxTicketLifetime()
                         throws AFSAdminException
KAS: Returns the maximum lifetime of a ticket issued to this user (in seconds).
Returns:
the maximum lifetime of a ticket issued to this user (in seconds).
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getDaysToPasswordExpire

public int getDaysToPasswordExpire()
                            throws AFSAdminException
KAS: Returns the number of days a password is valid before it expires. A value of 0 indicates passwords never expire.
Returns:
the number of days for which a password is valid
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getFailLoginCount

public int getFailLoginCount()
                      throws AFSAdminException
KAS: Returns the number of failed login attempts this user is allowed before being locked out. A value of 0 indicates there is no limit.
Returns:
the number of failed login attempts a user is allowed
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getLockTime

public int getLockTime()
                throws AFSAdminException
KAS: Returns the amount of time (in seconds) a user is locked out when it exceeds the maximum number of allowable failed login attempts. A value of 0 indicates an infinite lockout time.
Returns:
the number of failed login attempts a user is allowed
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getEncryptionKey

public String getEncryptionKey()
                        throws AFSAdminException
KAS: Returns the encryption key, in octal form, of this user. An example of a key in octal form is: '\040\205\211\241\345\002\023\211'.
Returns:
the encryption key
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getKeyCheckSum

public long getKeyCheckSum()
                    throws AFSAdminException
KAS: Returns the check sum of this user's key.
Returns:
the check sum
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getKeyVersion

public int getKeyVersion()
                  throws AFSAdminException
KAS: Returns the version number of the user's key.
Returns:
the key version
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getLockedUntil

public int getLockedUntil()
                   throws AFSAdminException
KAS: Returns the date and time (in UTC) at which the user stops being locked out. A value of 0 indicates the user is not currently locked out. If the user is locked out forever, the value will be equal to -1.
Returns:
the date and time (in UTC) at which the user stops being locked out
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

getLockedUntilDate

public GregorianCalendar getLockedUntilDate()
                                     throws AFSAdminException
KAS: Returns the date and time at which the user stops being locked out. A value of null indicates the user is not currently locked out. If the user is locked out forever, the value getLockedUntil().getTime().getTime() will be equal to -1.
Returns:
the date and time at which the user stops being locked out
Throws:
AFSAdminException - If an error occurs in the native code
See Also:
refresh()

setGroupCreationQuota

public void setGroupCreationQuota(int quota)
PTS: Sets how many more groups this user is allowed to create. -1 indicates unlimited.
Parameters:
quota - the new group creation quota

setListStatus

public void setListStatus(int value)
                   throws AFSAdminException
PTS: Sets who can list the status (pts examine) of this user. Valid values are:
Parameters:
value - the value of the new list status permission
Throws:
AFSAdminException - if an error occurs in the native code
IllegalArgumentException - if an invalud argument is provided

setListGroupsOwned

public void setListGroupsOwned(int value)
                        throws AFSAdminException
PTS: Sets who can list the groups owned (pts listowned) by this user. Valid values are:
Parameters:
value - the value of the new list groups owned permission
Throws:
AFSAdminException - if an error occurs in the native code
IllegalArgumentException - if an invalud argument is provided

setListMembership

public void setListMembership(int value)
                       throws AFSAdminException
PTS: Sets who can list the groups (pts membership) to which this user belongs. Valid values are:
Parameters:
value - the value of the new list membership permission
Throws:
AFSAdminException - if an error occurs in the native code
IllegalArgumentException - if an invalud argument is provided

setAdmin

public void setAdmin(boolean setting)
KAS: Sets whether or not this user has kas administrative privileges
Parameters:
setting - whether or not this user has kas administrative privileges

setGrantTickets

public void setGrantTickets(boolean setting)
KAS: Sets whether or not TGS will issue tickets for this user
Parameters:
setting - whether or not TGS will issue tickets for this user

setEncrypt

public void setEncrypt(boolean setting)
KAS: Sets whether or not TGS can use this users ticket for an encryption key
Parameters:
setting - whether or not TGS can use this users ticket for an encryption key

setChangePassword

public void setChangePassword(boolean setting)
KAS: Sets whether or not the user can change their password
Parameters:
setting - whether or not the user can change their password

setReusePassword

public void setReusePassword(boolean setting)
KAS: Sets whether or not the user can reuse their password
Parameters:
setting - whether or not the user can reuse their password

setUserExpiration

public void setUserExpiration(GregorianCalendar expirationDate)
KAS: Sets the date and time the user expires. A null value indicates the user never exipres.
Parameters:
expirationDate - the date and time the user expires

setMaxTicketLifetime

public void setMaxTicketLifetime(int seconds)
KAS: Sets the maximum lifetime of a ticket issued to this user (in seconds).
Parameters:
seconds - the maximum lifetime of a ticket issued to this user (in seconds).

setDaysToPasswordExpire

public void setDaysToPasswordExpire(int days)
KAS: Sets the number of days a password is valid before it expires. A value of 0 indicates passwords never expire.
Parameters:
days - the number of days for which a password is valid

setFailLoginCount

public void setFailLoginCount(int logins)
KAS: Sets the number of failed login attempts this user is allowed before being locked out. A value of 0 indicates there is no limit.
Parameters:
logins - the number of failed login attempts a user is allowed

setLockTime

public void setLockTime(int seconds)
KAS: Sets the amount of time (in seconds) a user is locked out when it exceeds the maximum number of allowable failed login attempts. A value of 0 indicates an infinite lockout time. Any nonzero value gets rounded up to the next highest multiple of 8.5 minutes, and any value over 36 hours gets rounded down to 36 hours.
Parameters:
seconds - the number of failed login attempts a user is allowed

setPassword

public void setPassword(String newPassword)
                 throws AFSAdminException
Sets the password of this user to something new. Sets the key version to 0 automatically.
Parameters:
newPassword - the new password for this user
Throws:
AFSAdminException - If an error occurs in the native code

compareTo

public int compareTo(User user)
Compares two User objects respective to their names and does not factor any other attribute. Alphabetic case is significant in comparing names.
Parameters:
user - The User object to be compared to this User instance
Returns:
Zero if the argument is equal to this User's name, a value less than zero if this User's name is lexicographically less than the argument, or a value greater than zero if this User's name is lexicographically greater than the argument

compareTo

public int compareTo(Object obj)
Comparable interface method.
Specified by:
compareTo in interface Comparable
See Also:
compareTo(User)

equals

public boolean equals(User otherUser)
Tests whether two User objects are equal, based on their names.
Parameters:
otherUser - the user to test
Returns:
whether the specifed user is the same as this user

toString

public String toString()
Returns the name of this User
Overrides:
toString in class Object
Returns:
the name of this User

Java AFS Admin (jafsadm) API for OpenAFS

Copyright (c) 2001-2002 International Business Machines Corp.
All rights reserved.
See copyright statement.