我想根据用户在 liferay 中的网站访问权限将用户重定向到默认登录页面。我正在使用liferay DXP。我知道如何在 liferay 6.2 中完成,但我不知道如何在 liferay 7 中覆盖/扩展 DefaultLandingPageAction 类。
让我知道是否有人以前这样做过。
谢谢!!
我想根据用户在 liferay 中的网站访问权限将用户重定向到默认登录页面。我正在使用liferay DXP。我知道如何在 liferay 6.2 中完成,但我不知道如何在 liferay 7 中覆盖/扩展 DefaultLandingPageAction 类。
让我知道是否有人以前这样做过。
谢谢!!
我假设您正在尝试在登录后重定向用户。
看看这个。应该做的伎俩。将类放入包中并调整逻辑。
@Component(
immediate = true,
property = {
"key=login.events.post"
},
service = LifecycleAction.class
)
public class LandingPageRouter implements LifecycleAction {
private static Log LOG = LogFactoryUtil.getLog(LandingPageRouter.class);
@Reference
private UserLocalService userLocalService;
@Override
public void processLifecycleEvent(LifecycleEvent lifecycleEvent) throws ActionException {
//Do some magic
//build the path.
LastPath lastPath = new LastPath(StringPool.BLANK, path);
lifecycleEvent.getRequest().getSession().setAttribute(WebKeys.LAST_PATH, lastPath);
}
}
LastPath 的工作方式与 DefaultLandingPageAction 中的一样。