I'm setting up a liferay 5.2 instance and I want to do some custom development. I want the homepage to be different for a user depending what user group they are in. Something like, if they are in the alumni user group, take them to the alumni community, otherwise take them to the default community. I've looked through the liferay documentation on creating custom redirects and custom redirects and custom landing pages, but what I want to change is the homepage itself. I came across some code in the comments here and I'm trying to get it working, but I could use some guidance.
In ext-spring,xml
I've added:
<bean id="com.liferay.portal.util.PortalUtil" class="com.liferay.portal.util.PortalUtil">
<property name="portal">
<bean class="edu.arcadia.portal.liferay.ArcadiaPortalImpl" />
</property>
</bean>
I've also created a file ArcadiaPortalImpl.java
here: \ext\ext-impl\src\edu\arcadia\portal\util\
package edu.arcadia.portal.util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.liferay.portal.PortalException;
import com.liferay.portal.SystemException;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Company;
import com.liferay.portal.struts.LastPath;
import com.liferay.portal.util.PortalImpl;
import com.liferay.portal.util.PropsValues;
public class ArcadiaPortalImpl extends PortalImpl {
@Override
public String getHomeURL(HttpServletRequest request) throws PortalException, SystemException {
String portalURL = getPortalURL(request);
Company company = getCompany(request);
String homeURL = company.getHomeURL();
if (Validator.isNull(homeURL)) {
homeURL = PropsValues.COMPANY_DEFAULT_HOME_URL;
}
// added
HttpSession session = request.getSession(false);
if (session != null) {
LastPath lp = (LastPath) session.getAttribute("LANDING_PAGE");
if (lp != null) {
String specificHomeURL = lp.getPath();
if (Validator.isNotNull(specificHomeURL)) {
homeURL = specificHomeURL;
}
}
}
// end
return portalURL + getPathContext() + homeURL;
}
}
I'm new to liferay dev so I'm kind of lost in the new code that the guy added, specifically the LastPath code. What I want to do is grab a list of the logged in users groups and if a specific one exists then change their homeURL to another community.
Sorry this is such a noob question but I could really use some guidance! Am I barking up the wrong tree? Am I on the right path? If so, whats the next step?