com.novell.service.file.nw
Class EffectiveRights

java.lang.Object
  |
  +--com.novell.service.file.nw.EffectiveRights

public class EffectiveRights
extends java.lang.Object
implements java.lang.Cloneable

Provides an attribute interface for returning the effective rights of a file or a directory.

This class contains the following information about the effective rights of a file or directory:

The jndi.ds.Attribute.getAttributeID() returns Effective Rights as the attribute ID for this interface.

This object has a dual mode of operation. The first mode is the average user wanting to know what their effective rights are on a given directory entry. The second mode is requesting the effective rights of some other user on the system. This mode requires that the logged user have management rights (in the bindery) over the user name being requested. Also, it is enabled by the user setting the user name of the object.

WARNING: This class results in a mutable object. For versatility code block synchronization has been implemented in the various jndi search and modify methods of this classes implementation to provide for thread safe operation.

If you have a multi-threaded application and a code segment of that application uses get methods of this class, and there is a potential of another thread randomly using corresponding set methods of this class, you should enclose the calls to the get methods in a synchronized code block.

If you have a multi-threaded application and a code segment of that application uses set methods of this class, and there is a potential of another thread randomly using corresponding get methods of this class, you should enclose the calls to the set methods of this class in a synchronized code block.


Field Summary
static java.lang.String ATTRIBUTE_ID
          Attribute ID of DirectoryEntryInformation.
static java.lang.String COMPARE_SYNTAX_STRING
          Schema Syntax of DirectoryEntryInformation.
static java.lang.String RIGHTS_FIELD
          Field specifier for searching on rights field.
static java.lang.String SCHEMA_BINDING_NAME
          Schema Class Definition Name of DirectoryEntryInformation.
static int TA_ALL
          Netware rights: Specifies all rights to the directory.
static int TA_CREATE
          Netware rights: Can create files.
static int TA_DELETE
          Netware rights: Can delete files.
static int TA_MODIFY
          Netware rights: Can modify the file attributes.
static int TA_NONE
          Netware rights: Cannot read or write.
static int TA_OLD_OPEN
          Netware rights: Can open existing file (obsolete).
static int TA_OWNERSHIP
          Netware rights: Can create and delete subdirectories, and can grant and revoke trustee rights.
static int TA_READ
          Netware rights: Can read.
static int TA_SEARCH
          Netware rights: Can search the directory.
static int TA_SUPERVISOR
          Netware rights: User has supervisor rights.
static int TA_WRITE
          Netware rights: Can write.
static java.lang.String USER_FIELD
          Field specifier for searching on user field.
 
Constructor Summary
EffectiveRights()
          Constructs an EffectiveRights object with all fields set to zero or NULL.
EffectiveRights(int rights)
          Constructs an EffectiveRights object with the passed in rights value and the user field set to NULL.
EffectiveRights(int rights, java.lang.String user)
          Constructs an EffectiveRights object with the rights and user values set.
EffectiveRights(java.lang.String user)
          Constructs an EffectiveRights object with a user name, and the rights field is set to zero.
 
Method Summary
 java.lang.Object clone()
          Clones this object.
 boolean equals(java.lang.Object obj)
          Determines if the specified passed in object is equal to this EffectiveRights object.
 java.lang.String getCompareString()
          Returns the current value of compareString.
 int getRights()
          Returns the effective rights field.
 com.novell.service.rfc1960.Rfc1960Parser getSearchStringParser()
          Returns the RFC1960 Search String parser for the compare string.
 java.lang.String getUser()
          Returns a reference to this object's User field.
 void setCompareString(java.lang.String compareString)
          Sets the compare string value for the Rights and User fields.
 void setRights(int value)
          Sets the effective rights field.
 void setUser(java.lang.String value)
          Sets the User field of the Attribute.
 java.lang.String toString()
          Creates and returns a comma separated list of all attribute values.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_ID

public static final java.lang.String ATTRIBUTE_ID
Attribute ID of DirectoryEntryInformation.

(ATTRIBUTE_ID = "Entry Information")


SCHEMA_BINDING_NAME

public static final java.lang.String SCHEMA_BINDING_NAME
Schema Class Definition Name of DirectoryEntryInformation.

(SCHEMA_BINDING_NAME = ATTRIBUTE_ID + " Definition")


COMPARE_SYNTAX_STRING

public static final java.lang.String COMPARE_SYNTAX_STRING
Schema Syntax of DirectoryEntryInformation.

(COMPARE_SYNTAX_STRING = "(" + SearchStringComponent.EQUALS_STRING + "," + SearchStringComponent.PRESENT_STRING + "," + SearchStringComponent.SUBSTRING_STRING + ")")


RIGHTS_FIELD

public static final java.lang.String RIGHTS_FIELD
Field specifier for searching on rights field.

(RIGHTS_FIELD = "Rights")

See Also:
setCompareString(java.lang.String), equals(java.lang.Object)

USER_FIELD

public static final java.lang.String USER_FIELD
Field specifier for searching on user field.

(USER_FIELD = "User")

See Also:
setCompareString(java.lang.String), equals(java.lang.Object)

TA_NONE

public static final int TA_NONE
Netware rights: Cannot read or write.

(TA_NONE = 0x0000)

See Also:
getRights(), setRights(int)

TA_READ

public static final int TA_READ
Netware rights: Can read.

(TA_READ = 0x0001)

See Also:
getRights(), setRights(int)

TA_WRITE

public static final int TA_WRITE
Netware rights: Can write.

(TA_WRITE = 0x0002)

See Also:
getRights(), setRights(int)

TA_OLD_OPEN

public static final int TA_OLD_OPEN
Netware rights: Can open existing file (obsolete).

(TA_WRITE = 0x0004)

