IDEMPIERE-4206 Session timeout shown sometimes when changing roles

This commit is contained in:
hengsin 2020-04-01 17:19:18 +08:00
parent 6e606799f9
commit bf8f5ea8c1
2 changed files with 11 additions and 2 deletions

View File

@ -81,6 +81,8 @@ import org.zkoss.zul.Window;
*/ */
public class AdempiereWebUI extends Window implements EventListener<Event>, IWebClient public class AdempiereWebUI extends Window implements EventListener<Event>, IWebClient
{ {
public static final String DESKTOP_SESSION_INVALIDATED_ATTR = "DesktopSessionInvalidated";
/** /**
* *
*/ */
@ -570,8 +572,10 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
Executions.getCurrent().sendRedirect("index.zul"); Executions.getCurrent().sendRedirect("index.zul");
//remove old desktop //remove old desktop
if (desktopCache != null) if (desktopCache != null) {
desktop.setAttribute(DESKTOP_SESSION_INVALIDATED_ATTR, Boolean.TRUE);
desktopCache.removeDesktop(desktop); desktopCache.removeDesktop(desktop);
}
} }
@Override @Override

View File

@ -237,6 +237,11 @@ public class SessionContextListener implements ExecutionInit,
return; return;
} }
Object sessionInvalidated = desktop.getAttribute(AdempiereWebUI.DESKTOP_SESSION_INVALIDATED_ATTR);
if (sessionInvalidated != null) {
return;
}
if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid()) if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid())
{ {
setupExecutionContextFromSession(Executions.getCurrent()); setupExecutionContextFromSession(Executions.getCurrent());