com.ibm.dse.applsrv.aa
Class SecurityGroup

java.lang.Object
  |
  +--com.ibm.dse.applsrv.aa.SecurityObject
        |
        +--com.ibm.dse.applsrv.aa.SecurityGroup

public class SecurityGroup
extends SecurityObject
implements java.io.Serializable

This class represents a security group.

See Also:
Serialized Form

Fields inherited from class com.ibm.dse.applsrv.aa.SecurityObject
fs
 
Constructor Summary
protected SecurityGroup(java.lang.String nameOfGroup)
          Create a new instance of a Group with the specified name.
 
Method Summary
protected  void _save()
          A hack to force inheritence of a static method.
 void addSubgroup(java.lang.String subgroup)
          Add a subgroup to the current group.
 void addSubgroupNCNS(java.lang.String subgroup)
          Add a subgroup to the current group.
 void addUser(java.lang.String userID)
          Add a user to the current group.
static void controller(SecurityController ctrl)
          Set the security controller.
 boolean delete()
          Delete this group.
protected static boolean delete(java.lang.String group)
          Delete the named group.
protected static boolean disablePersist()
          Disable persistence for groups.
protected static java.util.Enumeration enumerationOverGroups()
          Return an enumeration over the groups.
 void fix()
          Set the parent pointers of all subgroups of this group to point to self.
protected static void forceSave()
          Force a save of the current state of the groups to the database.
protected static SecurityGroup get(java.lang.String nameOfGroup, boolean create)
          Return the group with the specified name.
 Dictionary getAllInheritedData()
          Return a dictionary of all inherited data.
 Array getAllSubgroups(boolean include)
          Return a list of the names of all the subgroups (direct or indirect) of the current group.
 Array getAllUsers()
          Return a list of all direct or indirect members (users) of the current group.
 Dictionary getAttributes()
          Return a dictionary containing all of the attributes of this group.
protected static SecurityPersistence getDB()
          Return the persistence controller for this class.
protected static java.lang.String[] getGroupIds()
          Return the list of names of the groups.
 java.lang.String getInheritedData(java.lang.String key)
          Return the value associated with specified name in this group or the closest supergroup.
 java.lang.String getParent()
          Return the name of the parent group.
protected static java.lang.String getPathName()
          Return the pathname of this database of groups.
protected static boolean getPersist()
          Return the persistence state for groups.
 Array getSubGroups()
          Return a copy of the list of direct subgroups associated with this group.
 java.lang.String[] getSubGroupsAsArray()
          Return a copy of the list of direct subgroups associated with this group.
 java.lang.String[] getSubGroupsAsArrayOrNull()
          Return a copy of the list of direct subgroups associated with this group.
 Array getUsers()
          Return a copy of the list of users associated with this group.
 java.lang.String[] getUsersAsArray()
          Return a copy of the list of users associated with this group.
 java.lang.String[] getUsersAsArrayOrNull()
          Return a copy of the list of users associated with this group.
protected static Dictionary groups()
          Return a copy of the dictionary of groups.
 boolean hasMember(java.lang.String user, boolean direct)
          Check if the specified user is a direct or indirect member of this group.
 boolean hasSubgroup(java.lang.String subgroup)
          Check if the specified group is a direct subgroup of this group.
 boolean hasUser(java.lang.String user)
          Check if the current group has user as a direct member.
protected static void load()
          Load the current state of the groups from the database.
protected static Dictionary loadr()
          Load and return the current state of the groups from the database.
protected static Array membership(java.lang.String user)
          Return the list of groups of which user is a direct member.
protected static int numberOfGroups()
          Return the number of groups that are currently defined.
 void removeSubgroup(java.lang.String subgroup)
          Remove a subgroup from the current group.
 void removeUser(java.lang.String user)
          Remove a user from the current group.
protected static void reset()
          Reset the groups.
 void resetAttributes()
          Reset all attributes of this group with the exception of the group's name.
protected static void save()
          Save the current state of the groups to the database.
protected static void setDB(SecurityPersistence securityPersistence)
          Set the persistence controller for this class.
protected static void setFileName(java.lang.String fileName)
          Set the filename of this database.
protected static void setPersist(boolean persistence)
          Enable or disable persistence for groups.
protected static void shutdown()
          Shutdown the security component.
 java.lang.String toString()
          Returns a string representation of this object.
 void unlink()
          Remove this group from its parent.
 void verify()
          Verify this group.
protected static void verifyAll()
          Verify the consistancy of this database.
 
Methods inherited from class com.ibm.dse.applsrv.aa.SecurityObject
getData, getData, getDataOrNull, getName, home, prefix, putData, putData, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SecurityGroup

