Author: pgil
Date: Tue Apr 23 07:31:10 2019
New Revision: 1857991
URL:
http://svn.apache.org/viewvc?rev=1857991&view=revLog:
Fixed: User depersonation do not clean out impersonated user session.
(OFBIZ-10942)
Thank you Leila Mekika for reporting and providing the patch.
Modified:
ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java?rev=1857991&r1=1857990&r2=1857991&view=diff==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java Tue Apr 23 07:31:10 2019
@@ -719,8 +719,9 @@ public class LoginWorker {
}
//update the userLogin history, only one impersonation of this user can be active at the same time
+ GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
EntityCondition conditions = EntityCondition.makeCondition(
- EntityCondition.makeCondition("userLoginId", ((GenericValue) session.getAttribute("userLogin")).get("userLoginId")),
+ EntityCondition.makeCondition("userLoginId", userLogin.get("userLoginId")),
EntityCondition.makeCondition("originUserLoginId", originUserLogin.get("userLoginId")),
EntityUtil.getFilterByDateExpr());
try {
@@ -736,6 +737,9 @@ public class LoginWorker {
return "error";
}
+ // Log out currentLogin to clean session
+ doBasicLogout(userLogin, request, response);
+
// Log back the impersonating user
return doMainLogin(request, response, originUserLogin, null);
}