* action, else <code>true</code> to abort processing.
*/
public boolean execute(Context context) throws Exception {
// Retrieve ActionConfig
ActionConfig actionConfig = (ActionConfig)
context.get(getActionConfigKey());
// Is this action protected by role requirements?
String roles[] = actionConfig.getRoleNames();
if ((roles == null) || (roles.length < 1)) {
return (false);
}
boolean throwEx = false;
try {
throwEx = !(isAuthorized(context, roles, actionConfig));
}
catch (Exception ex) {
throwEx = true;
log.error("Unable to complete authorization process", ex);
}
if (throwEx) {
// Retrieve internal message resources
ActionServlet servlet =
(ActionServlet) context.get(actionServletKey);
MessageResources resources = servlet.getInternal();
// The current user is not authorized for this action
throw new UnauthorizedActionException(
resources.getMessage("notAuthorized",
actionConfig.getPath()));
} else {
return (false);
}
}