Fixed readme and added native log support on Landing Page manager

This commit is contained in:
Massimiliano Assante 2020-02-03 16:59:35 +01:00
parent 6558eab61f
commit a753d29747
2 changed files with 7 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# gCube System - VRE Folder Hook
# gCube System - Landing page Library
This component is a library used in different hooks that understands from which sites the user enter the gateway and redirects accordingly.
This component is a shared library (used in different hooks) that figures out from which sites the user enter the gateway and redirects accordingly.
## Structure of the project

View File

@ -1,21 +1,19 @@
package org.gcube.portal.landingpage;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.gcube.common.portal.PortalContext;
import org.gcube.portal.notifications.thread.NewUserSiteRegistrationNotificationThread;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.StringBundler;
@ -35,7 +33,7 @@ import com.liferay.portal.util.PortalUtil;
*
*/
public class LandingPageManager {
private static final Logger _log = LoggerFactory.getLogger(LandingPageManager.class);
private static Log _log = LogFactoryUtil.getLog(LandingPageManager.class);
public static final String GUEST_GROUP_FRIENDLY_URL = "/guest";
public static final String PRIVATE_GROUP_SERVLET_MAPPING = PropsUtil.get(PropsKeys.LAYOUT_FRIENDLY_URL_PRIVATE_GROUP_SERVLET_MAPPING);
public static final String PORTAL_CONTEXT = PortalUtil.getPathContext();
@ -43,6 +41,7 @@ public class LandingPageManager {
public static String getLandingPagePath(final HttpServletRequest request) throws PortalException, SystemException {
User currentUser = PortalUtil.getUser(request);
_log.info("getLandingPagePath called for user " + currentUser.getScreenName());
return getLandingPagePath(request, currentUser);
}
/**
@ -57,7 +56,7 @@ public class LandingPageManager {
String sitePath = StringPool.BLANK;
String currentVirtualHost = request.getServerName();
_log.debug("currentHost is " + currentVirtualHost);
_log.info("currentHost is " + currentVirtualHost);
Group site = null;
List<VirtualHost> vHosts = VirtualHostLocalServiceUtil.getVirtualHosts(0, VirtualHostLocalServiceUtil.getVirtualHostsCount());
for (VirtualHost virtualHost : vHosts) {
@ -81,8 +80,6 @@ public class LandingPageManager {
_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);
_log.info("currentVirtualHost = " + currentVirtualHost);
//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);