<%-- /** * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ --%> <%@page import="java.util.ArrayList"%> <%@ include file="/html/taglib/init.jsp"%> <%@ page import="org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager" %> <%@ page import="org.gcube.vomanagement.usermanagement.model.VirtualGroup" %> <%@ page import="org.gcube.vomanagement.usermanagement.util.ManagementUtils" %> <%@ page import="java.util.Collections" %> <% String[] classNames = (String[]) request .getAttribute("liferay-ui:my_sites:classNames"); String cssClass = GetterUtil.getString((String) request .getAttribute("liferay-ui:my_sites:cssClass")); boolean includeControlPanel = GetterUtil .getBoolean((String) request .getAttribute("liferay-ui:my_sites:includeControlPanel")); int max = GetterUtil.getInteger((String) request .getAttribute("liferay-ui:my_sites:max")); if (max <= 0) { max = PropsValues.MY_SITES_MAX_ELEMENTS; } /* EDIT For Custom Go To Panel */ Set customSiteGroups = new HashSet(); List mySiteGroups = new ArrayList(); boolean isAdmin = false, isSiteAdmin = false; //get the list of VREs available on this virtual host (customSiteGroups) String serverName = request.getServerName(); LiferayGroupManager gm = new LiferayGroupManager(); List currSiteVirtualGroups = gm.getVirtualGroups(ManagementUtils.getSiteGroupIdFromServletRequest(serverName)); for (Group userGroup : user.getMySiteGroups(classNames, includeControlPanel, max)) { if (userGroup.getChildren(true).isEmpty() && userGroup.getParentGroup() != null && (userGroup.getFriendlyURL().compareTo("/data-e-infrastructure-gateway") != 0) ) { for (VirtualGroup currSiteVGroup : currSiteVirtualGroups) { List vGroups = gm.getVirtualGroups(userGroup.getGroupId()); for (VirtualGroup virtualGroup : vGroups) { if (virtualGroup.getName().compareTo(currSiteVGroup.getName()) == 0) { customSiteGroups.add(userGroup); } } } } } //if the user is administrator we add the VOs and Root VO for (Role role : user.getRoles()) { if ("Administrator".equals(role.getName())) { isAdmin = true; for (Group site: user.getMySiteGroups(classNames, includeControlPanel, max)) { //if is not a VRE if (! site.getChildren(true).isEmpty() && (site.getFriendlyURL().compareTo("/data-e-infrastructure-gateway") != 0) ) customSiteGroups.add(site); } break; } } //copy the set into the expected list mySiteGroups.addAll(customSiteGroups); Collections.sort(mySiteGroups); /*End Edit */ %>