protected SecurityGroup(java.lang.String nameOfGroup)
                 throws DSESecurityException
Create a new instance of a Group with the specified name.
Parameters:
nameOfGroup - String - the name of this group.
Throws:
DSESecurityException - - error in the request.
Method Detail

_save

protected void _save()
              throws DSESecurityException
A hack to force inheritence of a static method.
Overrides:
_save in class SecurityObject
Throws:
DSESecurityException - - abstract method.

addSubgroup

public void addSubgroup(java.lang.String subgroup)
                 throws DSESecurityException
Add a subgroup to the current group.
Parameters:
subgroup - String - the name of the subgroup.
Throws:
DSESecurityException - - error in the request.

addSubgroupNCNS

public void addSubgroupNCNS(java.lang.String subgroup)
Add a subgroup to the current group. Perform no checking and no saving. Don't the the parent links.
Parameters:
subgroup - String - the name of the subgroup.

addUser

public void addUser(java.lang.String userID)
             throws DSESecurityException
Add a user to the current group.
Parameters:
userID - String - the name of the user.
Throws:
DSESecurityException - - error in the request.

controller

public static void controller(SecurityController ctrl)
Set the security controller.
Parameters:
ctrl - SecurityController - the security controller.

delete

public boolean delete()
               throws DSESecurityException
Delete this group.
Returns:
boolean - true if the delete succeeded else false.
Throws:
DSESecurityException - - database error.

delete

protected static boolean delete(java.lang.String group)
                         throws DSESecurityException
Delete the named group.
Parameters:
group - String - the name of the group to delete.
Returns:
boolean - true if the delete succeeded else false.
Throws:
DSESecurityException - - database error.

disablePersist

protected static boolean disablePersist()
Disable persistence for groups.
Returns:
boolean - true if groups were persisting else false.

enumerationOverGroups

protected static java.util.Enumeration enumerationOverGroups()
Return an enumeration over the groups.
Returns:
Enumeration - the enumeration over the groups.

fix

public void fix()
         throws DSESecurityException
Set the parent pointers of all subgroups of this group to point to self.
Throws:
DSESecurityException - - error in the request.

forceSave

protected static void forceSave()
                         throws DSESecurityException
Force a save of the current state of the groups to the database.
Throws:
DSESecurityException - - database error.

get

protected static SecurityGroup get(java.lang.String nameOfGroup,
                                   boolean create)
                            throws DSESecurityException
Return the group with the specified name. If the group doesn't exist & the create option is false then return null else create & return a new group with the specified name.
Parameters:
nameOfGroup - String - the name of the group.
create - boolean - if the group does not exist then if true then create it else just return null.
Returns:
SecurityGroup - the group.
Throws:
DSESecurityException - - error in the request.

getAllInheritedData

public Dictionary getAllInheritedData()
Return a dictionary of all inherited data. Note: closer definitions take precedence over further definitions.
Returns:
Dictionary - all the inherited data.

getAllSubgroups

public Array getAllSubgroups(boolean include)
Return a list of the names of all the subgroups (direct or indirect) of the current group.
Parameters:
include - boolean - true or false to include or exclude the current group respectively.
Returns:
Array - the list of all the subgroups of the current group.

getAllUsers

public Array getAllUsers()
Return a list of all direct or indirect members (users) of the current group.
Returns:
Array - list of all direct or indirect members of the current group.

getAttributes

public Dictionary getAttributes()
                         throws DSESecurityException
Return a dictionary containing all of the attributes of this group.
Returns:
Dictionary - a dictionary containing all of the attributes of this group.
Throws:
DSESecurityException - - database error.

getDB

protected static SecurityPersistence getDB()
Return the persistence controller for this class.
Returns:
SecurityPersistence - the persistence controller.

getGroupIds

protected static java.lang.String[] getGroupIds()
Return the list of names of the groups.
Returns:
String[] - the list of names of the groups.

getInheritedData

public java.lang.String getInheritedData(java.lang.String key)
Return the value associated with specified name in this group or the closest supergroup.
Parameters:
key - String - the name of the data item.
Returns:
String - the associated value or null if the key is not found.

getParent

public java.lang.String getParent()
Return the name of the parent group.
Returns:
String - the name of the parent group.

getPathName

protected static java.lang.String getPathName()
Return the pathname of this database of groups.
Returns:
String - the pathname of this database or null if its not configured.

getPersist

protected static boolean getPersist()
Return the persistence state for groups.
Returns:
boolean - true if groups are persisting else false.

getSubGroups

