<%-- IBM Confidential OCO Source Material --%> <%-- 5724-I63, 5724-H88, 5655-N02, 5733-W70 (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 language="java" import="org.apache.struts.util.MessageResources,org.apache.struts.action.Action,com.ibm.ws.security.core.SecurityContext"%> <%@ page errorPage="/error.jsp" %> <%@ page import="java.util.*" %> <%@ page import="java.net.*" %> <%@ 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.*"%> <%@ page import="com.ibm.wsspi.*"%> <%@ page import="com.ibm.ws.console.core.item.CollectionItem"%> <%@ page import="com.ibm.ws.console.core.selector.*"%> <%@ page import="com.ibm.ws.console.core.ConfigFileHelper"%> <%@ page import="com.ibm.ws.console.core.Constants"%> <%@ page import="com.ibm.ws.console.core.form.AbstractCollectionForm"%> <%@ page import="com.ibm.ws.console.core.form.ContextScopeForm"%> <%@ 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 chkcounter = 0; try { %> <% int wasVersion = ConfigUtils.getWASVersionInts()[0]; if(treatAdminSecurityManagerRoleAsMonitor==null) { treatAdminSecurityManagerRoleAsMonitor="true"; } org.apache.struts.util.MessageResources messages = (org.apache.struts.util.MessageResources)pageContext.getServletContext().getAttribute(org.apache.struts.action.Action.MESSAGES_KEY); String contextType=(String)request.getAttribute("contextType"); AdminAuthorizer adminAuthorizer = AdminAuthorizerFactory.getAdminAuthorizer(); java.util.Properties props= null; String encoding = response.getCharacterEncoding(); if(encoding==null) encoding = "UTF-8"; java.util.ArrayList collectionList_ext = new java.util.ArrayList(); for(int i=0;i0) || (extensions_preferences!=null && extensions_preferences.length>0)){ if(contextId!=null && contextId!="nocontext"){ props = ConfigFileHelper.getNodeMetadataProperties((String)contextId); //213515 } props = ConfigFileHelper.getAdditionalAdaptiveProperties(request, props, formName); } if(extensions!=null && extensions.length>0){ collectionList_ext = CollectionItemSelector.getCollectionItems(extensions,collectionList_ext,props); } pageContext.setAttribute("collectionList_ext",collectionList_ext); boolean isWASDynamicCluster = false; com.ibm.ws.console.dynamiccluster.form.DynamicClusterDetailForm dcDetailForm = (com.ibm.ws.console.dynamiccluster.form.DynamicClusterDetailForm) session.getAttribute("DynamicClusterDetailForm"); if (dcDetailForm != null) { String serverType = dcDetailForm.getServerType(); if (serverType != null && (serverType.equals(com.ibm.ws.xd.util.MiddlewareServerConstants.APPLICATION_SERVER) || (serverType.equals(com.ibm.ws.xd.util.MiddlewareServerConstants.ONDEMAND_ROUTER)))) { isWASDynamicCluster = true; } } %> <% if(extensions_preferences!=null && extensions_preferences.length>0){ collectionPreferenceList_ext = PreferenceSelector.getPreferences(extensions_preferences,collectionPreferenceList_ext,props); } %> <%-- Generate a map of roles--%> <% Map contextToRolesMap = new HashMap(); if (wasVersion >= 7) { %> <%String contextId_detail = null;%> <%contextId_detail = contextId_new;%> <% contextId_detail = ConfigFileHelper.encodeContextUri(contextId_detail); if(contextId_detail==null) contextId_detail=contextId; if (wasVersion >= 7) contextToRolesMap.put(contextId_detail, ConfigFileHelper.getRoles(contextId_detail)); %> <%-- We need to get ALL items in the collection so that we can display the correct values in the PreferenceFilter --%> <%-- It would be nice if there was a more efficient way to do that without looking through every item. (417407) --%> <%String contextId_detail = null;%> <%contextId_detail = contextId_new;%> <% contextId_detail = ConfigFileHelper.encodeContextUri(contextId_detail); if(contextId_detail==null) contextId_detail=contextId; contextToRolesMap.put(contextId_detail, ConfigFileHelper.getRoles(contextId_detail)); %> <% //The goal is to populate contextToRolesMap with // 1. The valid roles of all items in collection table // 2. The valid roles for current scope (if selected), or else for all possible scopes if "All Scopes" is selected if (contextId != null) { if (contextId.equals("none") || contextId.equals(Constants.ALLSCOPES)) { //try to get a list of scopes from a scope form ContextScopeForm scopeForm = (ContextScopeForm) session.getAttribute("contextScopeForm"); List allScopes = scopeForm.getAllscopes(); for (Iterator i = allScopes.iterator(); i.hasNext(); ) { String scopeContextId = (String) i.next(); contextToRolesMap.put(scopeContextId, ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(scopeContextId))); } } else if (contextId.equals("CONTEXT_NOT_SET")) { //This happens when using AbstractController ContextScopeForm scopeForm = (ContextScopeForm) session.getAttribute("contextScopeForm"); if (scopeForm.getCurrentScope().equals("All Scopes")) { List allScopes = scopeForm.getAllscopes(); for (Iterator i = allScopes.iterator(); i.hasNext(); ) { String scopeContextId = (String) i.next(); contextToRolesMap.put(scopeContextId, ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(scopeContextId))); } } else { contextToRolesMap.put(scopeForm.getCurrentScope(), ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(scopeForm.getCurrentScope()))); } } else { //context is set to a single scope--use that contextToRolesMap.put(contextId, ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(contextId))); } } } %> <%-- NOTES: The sorting icons are specified in defaultIconList. The icons are assumed to be located in the images folder. Checkboxes are NOT displayed for all objects whose refIds start with "builtin_" --%> <%@ include file="filterSetup.jspf" %> <% session.removeAttribute("preferences"); %> <% for (Iterator i = collectionPreferenceList_ext.iterator(); i.hasNext();) { preferences.add(i.next()); }%> <% if (request.getAttribute("role.filtering.disabled") == null) { %> <% } %> <% if (request.getAttribute("role.filtering.disabled") == null) { %> <% } %> <% String hideCheckBoxes = (String) request.getAttribute("hide.check.boxes"); if(hideCheckBoxes!= null && hideCheckBoxes.equals("true")){ showCheckBoxes = "false"; } %> <%@ include file="tableControlsLayout.jspf" %>
<% if (showCheckBoxes.equals ("true")) { %> <% } %> <% sortable = (String)cellItem.getIsSortable(); columnField = (String)cellItem.getColumnField(); String tmpName = cellItem.getTooltip(); String columnName = translatedText.getMessage(request.getLocale(),tmpName); String editable = cellItem.getEditable(); if (chkcounter == 0) { if (searchFilter.equals("")) { searchFilter = columnField; } } String showItem = "yes"; if (SecurityContext.isSecurityEnabled()) { String[] roles = cellItem.getRoles(); showItem = "no"; for (int idx = 0; idx < roles.length; idx++) { if (contextId != null && contextId.indexOf(":clusters:") != -1) { // Cluster member panel. Make sure that there is a proper role // to the cluster. String contextUri = ConfigFileHelper.decodeContextUri((String)contextId); if (adminAuthorizer.checkAccess(contextUri,roles[idx])) { } else if (request.isUserInRole(roles[idx])) { showItem = "yes"; break; } } else if (request.isUserInRole(roles[idx])) { showItem = "yes"; break; } } } %> <% chkcounter = chkcounter + 1; %> <%@ include file="filterControlsLayout.jspf" %> <% chkcounter = 0; %> <% String prevRole = null; boolean roleFilteringEnabled = true; if (wasVersion >= 7) { if (request.getAttribute("role.filtering.disabled") != null) roleFilteringEnabled = false; } %> <%String contextId_detail = null;%> <%contextId_detail = contextId_new;%> <% contextId_detail = ConfigFileHelper.encodeContextUri(contextId_detail); if(contextId_detail==null) contextId_detail=contextId; String primaryRole = null; if (wasVersion >= 7) { primaryRole = ConfigFileHelper.getAssumedRole((Set)contextToRolesMap.get(contextId_detail)); //515386: Treat Admin security manager role as monitor if(primaryRole.equals(AdminAuthorizer.ADMINSECURITY_ROLE) && treatAdminSecurityManagerRoleAsMonitor.equals("true")) { primaryRole=AdminAuthorizer.MONITOR_ROLE; } if (roleFilteringEnabled) { if (prevRole == null || !primaryRole.equals(prevRole)) { prevRole = primaryRole; String roleMessageKey = "resource.access." + primaryRole; %> <% } } } %> <% if (showCheckBoxes.equals("true")) { //Do not display checkbox if it is a builtin resource | do not display if user only has monitor access if ((wasVersion >= 7) && (("monitor".equals(primaryRole)) || (ConfigFileHelper.isDeleteable(refId) == false))) { //empty table cell where the check box normally would be %> <% } else { String delId = (String)resourceUri + "#" + (String) refId ; %> <% } } %> <% columnField = (String)cellItem.getColumnField(); String columnRefId = columnField + "RefId"; String editable = cellItem.getEditable(); String showItem = "yes"; if (SecurityContext.isSecurityEnabled()) { String contextUri_detail = ConfigFileHelper.decodeContextUri((String)contextId_detail); String[] roles = cellItem.getRoles(); showItem = "no"; for (int idx = 0; idx < roles.length; idx++) { if (adminAuthorizer.checkAccess(contextUri_detail,roles[idx])) { if (contextId != null && contextId.indexOf(":clusters:") != -1) { // Cluster member panel. Make sure that there is also a proper role // to the cluster. String contextUri = ConfigFileHelper.decodeContextUri((String)contextId); for (int idx2 = 0; idx2 < roles.length; idx2++) { if (adminAuthorizer.checkAccess(contextUri,roles[idx2])) { showItem = "yes"; break; } } } else { showItem = "yes"; break; } } } } %> <% chkcounter = chkcounter + 1; %>
<% if (sortIconLocation.equalsIgnoreCase ("right")) { %> <%=columnName%> <% } if (sortable.equals ("false")) { %> <% } if ((sortable.equals ("true")) && (!columnField.equals("status"))) { if (columnField.equals (sortedColumn)) { String nextOrder; if (order.equalsIgnoreCase ("ASC")) { nextOrder = "DSC"; } else { nextOrder = "ASC"; } %> <% if (order.equalsIgnoreCase ("ASC")) { %> <bean:message key="> <% } else if (order.equalsIgnoreCase ("DSC")) { %> <bean:message key="> <% } %> <% } else { %> <bean:message key="> <% } if (sortIconLocation.equalsIgnoreCase ("left")) { %> <% } if (sortable.equals ("false")) { %> <% } } %> <% //add refresh.gif after status column to refresh page if (columnField.equals("status")) { String refreshLink = parent + (parent.indexOf('?') == -1 ? "?refresh=true" : "&refresh=true"); %> <bean:message key=" align="texttop" border="0"/> <% } if (!filterDisplay.equals("none")) { if (columnField.equals(searchFilter)) { %>
: <% } } if(editable.equalsIgnoreCase("true") && showItem.equalsIgnoreCase("yes")){ %>
<%String updateproperty= "update."+columnField; %> <% } %>
  <% if ( !idColumn.equals("") ) { %> <% if (cellItem.getIcon()!=null && cellItem.getIcon().length() > 0) { %>   <% } if (cellItem.getLink().length() > 0) { String hRef = cellItem.getLink() + "&refId="+URLEncoder.encode(refId,encoding) + "&contextId=" + URLEncoder.encode(contextId,encoding) + "&resourceUri=" + URLEncoder.encode(resourceUri,encoding) + "&perspective=" + URLEncoder.encode(perspective,encoding); %> <% } if (columnField.equalsIgnoreCase("status")) { //hee 6.1?? String statusservlet = "/ibm/console/status"; String statusservlet = "/ibm/console/middlewareserverstatus"; if (isWASDynamicCluster) statusservlet = "/ibm/console/status"; if(cellItem.getStatusServlet()!=null) statusservlet = cellItem.getStatusServlet(); if ( statusType.equals("unknown") ) {%> <bean:message key=" TITLE=""> <% } else { %> <% String queryString = ""; Iterator cols = statusCols.iterator(); while (cols.hasNext()) { String col = (String) cols.next();%> <% queryString += "&" + col + "=" + URLEncoder.encode((String)colvar , encoding); } String encodedStatusLink = statusservlet + "?text=true&type=" + statusType + queryString; String imageSrcLink = statusservlet + "?type=" + statusType + queryString; %> <bean:message key=" TITLE=""> <% } %> <% } else if(editable.equalsIgnoreCase("true") && showItem.equalsIgnoreCase("yes")){ %> <% String desc = cellItem.getTooltip(); String columnFieldId = columnField + "_" + chkcounter; %> <% } else if (cellItem.getTranslate()) { %> <% } else { if (htmlFilter.equalsIgnoreCase("false")) { %> <% } else { %> <% } } if (cellItem.getLink().length() > 0) { %> <% }else{ %> <% if (!columnField.equalsIgnoreCase("status")) { %>   <% } %> <% } %>
<% } catch (Exception e) {e.printStackTrace(); } %> <% ServletContext servletContext = (ServletContext)pageContext.getServletContext(); MessageResources messages = (MessageResources)servletContext.getAttribute(Action.MESSAGES_KEY); String nonefound = messages.getMessage(request.getLocale(),"Persistence.none"); if (chkcounter == 0) { out.println(""); out.println("
"+nonefound+"
"); } %>