fixed bug allowing to autoregister to VRE if it had a vhost associated

This commit is contained in:
Massimiliano Assante 2020-04-23 09:34:29 +02:00
parent 1ee3f39678
commit 0a523dfa94
3 changed files with 19 additions and 12 deletions

View File

@ -1,5 +1,8 @@
<ReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xsd/changelog.xsd">
<Changeset component="org.gcube.portal.landing-page-library.1-3-1" date="2020-04-21">
<Change>Check that Site is a Gateway before redirecting and registering the user to it.</Change>
</Changeset>
<Changeset component="org.gcube.portal.landing-page-library.1-0-0" date="2016-06-22">
<Change>First Release</Change>
</Changeset>

View File

@ -10,7 +10,7 @@
</parent>
<groupId>org.gcube.portal</groupId>
<artifactId>landing-page-library</artifactId>
<version>1.3.0-SNAPSHOT</version>
<version>1.3.1</version>
<packaging>jar</packaging>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
@ -92,8 +92,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>

View File

@ -77,15 +77,19 @@ public class LandingPageManager {
}
}
if (! isRegistered) {
_log.info("But user " + currentUser.getFullName() + " is not registered to " + site.getName() + ". going to register ...");
String portalURL = PortalContext.getConfiguration().getGatewayURL(request);
registerUserToSite(currentUser, site, portalURL);
//only for SBD Gateway we check if the user belongs to resource catalogue VRE and SoBigDataLab VRE
if (currentVirtualHost.equalsIgnoreCase(SBD_GATEWAY_VHOST)) {
_log.debug("currentVirtualHost.equalsIgnoreCase ->" + SBD_GATEWAY_VHOST);
Thread resourceCatalogueSBDThread = new Thread(new ResourceCatalogueAndSBDLabRegistrationThread(userSites, currentUser, portalURL));
resourceCatalogueSBDThread.start();
}
_log.info("But user " + currentUser.getFullName() + " is not registered to " + site.getName());
boolean siteIsGateway = site.getParentGroupId() < 1;
_log.info("Is this a Gateway? " + (siteIsGateway) +". If true going to register ...");
if (siteIsGateway) {
String portalURL = PortalContext.getConfiguration().getGatewayURL(request);
registerUserToSite(currentUser, site, portalURL);
//only for SBD Gateway we check if the user belongs to resource catalogue VRE and SoBigDataLab VRE
if (currentVirtualHost.equalsIgnoreCase(SBD_GATEWAY_VHOST)) {
_log.debug("currentVirtualHost.equalsIgnoreCase ->" + SBD_GATEWAY_VHOST);
Thread resourceCatalogueSBDThread = new Thread(new ResourceCatalogueAndSBDLabRegistrationThread(userSites, currentUser, portalURL));
resourceCatalogueSBDThread.start();
}
}
}
break;
}