|
|||||||||
| Home >> All >> com >> RuntimeCollective >> webapps >> [ tag overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.RuntimeCollective.webapps.tag
Class BelongsToTag

java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
com.RuntimeCollective.webapps.tag.BelongsToTag
- All Implemented Interfaces:
- javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag
- public class BelongsToTag
- extends javax.servlet.jsp.tagext.TagSupport
Evaluate the body of this tag only if the user specified by name, property and scope (or the currently logged-on user, if name is not specified) is a member (or not!) of the given group, or is a member of any group with the given group type.
This tag takes the following optional parameters. Either group or groupType must be specified:
name- specifies the attribute name of the bean whose property is accessed to retrieve the value specified byproperty(if specified). Ifpropertyis not specified, the value of this bean itself will specify the user. Ifnameis not specified, the currently logged-on user will be used.property- specifies the name of the property to be accessed on the bean specified byname. This value may be a simple, indexed, or nested property reference expression. If not specified, the bean identified bynamewill itself specify the user. If the specified property returns null, an Exception will be thrown.scope- specifies the variable scope searched to retrieve the bean specified byname. If not specified, the default rules applied byPageContext.findAttribute()are applied.group- if set then the tag will only admit users who are members of the UserGroup with this name.groupType- if set then the tag will only admit users who are members of any group which has this UserGroupType.notIn- if you want to check that the user is NOT in the group / group type. Defaults to false.
An example of how to use the groups parameter to allow only members of the Administrators or Editors group:
<rs:belongsTo groups='<%= new String[]{"Administrators", "Editors"} %>'>
- Version:
- $Id: BelongsToTag.java,v 1.13 2003/09/30 15:13:16 joe Exp $
| Field Summary | |
private java.lang.String |
iGroup
The name of the group that the user must be a member of [Optional] |
private java.lang.String[] |
iGroups
The names of the groups, at least one of which the user must be a member of [Optional] |
private java.lang.String |
iGroupType
The user must be a member of at least one group that has this group type [Optional] |
private boolean |
iNotIn
Whether the user should be in or not [Optional] |
protected java.lang.String |
name
Name of the bean that contains the user to check groups for. |
protected java.lang.String |
property
Name of the property to be accessed on the specified bean. |
protected java.lang.String |
scope
The scope to be searched to retrieve the specified bean. |
| Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
id, pageContext |
| Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
EVAL_BODY_AGAIN |
| Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
| Constructor Summary | |
BelongsToTag()
|
|
| Method Summary | |
private boolean |
checkBelongs(com.RuntimeCollective.webapps.bean.User user)
If the group attribute is set, check the user is in the specified group. |
int |
doEndTag()
Evaluate the remainder of the current page normally. |
int |
doStartTag()
Check if the user specified by name, property and scope (or the session user, if name is not specified) belongs to the appropriate group/group type, and evaluate the body of this tag if they do. |
java.lang.String |
getGroup()
Get the name of the group that the user must be a member of [Optional] |
java.lang.String[] |
getGroups()
Get the names of the groups, at least one of which the user user must be a member of [Optional] |
java.lang.String |
getGroupType()
Get the name of the group type containing a group that the user must be a member of [Optional] |
java.lang.String |
getName()
|
boolean |
getNotIn()
Get whether the user should be in or not [Optional] |
java.lang.String |
getProperty()
|
java.lang.String |
getScope()
|
void |
release()
Release all allocated resources. |
void |
setGroup(java.lang.String group)
Set the name of the group that the user must be a member of [Optional] |
void |
setGroups(java.lang.String[] groups)
Set the names of the groups, at least one of which the user user must be a member of [Optional] |
void |
setGroupType(java.lang.String groupType)
Set the name of the group type containing a group that the user must be a member of [Optional] |
void |
setName(java.lang.String name)
|
void |
setNotIn(boolean notIn)
Set whether the user should be in or not [Optional] |
void |
setProperty(java.lang.String property)
|
void |
setScope(java.lang.String scope)
|
| Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
iGroup
private java.lang.String iGroup
- The name of the group that the user must be a member of [Optional]
iGroups
private java.lang.String[] iGroups
- The names of the groups, at least one of which the user must be a member of [Optional]
iGroupType
private java.lang.String iGroupType
- The user must be a member of at least one group that has this group type [Optional]
iNotIn
private boolean iNotIn
- Whether the user should be in or not [Optional]
name
protected java.lang.String name
- Name of the bean that contains the user to check groups for.
property
protected java.lang.String property
- Name of the property to be accessed on the specified bean.
scope
protected java.lang.String scope
- The scope to be searched to retrieve the specified bean.
| Constructor Detail |
BelongsToTag
public BelongsToTag()
| Method Detail |
getGroup
public java.lang.String getGroup()
- Get the name of the group that the user must be a member of [Optional]
setGroup
public void setGroup(java.lang.String group)
- Set the name of the group that the user must be a member of [Optional]
getGroups
public java.lang.String[] getGroups()
- Get the names of the groups, at least one of which the user user must be a member of [Optional]
setGroups
public void setGroups(java.lang.String[] groups)
- Set the names of the groups, at least one of which the user user must be a member of [Optional]
getGroupType
public java.lang.String getGroupType()
- Get the name of the group type containing a group that the user must be a member of [Optional]
setGroupType
public void setGroupType(java.lang.String groupType)
- Set the name of the group type containing a group that the user must be a member of [Optional]
getNotIn
public boolean getNotIn()
- Get whether the user should be in or not [Optional]
setNotIn
public void setNotIn(boolean notIn)
- Set whether the user should be in or not [Optional]
getName
public java.lang.String getName()
setName
public void setName(java.lang.String name)
getProperty
public java.lang.String getProperty()
setProperty
public void setProperty(java.lang.String property)
getScope
public java.lang.String getScope()
setScope
public void setScope(java.lang.String scope)
doStartTag
public int doStartTag()
throws javax.servlet.jsp.JspException
- Check if the user specified by name, property and scope (or the session user,
if name is not specified) belongs to the appropriate group/group type,
and evaluate the body of this tag if they do.
doEndTag
public int doEndTag()
throws javax.servlet.jsp.JspException
- Evaluate the remainder of the current page normally.
release
public void release()
- Release all allocated resources.
checkBelongs
private boolean checkBelongs(com.RuntimeCollective.webapps.bean.User user) throws javax.servlet.jsp.JspException
- If the group attribute is set, check the user is in the specified group.
Otherwise, if the groupType attribute is set, check the user is in at least one group of the given type.
|
|||||||||
| Home >> All >> com >> RuntimeCollective >> webapps >> [ tag overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC