From 58ccefa0b722f759823a1667f2ffd452e197d78e Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 21 Jan 2020 18:57:27 +0100 Subject: [PATCH] ref 18291: Modify the Accounting Dashboard portlet to support the Core Services Category per gateway https://support.d4science.org/issues/18291 Fixed infra nodes scope --- .../accounting/PortalContextTreeProvider.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/server/accounting/PortalContextTreeProvider.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/accounting/PortalContextTreeProvider.java index 9acaa02..f6da078 100644 --- a/src/main/java/org/gcube/portlets/user/accountingdashboard/server/accounting/PortalContextTreeProvider.java +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/accounting/PortalContextTreeProvider.java @@ -110,8 +110,11 @@ public class PortalContextTreeProvider implements ContextTreeProvider { currUser); if (infraNode != null) { - String gatewayScope = String.valueOf(gCubeGroup.getGroupId()); - ScopeDescriptor infraNodeScopeDescriptor = createRelativeInfraNode(infraNode, gatewayScope); + StringBuilder gatewayScope=new StringBuilder(); + gatewayScope.append(infrastructureScope); + gatewayScope.append("/"); + gatewayScope.append(gCubeGroup.getGroupName()); + ScopeDescriptor infraNodeScopeDescriptor = createRelativeInfraNode(infraNode, gatewayScope.toString()); if (gatewayChildren != null) { gatewayChildren.addFirst(infraNodeScopeDescriptor); } else { @@ -152,20 +155,26 @@ public class PortalContextTreeProvider implements ContextTreeProvider { throws Exception, PortalException, SystemException { ScopeDescriptor root; - long currentSiteGroupId = getSiteFromServletRequest(request).getGroupId(); - + Group group=getSiteFromServletRequest(request); + long currentSiteGroupId = group.getGroupId(); + String gatewayName=group.getName(); + PortalContext pContext = PortalContext.getConfiguration(); GCubeUser currUser = pContext.getCurrentUser(request); String portalScope = pContext.getCurrentScope(currentSiteGroupId + ""); - String gatewayScope = String.valueOf(currentSiteGroupId); + StringBuilder gatewayScope=new StringBuilder(); + gatewayScope.append(portalScope); + gatewayScope.append("/"); + gatewayScope.append(gatewayName); + InfraNode infraNode = BuildInfraNode.build(portalScope); LinkedList rootChildren = null; rootChildren = retrieveGatewayChildren(request, currentSiteGroupId, currUser); if (infraNode != null) { - ScopeDescriptor infraNodeScopeDescriptor = createRelativeInfraNode(infraNode, gatewayScope); + ScopeDescriptor infraNodeScopeDescriptor = createRelativeInfraNode(infraNode, gatewayScope.toString()); if (rootChildren != null) { rootChildren.addFirst(infraNodeScopeDescriptor); } else {