Revision: 3872
Author: [email protected]
Date: Wed Aug 11 15:48:14 2010
Log: NEW - bug 2945: Working on the same project under different users causes the most recently logged in user to overwrite security in others
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=2945

Needed to clear the cookies on the ArchitectClientSideSession whenever the current session changes or when focus is switched from one frame to another.
http://code.google.com/p/power-architect/source/detail?r=3872

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectFrame.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectFrame.java Wed Aug 11 14:54:37 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectFrame.java Wed Aug 11 15:48:14 2010
@@ -42,6 +42,7 @@
 import java.awt.event.MouseEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
+import java.awt.event.WindowFocusListener;
 import java.awt.event.WindowStateListener;
 import java.io.BufferedInputStream;
 import java.io.File;
@@ -575,6 +576,21 @@
         });

nonModalUserPrompterFactory = new NonModalSwingUIUserPrompterFactory(this);
+
+ // Need to clear the cookies in case multiple frames within the same + // context are working on the same server project under different users.
+        addWindowFocusListener(new WindowFocusListener() {
+
+            @Override
+            public void windowLostFocus(WindowEvent e) {
+                // No operation.
+            }
+
+            @Override
+            public void windowGainedFocus(WindowEvent e) {
+                ArchitectClientSideSession.getCookieStore().clear();
+            }
+        });
     }

     /**

Reply via email to