com.sun.slamd.db
Class SLAMDPermission

java.lang.Object
  extended bycom.sun.slamd.db.SLAMDPermission

public class SLAMDPermission
extends java.lang.Object

This class defines a generic permission that may be associated with some functionality in the SLAMD administrative interface.


Field Summary
static java.lang.String ELEMENT_GROUPS
          The name of the enocded element that holds the groups names associated with this permission.
static java.lang.String ELEMENT_NAME
          The name of the enocded element that holds the name of this permission.
static java.lang.String ELEMENT_USERS
          The name of the enocded element that holds the user names associated with this permission.
 
Constructor Summary
SLAMDPermission(java.lang.String name, java.lang.String[] userNames, java.lang.String[] groupNames)
          Creates a new permission with the provided information.
 
Method Summary
 void addGroupName(java.lang.String groupName)
          Adds the provided group name to the set of groups that have been assigned this permission.
 void addUserName(java.lang.String userName)
          Adds the provided user name to the set of users that have been assigned this permission.
 boolean appliesToUser(SLAMDUser user)
          Indicates whether this permission is granted for the provided user.
static SLAMDPermission decode(byte[] encodedPermission)
          Decodes the provided byte array as a SLAMD permission.
static SLAMDPermission decodeSequence(ASN1Sequence permissonSequence)
          Decodes the provided ASN.1 sequence as a SLAMD permission.
 byte[] encode()
          Encodes the information associated with this permission to a byte array.
 ASN1Sequence encodeAsSequence()
          Encodes the information associated with this permission to an ASN.1 sequence.
 java.lang.String[] getGroupNames()
          Retrieves the names of the groups that have been assigned this permisson.
 java.lang.String getName()
          Retrieves the name of this permission.
 java.lang.String[] getUserNames()
          Retrieves the names of the users that have been assigned this permisson.
 void removeGroupName(java.lang.String groupName)
          Removes the specified group from the set of groups that have been assigned this permission.
 void removeUserName(java.lang.String userName)
          Removes the specified user from the set of users that have been assigned this permission.
 void setGroupNames(java.lang.String[] groupNames)
          Specifies the name sof the groups that have been assigned this permission.
 void setUserNames(java.lang.String[] userNames)
          Specifies the name sof the users that have been assigned this permission.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT_NAME

public static final java.lang.String ELEMENT_NAME
The name of the enocded element that holds the name of this permission.

See Also:
Constant Field Values

ELEMENT_USERS

public static final java.lang.String ELEMENT_USERS
The name of the enocded element that holds the user names associated with this permission.

See Also:
Constant Field Values

ELEMENT_GROUPS

public static final java.lang.String ELEMENT_GROUPS
The name of the enocded element that holds the groups names associated with this permission.

See Also:
Constant Field Values
Constructor Detail

SLAMDPermission

public SLAMDPermission(java.lang.String name,
                       java.lang.String[] userNames,
                       java.lang.String[] groupNames)
Creates a new permission with the provided information.

Parameters:
name - The name of this permission.
userNames - The names of the users that have been assigned this permission.
groupNames - The names of the groups that have been assigned this permission.
Method Detail

getName

public java.lang.String getName()
Retrieves the name of this permission.

Returns:
The name of this permission.

getUserNames

public java.lang.String[] getUserNames()
Retrieves the names of the users that have been assigned this permisson.

Returns:
The names of the users that have been assigned this permission.

setUserNames

public void setUserNames(java.lang.String[] userNames)
Specifies the name sof the users that have been assigned this permission.

Parameters:
userNames - The names of the users that have been assigned this permission.

addUserName

public void addUserName(java.lang.String userName)
Adds the provided user name to the set of users that have been assigned this permission.

Parameters:
userName - The user name to add to the set of users that have been assigned this permission.

removeUserName

public void removeUserName(java.lang.String userName)
Removes the specified user from the set of users that have been assigned this permission.

Parameters:
userName - The user name to remove from the set of users that have been assigned this permission.

getGroupNames

public java.lang.String[] getGroupNames()
Retrieves the names of the groups that have been assigned this permisson.

Returns:
The names of the groups that have been assigned this permission.

setGroupNames

public void setGroupNames(java.lang.String[] groupNames)
Specifies the name sof the groups that have been assigned this permission.

Parameters:
groupNames - The names of the groups that have been assigned this permission.

addGroupName

public void addGroupName(java.lang.String groupName)
Adds the provided group name to the set of groups that have been assigned this permission.

Parameters:
groupName - The group name to add to the set of groups that have been assigned this permission.

removeGroupName

public void removeGroupName(java.lang.String groupName)
Removes the specified group from the set of groups that have been assigned this permission.

Parameters:
groupName - The group name to remove from the set of groups that have been assigned this permission.

appliesToUser

public boolean appliesToUser(SLAMDUser user)
Indicates whether this permission is granted for the provided user.

Parameters:
user - The user for which to make the determination.
Returns:
true if this permission is granted for the provided user, or false if not.

encodeAsSequence

public ASN1Sequence encodeAsSequence()
Encodes the information associated with this permission to an ASN.1 sequence.

Returns:
The ASN.1 sequence containing the encoded permission data.

encode

public byte[] encode()
Encodes the information associated with this permission to a byte array.

Returns:
The byte array containing the encoded permission data.

decodeSequence

public static SLAMDPermission decodeSequence(ASN1Sequence permissonSequence)
                                      throws DecodeException
Decodes the provided ASN.1 sequence as a SLAMD permission.

Returns:
The decoded permission.
Throws:
DecodeException - If a problem occurs while attempting to decode the permission.

decode

public static SLAMDPermission decode(byte[] encodedPermission)
                              throws DecodeException
Decodes the provided byte array as a SLAMD permission.

Parameters:
encodedPermission - The byte array containing the data to decode.
Returns:
The decoded permission.
Throws:
DecodeException - If a problem occurs while attempting to decode the permission.