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

Quick Search    Search Deep

com.RuntimeCollective.webapps.tag
Class CheckEditTag  view CheckEditTag download CheckEditTag.java

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended bycom.RuntimeCollective.webapps.tag.CheckEditTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public final class CheckEditTag
extends javax.servlet.jsp.tagext.TagSupport

Check if a user can edit the named session-scoped bean. This bean must implement the PermissionBean interface. If they do not have permission to edit this bean, control will be forwarded to a page that will display errors (defaults to /logon.jsp).

By default, the User on the session under RuntimeParameters.get("logonUserKey") will be used. A different User bean on the session can be used by specifying the "user" parameter.

This tag assumes the user is logged on; this tag should be used after checkLogon (unless "user" is specified).

Attributes:

For example, inserting
<%@ taglib uri="/WEB-INF/runtime-struts.tld" prefix="rs" %>
<rs:checkEdit name="com.RuntimeCollective.school.bean.Course"/>

into a jsp page will check that the user in the session under RuntimeParameters.get("logonUserKey") can edit the com.RuntimeCollective.school.bean.Course bean.

The following errors are returned

Version:
$Id: CheckEditTag.java,v 1.7 2003/09/30 15:13:16 joe Exp $

Field Summary
private  java.lang.String name
          The key of the session-scope bean we check permissions for.
private  java.lang.String page
          The page to which we should forward for the user to log on.
private  java.lang.String user
          The key of the user to check permissions for.
 
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
CheckEditTag()
           
 
Method Summary
 int doEndTag()
          Perform a permissions check by calling the specified bean's canEdit method, with the current user.
 int doStartTag()
          Defer our checking until the end of this tag is encountered.
 java.lang.String getName()
          Return the bean name.
 java.lang.String getPage()
          Return the forward page.
 java.lang.String getUser()
          Return the user.
 void release()
          Release any acquired resources.
 void setName(java.lang.String name)
          Set the bean name.
 void setPage(java.lang.String page)
          Set the forward page.
 void setUser(java.lang.String user)
          Set the user.
 
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

name

private java.lang.String name
The key of the session-scope bean we check permissions for.


page

private java.lang.String page
The page to which we should forward for the user to log on. Defaults to "/logon.jsp"


user

private java.lang.String user
The key of the user to check permissions for. Defaults to RuntimeParameters.get("logonUserKey")

Constructor Detail

CheckEditTag

public CheckEditTag()
Method Detail

getName

public java.lang.String getName()
Return the bean name.


setName

public void setName(java.lang.String name)
Set the bean name.


getPage

public java.lang.String getPage()
Return the forward page.


setPage

public void setPage(java.lang.String page)
Set the forward page.


getUser

public java.lang.String getUser()
Return the user.


setUser

public void setUser(java.lang.String user)
Set the user.


doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Defer our checking until the end of this tag is encountered.


doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Perform a permissions check by calling the specified bean's canEdit method, with the current user. If either of these beans are blank, or there is no session, or the user does not have permissions to access that bean, control will be forwarded to the specified error page with an appropriate error message set.


release

public void release()
Release any acquired resources.