Java Code Examples for javax.servlet.jsp.tagext.TagSupport#EVAL_BODY_INCLUDE

The following examples show how to use javax.servlet.jsp.tagext.TagSupport#EVAL_BODY_INCLUDE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShowByPermissionTag.java    From openemm with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
    * permission control
    */
   @Override
public int doStartTag() throws JspException {
   	ComAdmin aAdmin = AgnUtils.getAdmin(pageContext);
	if (aAdmin != null) {
           try {
               if (aAdmin.permissionAllowed(Permission.getPermissionsByToken(token))) {
                   return TagSupport.EVAL_BODY_INCLUDE;
               }
           } catch (Exception e) {
               releaseException(e, token);
           }
       }

	return SKIP_BODY;
}
 
Example 2
Source File: ShowControlTag.java    From webcurator with Apache License 2.0 6 votes vote down vote up
@Override
public int doStartTag() throws JspException {  
	StringTokenizer tokenizer = new StringTokenizer(privileges, ";");
	String[] privs = new String[tokenizer.countTokens()];
	for(int i=0; tokenizer.hasMoreTokens(); i++) {
		privs[i] = tokenizer.nextToken();
	}
	
	if(ownedObject instanceof UserOwnable) {
		showControl = editMode && authorityManager.hasAtLeastOnePrivilege( (UserOwnable) ownedObject, privs);
	}
	else if(ownedObject instanceof AgencyOwnable) {
		showControl = editMode && authorityManager.hasAtLeastOnePrivilege( (AgencyOwnable) ownedObject, privs);
	}
	else {
		showControl = false;
	}
	// release the object (usually its a ti) from the tag to prevent a memory leak (Tags are pooled) 
	ownedObject = null;
	return TagSupport.EVAL_BODY_INCLUDE;
}
 
Example 3
Source File: ShowControlTrueTag.java    From webcurator with Apache License 2.0 5 votes vote down vote up
@Override
public int doStartTag() throws JspException {  
	if(getParent() instanceof ShowControlTag) {
		if(((ShowControlTag)getParent()).isShowControl()) {
			return TagSupport.EVAL_BODY_INCLUDE;
		}
		else {
			return TagSupport.SKIP_BODY;
		}
	}
	else {
		throw new JspTagException("True outside ShowControl");
	}
}
 
Example 4
Source File: HasUserOwnedPrivTag.java    From webcurator with Apache License 2.0 5 votes vote down vote up
@Override
public int doStartTag() throws JspException {
    if (ownedObject instanceof UserOwnable) {
        if (authorityManager.hasPrivilege(ownedObject, privilege)) {
            return TagSupport.EVAL_BODY_INCLUDE;
        } 
    	// release the object (usually its a target which references tis) from the tag to prevent a memory leak (Tags are pooled)
        ownedObject = null;
        return TagSupport.SKIP_BODY;
    }
    throw new JspException("authority:hasUserOwnedPriv tag called but ownedObject was not of type UserOwnable");
}
 
Example 5
Source File: NoPrivilegeTag.java    From webcurator with Apache License 2.0 5 votes vote down vote up
@Override
public int doStartTag() throws JspException {
    User user = AuthUtil.getRemoteUserObject();
    HashMap privs = authorityManager.getPrivilegesForUser(user);
    if (privs.containsKey(getPrivilege())) {
        RolePrivilege rp = (RolePrivilege)privs.get(getPrivilege());
        int usersPrivScope = rp.getPrivilegeScope();
        if (usersPrivScope <= getScope()) {
            return TagSupport.SKIP_BODY;
        }
    }
    return TagSupport.EVAL_BODY_INCLUDE;
}
 
Example 6
Source File: HasAtLeastOnePrivTag.java    From webcurator with Apache License 2.0 5 votes vote down vote up
@Override
public int doStartTag() throws JspException {  
    String[] privArray = getPrivilegeKeys();
    if (authorityManager.hasAtLeastOnePrivilege(privArray)) {
        return TagSupport.EVAL_BODY_INCLUDE;
    }
   	return TagSupport.SKIP_BODY;
}
 
Example 7
Source File: ShowControlFalseTag.java    From webcurator with Apache License 2.0 5 votes vote down vote up
@Override
public int doStartTag() throws JspException {  
	if(getParent() instanceof ShowControlTag) {
		if(((ShowControlTag)getParent()).isShowControl()) {
			return TagSupport.SKIP_BODY;
		}
		else {
			return TagSupport.EVAL_BODY_INCLUDE;
		}
	}
	else {
		throw new JspTagException("True outside ShowControl");
	}
}
 
Example 8
Source File: HasAgencyOwnedPrivTag.java    From webcurator with Apache License 2.0 5 votes vote down vote up
@Override
public int doStartTag() throws JspException {
    if (ownedObject instanceof AgencyOwnable) {
        if (authorityManager.hasPrivilege(ownedObject, privilege)) {
            return TagSupport.EVAL_BODY_INCLUDE;
        } 
        return TagSupport.SKIP_BODY;
    }
    throw new JspException("authority:hasAgencyOwnedPriv tag called but ownedObject was not of type AgencyOwnable");
}
 
Example 9
Source File: HasPrivilegeTag.java    From webcurator with Apache License 2.0 5 votes vote down vote up
@Override
public int doStartTag() throws JspException {
    if (hasPrivilege(getPrivilege(),getScope()) == true) {
        return TagSupport.EVAL_BODY_INCLUDE;
    } else {
        return TagSupport.SKIP_BODY;
    }
}
 
Example 10
Source File: HasPermissionTag.java    From jeecg with Apache License 2.0 5 votes vote down vote up
public int doStartTag() throws JspException {
       boolean show = showTagBody(code);
       if (show) {
           return TagSupport.SKIP_BODY;
       } else {
           return TagSupport.EVAL_BODY_INCLUDE;
       }
}