%-- IBM Confidential OCO Source Material --%> <%-- 5724-i63, 5724-H88 (C) COPYRIGHT International Business Machines Corp. 1997, 2010 --%> <%-- The source code for this program is not published or otherwise divested --%> <%-- of its trade secrets, irrespective of what has been deposited with the --%> <%-- U.S. Copyright Office. --%> <%@ page import="java.util.Iterator,com.ibm.ws.console.core.item.ActionSetItem,com.ibm.ws.security.core.SecurityContext"%> <%@ page import="java.util.StringTokenizer, java.util.Vector"%> <%@ page import="java.util.HashSet"%> <%@ page import="java.util.Set"%> <%@ page import="com.ibm.ws.*"%> <%@ page import="com.ibm.wsspi.*"%> <%@ page import="com.ibm.websphere.management.authorizer.AdminAuthorizer"%> <%@ page import="com.ibm.websphere.management.authorizer.AdminAuthorizerFactory"%> <%@ page import="com.ibm.websphere.management.metadata.ManagedObjectMetadataAccessor"%> <%@ page import="com.ibm.websphere.management.metadata.ManagedObjectMetadataAccessorFactory"%> <%@ page import="com.ibm.ws.console.core.selector.*"%> <%@ page import="com.ibm.ws.console.core.ConfigFileHelper"%> <%-- LIDB2303A --%> <%@ page import="com.ibm.ws.console.core.SecurityHelper"%> <%@ page import="com.ibm.ws.xd.admin.utils.ConfigUtils"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %> <% int count = 0; try { count = Integer.parseInt(buttonCount); } catch( java.lang.NumberFormatException ex){ count = 8; } %> <%-- Layout component Render a list of tiles in a vertical column @param : list List of names to insert --%> <% int wasVersion = ConfigUtils.getWASVersionInts()[0]; String contextType=(String)request.getAttribute("contextType"); String contextId = (String)request.getAttribute("contextId"); String perspective = (String)request.getAttribute("perspective"); String formAction = (String)request.getAttribute("formAction"); AdminAuthorizer adminAuthorizer = AdminAuthorizerFactory.getAdminAuthorizer(); String contextUri = ConfigFileHelper.decodeContextUri(contextId); //Build scope list Set rolesInCurrentContext = null; if (rolemap != null) { rolesInCurrentContext = new HashSet(); for (Iterator j = rolemap.values().iterator(); j.hasNext(); ) { rolesInCurrentContext.addAll((Set) j.next()); } } java.util.Properties props= null; java.util.ArrayList actionList_ext = new java.util.ArrayList(); for(int i=0;i0){ if(contextId!=null && contextId!="nocontext"){ props = ConfigFileHelper.getNodeMetadataProperties((String)contextId); //213515 } if(formName!=null) props = ConfigFileHelper.getAdditionalAdaptiveProperties(request, props, formName); // LIDB2303A else props = ConfigFileHelper.getAdditionalAdaptiveProperties(request, props); actionList_ext = ActionSetSelector.getButtons(extensions,actionList_ext,props,perspective, definitionName); } pageContext.setAttribute("actionList_ext",actionList_ext); boolean buttonsShown = false; %> <% Iterator i=actionList_ext.iterator(); int listsize = actionList_ext.size(); int excessItems = 0; String buttonName = ""; if (listsize > (count+1) ) { excessItems = 0; } else { count = listsize; } %> <% if (listsize > 0) { %> <% if (includeForm.equals("yes")){ %> <% } for (int ctr=0; ctr < listsize ; ++ctr) { ActionSetItem item = (ActionSetItem)i.next(); String action = item.getAction(); buttonName = action; boolean showItem = true; if (SecurityContext.isSecurityEnabled()) { String[] roles = item.getRoles(); showItem = false; for (int idx = 0; idx < roles.length; idx++) { if (wasVersion == 6) { if (request.isUserInRole(roles[idx])) { showItem = true; break; } } else { //By default if scope isn't defined, we rely on the scopes associated with ever item in the collection list, as defined in rolesInCurrentScope //to determine whether to display a button. //If a scope is set, then we check whether the caller has any access to that scope if (item.getScope() == null || item.getScope().equals("")) { //If rolesInCurrentScope is null, then that means we weren't given a rolemap by the collectionTableLayout, //So we should probably display the buttons by default. if (rolesInCurrentContext == null || rolesInCurrentContext.contains(roles[idx])) { showItem = true; } } else { if (SecurityHelper.checkAccessToScope(item.getScope(), roles[idx])) { showItem = true; } } } } // for roles loop } %> <% if (showItem == true) { buttonsShown = true; if ( ( (ctr == 0) && (selectItem.getAttribute().equals("adminAction")) ) || ( (ctr == 1) && (selectItem.getAttribute().equals("operationAction")) ) || ( (ctr == 2) && (selectItem.getAttribute().equals("modeAction")) ) ) { String isRequired = selectItem.getRequired(); String strType = selectItem.getType(); String isReadOnly = selectItem.getReadOnly(); try { session.removeAttribute("valueVector"); session.removeAttribute("descVector"); } catch (Exception e) { } Vector descVector = new Vector(); Vector valueVector = new Vector(); StringTokenizer st1 = new StringTokenizer(selectItem.getEnumDesc(), ","); while(st1.hasMoreTokens()) { String enumDesc = st1.nextToken(); descVector.addElement(enumDesc); } StringTokenizer st = new StringTokenizer(selectItem.getEnumValues(), ","); while(st.hasMoreTokens()) { String str = st.nextToken(); valueVector.addElement(str); } session.setAttribute("descVector", descVector); session.setAttribute("valueVector", valueVector); %> "/>" class="buttons_functions"/> <% } } //end showItem=true if %> <% } // end loop %> <% if (excessItems > 0) { %> <% for (int ctr=0; ctr < excessItems ; ++ctr) { ActionSetItem item2 = (ActionSetItem)i.next(); String action2 = item2.getAction(); buttonName = action2; boolean showExcessItem = true; if (SecurityContext.isSecurityEnabled()) { String[] roles = item2.getRoles(); showExcessItem = false; for (int idx = 0; idx < roles.length; idx++) { if (adminAuthorizer.checkAccess(contextUri, roles[idx])) { showExcessItem = true; break; } } } if (showExcessItem == true) { %> <% } //end if %> <% } // end loop %> " class="buttons_functions"/> <% } %> <% if (includeForm.equals("yes")) {%> <% } %> <% } %> <% if(!buttonsShown){ request.setAttribute("hide.check.boxes","true"); } %>