Revision: 3899
Author: mo.jeff
Date: Tue Aug 17 15:54:26 2010
Log: NEW - bug 2993: Project security panel does not respect global permissions
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=2993

The problem was that the Grant object that grants the system privileges was on the type ArchitectSwingProject, while the ProjectSecurityPanel was constructed to be on type ArchitectProject. Since the types didn't match, the UI decided that the system grant was not valid for the project.
http://code.google.com/p/power-architect/source/detail?r=3899

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

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectFrame.java Mon Aug 16 17:05:30 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectFrame.java Tue Aug 17 15:54:26 2010
@@ -79,7 +79,6 @@

 import org.apache.log4j.Logger;

-import ca.sqlpower.architect.ArchitectProject;
 import ca.sqlpower.architect.ArchitectSession;
 import ca.sqlpower.architect.CoreUserSettings;
 import ca.sqlpower.architect.UserSettings;
@@ -413,19 +412,24 @@
         }
     };

- private Action openProjectSecurityPanelAction = new AbstractAction("Project Settings...") { + private Action openProjectSecurityPanelAction = new AbstractAction("Project Security Settings...") {
         public void actionPerformed(ActionEvent e) {

- final JDialog d = SPSUtils.makeOwnedDialog(ArchitectFrame.this, "Security Manager"); + final JDialog d = SPSUtils.makeOwnedDialog(ArchitectFrame.this, "Project Security Settings");
             Action closeAction = new AbstractAction("Close") {
                 public void actionPerformed(ActionEvent e) {
                     d.dispose();
                 }
             };
-
+
+            // XXX: Blech!!! This code complete ignores any sort of
+ // encapsulation and is highly dependent on the currentSession field + // being the exactly the ArchitectSwingSessionImpl implementation. It's a + // reasonable guess, but it creates a dependency on that particular
+            // implementation.
((ArchitectClientSideSession) ((ArchitectSwingSessionImpl) currentSession).getDelegateSession()).getSystemSession().getUpdater().setUserPrompterFactory(nonModalUserPrompterFactory); ProjectSecurityPanel spm = new ProjectSecurityPanel(((ArchitectClientSideSession) ((ArchitectSwingSessionImpl) currentSession).getDelegateSession()).getSystemWorkspace(), - currentSession.getWorkspace(), ArchitectProject.class, ((ArchitectClientSideSession) ((ArchitectSwingSessionImpl) currentSession).getDelegateSession()).getProjectLocation().getServiceInfo().getUsername(), d, closeAction); + currentSession.getWorkspace(), ArchitectSwingProject.class, ((ArchitectClientSideSession) ((ArchitectSwingSessionImpl) currentSession).getDelegateSession()).getProjectLocation().getServiceInfo().getUsername(), d, closeAction);
             d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
             d.setContentPane(spm.getPanel());

Reply via email to