Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.permission.bean
Class UserGroupPermissionRule  view UserGroupPermissionRule download UserGroupPermissionRule.java

java.lang.Object
  extended bycom.RuntimeCollective.permission.bean.SimplePermissionRule
      extended bycom.RuntimeCollective.permission.bean.UserGroupPermissionRule
All Implemented Interfaces:
com.RuntimeCollective.webapps.bean.EntityBean, PermissionRule, java.io.Serializable

public class UserGroupPermissionRule
extends SimplePermissionRule

A permission rule whose behaviour depends on whether the user is a member of a group

Version:
$Id: UserGroupPermissionRule.java,v 1.19 2003/09/30 15:12:49 joe Exp $

Field Summary
static char COMMA
           
private static java.lang.String GROUP_RULE_MAP
          The database table that maps user groups to permission rules.
private  int groupCount
          Keeps track of the number of groups in the rule
private  java.util.List iGroups
          The user groups that this rule uses.
 
Fields inherited from class com.RuntimeCollective.permission.bean.SimplePermissionRule
DATABASE_TABLE, id, Key, NeedLogin
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
UserGroupPermissionRule()
          Default constructor generates a new blank bean with a new unique ID.
UserGroupPermissionRule(int id)
          Generate a bean from the database for the given primary key.
 
Method Summary
 boolean accepts(com.RuntimeCollective.webapps.bean.User user)
          Checks whether a User is accepted by this PermissionRule.
 void addGroup(com.RuntimeCollective.webapps.bean.UserGroup group)
          Add a group to the list for the permission rule.
 void clearGroups()
           
static java.lang.String computeGroupCombination(java.util.List groups)
          This is static, also used by UserGroupPermissionRuleFactory.
 boolean containsGroup(com.RuntimeCollective.webapps.bean.UserGroup group)
           
 void delete()
          Delete this bean from the database.
 java.lang.String getAuthorisationPath(com.RuntimeCollective.webapps.bean.User user, com.RuntimeCollective.webapps.bean.Session session, com.RuntimeCollective.webapps.ReturnPathContainer rpContainer, java.lang.String returnPath)
          Like the parent, excepts if the user is rejected, and not logged in, and the ReturnPathContainer is an HttpSessionReturnPathContainer, then we set the list of groups which could have been cleared on the session, so that the resulting JSP can display eg "You should be a XXX or XXX".
 java.lang.String getGroupCombination()
          This returns a String such as "123,523,1652", which contains the ids of all the groups, separated by commas, and sorted in ascending order.
 int getGroupCount()
           
 java.util.List getGroupList()
          Get a list of all groups.
 java.util.Iterator getGroups()
          Get an iterator of the groups for this rule.
static java.util.Iterator getPermissionRulesForUserGroup(com.RuntimeCollective.webapps.bean.UserGroup group)
          Gets an iterator of the permission rules associated with a particular user group.
static java.util.List getPermissionRulesForUserGroupAsList(com.RuntimeCollective.webapps.bean.UserGroup group)
          Gets a list of the permission rules associated with a particular user group.
 void removeGroup(com.RuntimeCollective.webapps.bean.UserGroup group)
          Remove group from the list for this permission rule.
 void save()
          Save this bean to the database.
 
Methods inherited from class com.RuntimeCollective.permission.bean.SimplePermissionRule
getAuthorisationPath, getAuthorisationPath, getId, getKey, getNeedLogin, getPathToLogon, getPathToRelogon, setId, setKey, setNeedLogin, setReturnUrl, setReturnUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_RULE_MAP

private static final java.lang.String GROUP_RULE_MAP
The database table that maps user groups to permission rules.

See Also:
Constant Field Values

iGroups

private java.util.List iGroups
The user groups that this rule uses.


groupCount

private int groupCount
Keeps track of the number of groups in the rule


COMMA

public static final char COMMA
See Also:
Constant Field Values
Constructor Detail

UserGroupPermissionRule

public UserGroupPermissionRule()
Default constructor generates a new blank bean with a new unique ID.


UserGroupPermissionRule

public UserGroupPermissionRule(int id)
Generate a bean from the database for the given primary key.

Method Detail

addGroup

public void addGroup(com.RuntimeCollective.webapps.bean.UserGroup group)
Add a group to the list for the permission rule.


removeGroup

public void removeGroup(com.RuntimeCollective.webapps.bean.UserGroup group)
Remove group from the list for this permission rule.


getGroups

public java.util.Iterator getGroups()
Get an iterator of the groups for this rule.


getGroupList

public java.util.List getGroupList()
Get a list of all groups.


getGroupCount

public int getGroupCount()

containsGroup

public boolean containsGroup(com.RuntimeCollective.webapps.bean.UserGroup group)

clearGroups

public void clearGroups()

getGroupCombination

public java.lang.String getGroupCombination()
This returns a String such as "123,523,1652", which contains the ids of all the groups, separated by commas, and sorted in ascending order.

This is used by UserGroupPermissionRuleFactory to identify UserGroupPermissionRules.


computeGroupCombination

public static java.lang.String computeGroupCombination(java.util.List groups)
This is static, also used by UserGroupPermissionRuleFactory.


accepts

public boolean accepts(com.RuntimeCollective.webapps.bean.User user)
Checks whether a User is accepted by this PermissionRule.

Specified by:
accepts in interface PermissionRule
Overrides:
accepts in class SimplePermissionRule

getAuthorisationPath

public java.lang.String getAuthorisationPath(com.RuntimeCollective.webapps.bean.User user,
                                             com.RuntimeCollective.webapps.bean.Session session,
                                             com.RuntimeCollective.webapps.ReturnPathContainer rpContainer,
                                             java.lang.String returnPath)
Like the parent, excepts if the user is rejected, and not logged in, and the ReturnPathContainer is an HttpSessionReturnPathContainer, then we set the list of groups which could have been cleared on the session, so that the resulting JSP can display eg "You should be a XXX or XXX".

Specified by:
getAuthorisationPath in interface PermissionRule
Overrides:
getAuthorisationPath in class SimplePermissionRule

save

public void save()
Save this bean to the database.

Specified by:
save in interface PermissionRule
Overrides:
save in class SimplePermissionRule

delete

public void delete()
Delete this bean from the database.

Specified by:
delete in interface PermissionRule
Overrides:
delete in class SimplePermissionRule

getPermissionRulesForUserGroup

public static java.util.Iterator getPermissionRulesForUserGroup(com.RuntimeCollective.webapps.bean.UserGroup group)
Gets an iterator of the permission rules associated with a particular user group. The rules may also be associated with other groups.


getPermissionRulesForUserGroupAsList

public static java.util.List getPermissionRulesForUserGroupAsList(com.RuntimeCollective.webapps.bean.UserGroup group)
Gets a list of the permission rules associated with a particular user group. The rules may also be associated with other groups.