You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by dr...@apache.org on 2016/08/22 14:02:30 UTC

incubator-unomi git commit: UNOMI-39 - switch profile if it has been updated in the session

Repository: incubator-unomi
Updated Branches:
  refs/heads/master 007610226 -> 94c27c0da


UNOMI-39 - switch profile if it has been updated in the session


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/94c27c0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/94c27c0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/94c27c0d

Branch: refs/heads/master
Commit: 94c27c0da2aa22b08827e4daa689c666c57744d9
Parents: 0076102
Author: Thomas Draier <dr...@apache.org>
Authored: Mon Aug 22 16:02:21 2016 +0200
Committer: Thomas Draier <dr...@apache.org>
Committed: Mon Aug 22 16:02:21 2016 +0200

----------------------------------------------------------------------
 wab/src/main/java/org/apache/unomi/web/ContextServlet.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/94c27c0d/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
----------------------------------------------------------------------
diff --git a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
index 7bedb67..7cb6c5d 100644
--- a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
@@ -156,7 +156,11 @@ public class ContextServlet extends HttpServlet {
                 session = profileService.loadSession(sessionId, timestamp);
                 if (session != null) {
                     sessionProfile = session.getProfile();
-
+                    if (!profile.isAnonymousProfile() && !sessionProfile.isAnonymousProfile() && !profile.getItemId().equals(sessionProfile.getItemId())) {
+                        // Session user has been switched, profile id in cookie is not uptodate
+                        profile = sessionProfile;
+                        HttpUtils.sendProfileCookie(profile, response, profileIdCookieName, profileIdCookieDomain);
+                    }
                     if (privacyService.isRequireAnonymousBrowsing(profile.getItemId()) && sessionProfile.isAnonymousProfile()) {
                         // User wants to browse anonymously, anonymous profile is already set.
                     } else if (privacyService.isRequireAnonymousBrowsing(profile.getItemId()) && !sessionProfile.isAnonymousProfile()) {