Bug #23411 fix
This commit is contained in:
parent
86b38c2454
commit
bc1cb9dc3e
|
@ -1,9 +1,12 @@
|
|||
# Changelog
|
||||
|
||||
## [v1.0.1-SNAPSHOT] - 2022-05-25
|
||||
|
||||
- Bug #23411 fix to the context list when deplyed at VRE level
|
||||
|
||||
## [v1.0.0] - 2021-05-14
|
||||
|
||||
First release
|
||||
- First release
|
||||
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
10
README.md
10
README.md
|
@ -37,12 +37,4 @@ open-source software toolkit used for building and operating Hybrid Data
|
|||
Infrastructures enabling the dynamic deployment of Virtual Research Environments
|
||||
by favouring the realisation of reuse oriented policies.
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||
|
||||
- the Sixth Framework Programme for Research and Technological Development
|
||||
- DILIGENT (grant no. 004260);
|
||||
- the Seventh Framework Programme for research, technological development and demonstration
|
||||
- D4Science (grant no. 212488), D4Science-II (grant no.239019), ENVRI (grant no. 283465), EUBrazilOpenBio (grant no. 288754), iMarine(grant no. 283644);
|
||||
- the H2020 research and innovation programme
|
||||
- BlueBRIDGE (grant no. 675680), EGIEngage (grant no. 654142), ENVRIplus (grant no. 654182), Parthenos (grant no. 654119), SoBigData (grant no. 654024),DESIRA (grant no. 818194), ARIADNEplus (grant no. 823914), RISIS2 (grant no. 824091), PerformFish (grant no. 727610), AGINFRAplus (grant no. 731001);
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md)
|
7
pom.xml
7
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<artifactId>rpt-token-portlet</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>RPT UMA Token Portlet</name>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1-SNAPSHOT</version>
|
||||
<description>
|
||||
Requesting Party Token Portlet
|
||||
</description>
|
||||
|
@ -45,6 +45,11 @@
|
|||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
|
|
|
@ -12,6 +12,8 @@ import javax.portlet.ResourceResponse;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||
import org.gcube.portal.oidc.lr62.OIDCUmaUtil;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||
|
@ -34,16 +36,25 @@ public class RPTTokenReader extends MVCPortlet {
|
|||
GroupManager gm = new LiferayGroupManager();
|
||||
try {
|
||||
User theUser = PortalUtil.getUser(renderRequest);
|
||||
List<GCubeGroup> userGroups = gm.listGroupsByUser(theUser.getUserId());
|
||||
String currentContext = getCurrentContext(renderRequest);
|
||||
ScopeBean bean = new ScopeBean(currentContext);
|
||||
List<String> userContexts = new ArrayList<String>();
|
||||
for (GCubeGroup g : userGroups) {
|
||||
if (g.getGroupName().equals(PortalContext.getConfiguration().getInfrastructureName())) {
|
||||
String context = gm.getInfrastructureScope(g.getGroupId());
|
||||
userContexts.add(context);
|
||||
}
|
||||
if (g.getParentGroupId() > 0) {
|
||||
String context = gm.getInfrastructureScope(g.getGroupId());
|
||||
userContexts.add(context);
|
||||
List<GCubeGroup> userGroups = gm.listGroupsByUser(theUser.getUserId());
|
||||
if (bean.is(Type.VRE)) {
|
||||
userContexts.add(currentContext);
|
||||
}
|
||||
else {
|
||||
for (GCubeGroup g : userGroups) {
|
||||
if(! (g.getFriendlyURL().equals("/guest") || g.getFriendlyURL().equals("/global") )) {// skipping these sites
|
||||
if (g.getGroupName().equals(PortalContext.getConfiguration().getInfrastructureName())) {
|
||||
String context = gm.getInfrastructureScope(g.getGroupId());
|
||||
userContexts.add(context);
|
||||
}
|
||||
if (g.getParentGroupId() > 0) {
|
||||
String context = gm.getInfrastructureScope(g.getGroupId());
|
||||
userContexts.add(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
renderRequest.setAttribute("userGroups", userGroups);
|
||||
|
@ -78,4 +89,26 @@ public class RPTTokenReader extends MVCPortlet {
|
|||
resourceResponse.getWriter().println(jsonObject);
|
||||
super.serveResource(resourceRequest, resourceResponse);
|
||||
}
|
||||
|
||||
private String getCurrentContext(RenderRequest request) {
|
||||
long groupId = -1;
|
||||
try {
|
||||
groupId = PortalUtil.getScopeGroupId(request);
|
||||
return getCurrentContext(groupId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private String getCurrentContext(long groupId) {
|
||||
try {
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
return pContext.getCurrentScope(""+groupId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<portlet-mode>view</portlet-mode>
|
||||
</supports>
|
||||
<portlet-info>
|
||||
<title>RPT/UMA Token Reader</title>
|
||||
<short-title>RPT Token Reader</short-title>
|
||||
<title>Personal UMA Token</title>
|
||||
<short-title>Personal UMA Token</short-title>
|
||||
<keywords></keywords>
|
||||
</portlet-info>
|
||||
<security-role-ref>
|
||||
|
|
|
@ -51,7 +51,9 @@ pageContext.setAttribute("userContexts", userContexts);
|
|||
document.execCommand("copy");
|
||||
}
|
||||
</script>
|
||||
<p>Select the context:</p>
|
||||
<c:if test = "${userContexts.size() > 1}">
|
||||
<p>Select the context:</p>
|
||||
</c:if>
|
||||
<div>
|
||||
<select style="width: 100%;" name="contexts" id="myselect">
|
||||
<c:forEach var="context" items="${userContexts}">
|
||||
|
|
Loading…
Reference in New Issue