1 16 17 package org.apache.jetspeed.modules.actions.portlets.security; 18 19 import java.util.Iterator ; 20 21 import org.apache.velocity.context.Context; 23 24 import org.apache.turbine.util.RunData; 26 import org.apache.turbine.util.StringUtils; 27 28 import org.apache.jetspeed.services.JetspeedSecurity; 30 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService; 31 import org.apache.jetspeed.services.logging.JetspeedLogger; 32 import org.apache.jetspeed.services.resources.JetspeedResources; 33 34 import org.apache.jetspeed.modules.actions.portlets.VelocityPortletAction; 36 import org.apache.jetspeed.portal.portlets.VelocityPortlet; 37 38 39 45 public class RoleBrowserAction extends VelocityPortletAction 46 { 47 48 51 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(RoleBrowserAction.class.getName()); 52 53 60 protected void buildMaximizedContext( VelocityPortlet portlet, 61 Context context, 62 RunData rundata ) 63 { 64 buildNormalContext( portlet, context, rundata); 65 } 66 67 75 protected void buildConfigureContext( VelocityPortlet portlet, 76 Context context, 77 RunData rundata ) 78 { 79 80 buildNormalContext( portlet, context, rundata); 81 } 82 83 90 protected void buildNormalContext( VelocityPortlet portlet, 91 Context context, 92 RunData rundata ) 93 { 94 try 95 { 96 Iterator roles = JetspeedSecurity.getRoles(); 97 context.put(SecurityConstants.CONTEXT_ROLES, roles); 98 } 99 catch (Exception e) 100 { 101 logger.error("Error in Jetspeed Role Security", e); 103 104 rundata.setMessage("Error in Jetspeed Role Security: " + e.toString()); 105 rundata.setStackTrace(StringUtils.stackTrace(e), e); 106 rundata.setScreenTemplate(JetspeedResources.getString("template.error","Error")); 107 } 108 } 109 110 111 } | Popular Tags |