1 16 17 package org.apache.struts.chain.servlet; 18 19 20 import javax.servlet.http.HttpServletRequest ; 21 import org.apache.commons.chain.Context; 22 import org.apache.commons.chain.web.servlet.ServletWebContext; 23 import org.apache.struts.chain.AbstractAuthorizeAction; 24 import org.apache.struts.config.ActionConfig; 25 26 27 32 33 public class AuthorizeAction extends AbstractAuthorizeAction { 34 35 36 38 39 protected boolean isAuthorized(Context context, String [] roles, 40 ActionConfig mapping) throws Exception { 41 42 ServletWebContext swcontext = (ServletWebContext) context; 44 HttpServletRequest request = swcontext.getRequest(); 45 46 for (int i = 0; i < roles.length; i++) { 48 if (request.isUserInRole(roles[i])) { 49 return (true); 50 } 51 } 52 53 return (false); 55 56 } 57 58 } 59 | Popular Tags |