public Array getSubGroups()
Return a copy of the list of direct subgroups associated with this group.
Returns:
Array - a copy of the list of subgroups.

getSubGroupsAsArray

public java.lang.String[] getSubGroupsAsArray()
Return a copy of the list of direct subgroups associated with this group.
Returns:
String[] - a copy of the list of subgroups.

getSubGroupsAsArrayOrNull

public java.lang.String[] getSubGroupsAsArrayOrNull()
Return a copy of the list of direct subgroups associated with this group.
Returns:
String[] - a copy of the list of subgroups.

getUsers

public Array getUsers()
Return a copy of the list of users associated with this group.
Returns:
Array - a copy of the list of users.

getUsersAsArray

public java.lang.String[] getUsersAsArray()
Return a copy of the list of users associated with this group.
Returns:
String[] - a copy of the list of users.

getUsersAsArrayOrNull

public java.lang.String[] getUsersAsArrayOrNull()
Return a copy of the list of users associated with this group.
Returns:
String[] - a copy of the list of users.

groups

protected static Dictionary groups()
Return a copy of the dictionary of groups.
Returns:
Dictionary - the copy of the groups.

hasMember

public boolean hasMember(java.lang.String user,
                         boolean direct)
Check if the specified user is a direct or indirect member of this group. An indirect member of this group must be a direct member of a direct or indirect subgroup of this group.
Parameters:
user - String - the name of the user.
direct - boolean - if true then check only direct membership, if false then check direct/indirect membership.
Returns:
boolean - true of the specified user is a direct/indirect member of this group.

hasSubgroup

public boolean hasSubgroup(java.lang.String subgroup)
Check if the specified group is a direct subgroup of this group.
Parameters:
subgroup - String - the name of the group to check.
Returns:
boolean - true if the specified group is a direct subgroup of this group else false.

hasUser

public boolean hasUser(java.lang.String user)
Check if the current group has user as a direct member.
Parameters:
user - String - the ser id.
Returns:
boolean - true if user is a drect member of this group else false.

load

protected static void load()
                    throws DSESecurityException
Load the current state of the groups from the database.
Throws:
DSESecurityException - - database error.

loadr

protected static Dictionary loadr()
                           throws DSESecurityException
Load and return the current state of the groups from the database.
Returns:
Dictionary - the database.
Throws:
DSESecurityException - - database error.

membership

protected static Array membership(java.lang.String user)
Return the list of groups of which user is a direct member.
Parameters:
user - String - the user id.
Returns:
Array - the list of names of groups.

numberOfGroups

protected static int numberOfGroups()
Return the number of groups that are currently defined.
Returns:
int - the number of groups that are currently defined.

removeSubgroup

public void removeSubgroup(java.lang.String subgroup)
                    throws DSESecurityException
Remove a subgroup from the current group.
Parameters:
subgroup - String - the name of the subgroup.
Throws:
DSESecurityException - - error in the request.

removeUser

public void removeUser(java.lang.String user)
                throws DSESecurityException
Remove a user from the current group.
Parameters:
user - String - the name of the user.
Throws:
DSESecurityException - - error in the request.

reset

protected static void reset()
                     throws DSESecurityException
Reset the groups.
Throws:
DSESecurityException - - database error.

resetAttributes

public void resetAttributes()
                     throws DSESecurityException
Reset all attributes of this group with the exception of the group's name.
Throws:
DSESecurityException - - error during save.

save

protected static void save()
                    throws DSESecurityException
Save the current state of the groups to the database.
Throws:
DSESecurityException - - database error.

setDB

protected static void setDB(SecurityPersistence securityPersistence)
Set the persistence controller for this class.
Parameters:
securityPersistence - SecurityPersistence - the persistence controller.

setFileName

protected static void setFileName(java.lang.String fileName)
Set the filename of this database.
Parameters:
fileName - String - the name of this database.

setPersist

protected static void setPersist(boolean persistence)
Enable or disable persistence for groups.
Parameters:
persistence - boolean - true to enable persistence, false to disable it.

shutdown

protected static void shutdown()
                        throws DSESecurityException
Shutdown the security component.
Throws:
DSESecurityException - - error in the request.

toString

public java.lang.String toString()
Returns a string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
String - a string representation of this object.

unlink

public void unlink()
            throws DSESecurityException
Remove this group from its parent.
Throws:
DSESecurityException - - error in the request.

verify

public void verify()
            throws DSESecurityException
Verify this group.
Throws:
DSESecurityException - - error in the request.

verifyAll

protected static void verifyAll()
                         throws DSESecurityException
Verify the consistancy of this database.
Throws:
DSESecurityException - - error in the request.