See Also:
getRights(), setRights(int)

TA_CREATE

public static final int TA_CREATE
Netware rights: Can create files.

(TA_CREATE = 0x0008)

See Also:
getRights(), setRights(int)

TA_DELETE

public static final int TA_DELETE
Netware rights: Can delete files.

(TA_DELETE = 0x0010)

See Also:
getRights(), setRights(int)

TA_OWNERSHIP

public static final int TA_OWNERSHIP
Netware rights: Can create and delete subdirectories, and can grant and revoke trustee rights.

(TA_OWNERSHIP = 0x0020)

See Also:
getRights(), setRights(int)

TA_SEARCH

public static final int TA_SEARCH
Netware rights: Can search the directory.

(TA_SEARCH = 0x0040)

See Also:
getRights(), setRights(int)

TA_MODIFY

public static final int TA_MODIFY
Netware rights: Can modify the file attributes.

(TA_MODIFY = 0x0080)

See Also:
getRights(), setRights(int)

TA_SUPERVISOR

public static final int TA_SUPERVISOR
Netware rights: User has supervisor rights.

(TA_SUPERVISOR = 0x0100)

See Also:
getRights(), setRights(int)

TA_ALL

public static final int TA_ALL
Netware rights: Specifies all rights to the directory.

(TA_ALL = 0x00FB)

See Also:
getRights(), setRights(int)
Constructor Detail

EffectiveRights

public EffectiveRights()
Constructs an EffectiveRights object with all fields set to zero or NULL.
See Also:
setUser(java.lang.String), setRights(int), getUser(), getRights()

EffectiveRights

public EffectiveRights(java.lang.String user)
Constructs an EffectiveRights object with a user name, and the rights field is set to zero.
Parameters:
user - The user data member value.
See Also:
setUser(java.lang.String), setRights(int), getUser(), getRights()

EffectiveRights

public EffectiveRights(int rights)
Constructs an EffectiveRights object with the passed in rights value and the user field set to NULL.
Parameters:
rights - The rights data member value.
See Also:
setUser(java.lang.String), setRights(int), getUser(), getRights()

EffectiveRights

public EffectiveRights(int rights,
                       java.lang.String user)
Constructs an EffectiveRights object with the rights and user values set.
Parameters:
rights - The rights data member value.
user - The user data member value.
See Also:
setUser(java.lang.String), setRights(int), getUser(), getRights()
Method Detail

getRights

public int getRights()
Returns the effective rights field.
Returns:
The effective rights.

setRights

public void setRights(int value)
Sets the effective rights field.
Parameters:
value - The effective rights value.

getUser

public java.lang.String getUser()
Returns a reference to this object's User field.
Returns:
The User associated with the effective rights.

setUser

public void setUser(java.lang.String value)
Sets the User field of the Attribute. The actual parameter reference will be stored by this object (it will not be cloned). Later modifications to this reference state will be reflected in this object. Calling the setUser method on an object returned from a jndi.getAttributes() call will result in obtaining the effective rights for the user that is set.
Parameters:
value - The User for which to set the effective rights.

setCompareString

public void setCompareString(java.lang.String compareString)
Sets the compare string value for the Rights and User fields. The compare string uses the RFC1960 (LDAP) search string format in individual compares on the Rights and User fields:

See the various SearchStringComponent compare methods referenced below for detailed information on the operation types allowed for String and integer data members.

The names of these fields have taken the names of their corresponding methods minus the get or set prefix. Given the following string: "(&(User=*test*)(Rights>=128))"

The equals() method returns TRUE if the user has the substring test in it, and the rights are set to be able to modify (TA_MODIFY). If the approximate operator type is used on the Rights field the various bits of the operand value are checked, and if any of them are set, equals will return TRUE. For example: (Rights~=3) returns TRUE if either the TA_READ or TA_WRITE bits are set, regardless of what other bits might be set.

If the string passed in is not a valid RFC1960 formatted string, this method will throw an IllegalArgumentException. If the compareString value is NULL, RFC1960 formated compares will be disabled.

Parameters:
compareString - The RFC1960 formated search string. NULL disables this compare functionality.
Throws:
java.lang.IllegalArgumentException - when the string passed in is not a valid RFC1960 formatted string.
See Also:
equals(java.lang.Object), DirectoryEntryInformation.SPACEALLOC_FIELD

getCompareString

public java.lang.String getCompareString()
Returns the current value of compareString.
Returns:
The current value of compareString.
See Also:
Trustee.setCompareString(java.lang.String)

getSearchStringParser

public com.novell.service.rfc1960.Rfc1960Parser getSearchStringParser()
Returns the RFC1960 Search String parser for the compare string.

Returns a Rfc1960Parser that was instantiated when the compareString was last set by the setCompareString() method.

Returns:
The Rfc1960Parser for the current compare String. Returns NULL if the compare string has not been set.

equals

public boolean equals(java.lang.Object obj)
Determines if the specified passed in object is equal to this EffectiveRights object.

The input object is compared against this object. If the input object has a RFC1960 compare string, this method will do the comparison based on the commands in the compare string.

Parameters:
obj - The object to compare.
Returns:
TRUE if equals, false otherwise.
Throws:
java.lang.IllegalArgumentException - If the operationType is illegal for the data type being compared.
Overrides:
equals in class java.lang.Object
See Also:
setCompareString(java.lang.String)

toString

public java.lang.String toString()
Creates and returns a comma separated list of all attribute values. The list returned is in the following format: "rights: n, user: s".

Returns:
A Comma separated list of values.
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Clones this object.

clone() instantiates a new instance of this type and assigns all fields using the current values of the fields in this directory entry information object.

Returns:
A new VolumeRestriction object with the same values.