Skip to content

Commit

Permalink
Merge pull request #1240 from virtualcell/869-permissions-dialog
Browse files Browse the repository at this point in the history
fix permissions dialog
  • Loading branch information
jcschaff committed May 6, 2024
2 parents fd186dd + d113f6a commit cacf7ac
Show file tree
Hide file tree
Showing 3 changed files with 189 additions and 181 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,92 +10,51 @@

package cbit.vcell.client;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.io.File;
import java.util.*;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.ToolTipManager;
import javax.swing.filechooser.FileFilter;
import javax.swing.tree.TreePath;

import org.vcell.util.gui.GeneralGuiUtils;
import org.vcell.util.*;
import org.vcell.util.document.BioModelChildSummary;
import org.vcell.util.document.BioModelInfo;
import org.vcell.util.document.CurateSpec;
import org.vcell.util.document.GroupAccess;
import org.vcell.util.document.GroupAccessSome;
import org.vcell.util.document.KeyValue;
import org.vcell.util.document.MathModelInfo;
import org.vcell.util.document.ReferenceQueryResult;
import org.vcell.util.document.ReferenceQuerySpec;
import org.vcell.util.document.User;
import org.vcell.util.document.VCDocument;
import org.vcell.util.document.VCDocument.DocumentCreationInfo;
import org.vcell.util.document.VCDocument.VCDocumentType;
import org.vcell.util.document.VCDocumentInfo;
import org.vcell.util.document.Version;
import org.vcell.util.document.VersionInfo;
import org.vcell.util.document.VersionableRelationship;
import org.vcell.util.document.VersionableType;
import org.vcell.util.document.VersionableTypeVersion;
import org.vcell.util.gui.AsynchProgressPopup;
import org.vcell.util.gui.DialogUtils;
import org.vcell.util.gui.VCFileChooser;
import org.vcell.util.gui.exporter.FileFilters;

import cbit.image.BrowseImage;
import cbit.image.GIFImage;
import cbit.image.VCImageInfo;
import cbit.image.VCImageUncompressed;
import cbit.image.VCPixelClass;
import cbit.image.*;
import cbit.vcell.client.desktop.ACLEditor;
import cbit.vcell.client.desktop.ACLState;
import cbit.vcell.client.desktop.DatabaseWindowPanel;
import cbit.vcell.client.server.UserPreferences;
import cbit.vcell.client.task.AsynchClientTask;
import cbit.vcell.client.task.ClientTaskDispatcher;
import cbit.vcell.clientdb.DocumentManager;
import cbit.vcell.desktop.BioModelDbTreePanel;
import cbit.vcell.desktop.BioModelNode;
import cbit.vcell.desktop.*;
import cbit.vcell.desktop.BioModelNode.PublicationInfoNode;
import cbit.vcell.desktop.GeometryTreePanel;
import cbit.vcell.desktop.MathModelDbTreePanel;
import cbit.vcell.desktop.VCDocumentDbTreePanel;
import cbit.vcell.desktop.VCellBasicCellRenderer.VCDocumentInfoNode;
import cbit.vcell.geometry.Geometry;
import cbit.vcell.geometry.GeometryInfo;
import cbit.vcell.solver.SimulationOwner;
import cbit.vcell.xml.ExternalDocInfo;
import cbit.xml.merge.XmlTreeDiff;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.vcell.util.Compare;
import org.vcell.util.DataAccessException;
import org.vcell.util.ObjectNotFoundException;
import org.vcell.util.UserCancelException;
import org.vcell.util.document.*;
import org.vcell.util.document.VCDocument.DocumentCreationInfo;
import org.vcell.util.document.VCDocument.VCDocumentType;
import org.vcell.util.gui.AsynchProgressPopup;
import org.vcell.util.gui.DialogUtils;
import org.vcell.util.gui.GeneralGuiUtils;
import org.vcell.util.gui.VCFileChooser;
import org.vcell.util.gui.exporter.FileFilters;

import javax.swing.Timer;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.io.File;
import java.util.List;
import java.util.*;


public class DatabaseWindowManager extends TopLevelWindowManager {
Expand Down Expand Up @@ -173,7 +132,7 @@ public void accessPermissions(final Component requester, final VersionInfo selec
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
getAclEditor().clearACLList();
getAclEditor().setACLState(new ACLEditor.ACLState(groupAccess));
getAclEditor().setACLState(ACLState.fromGroupAccess(groupAccess));
if (bGrantSupportPermissions) {
getAclEditor().grantVCellSupportPermissions();
}
Expand All @@ -189,9 +148,9 @@ public void run(Hashtable<String, Object> hashTable) throws Exception {
public void run(Hashtable<String, Object> hashTable) throws Exception {
Object choice = hashTable.get("choice");
if (choice == null || !choice.equals("OK")) return;
ACLEditor.ACLState aclState = getAclEditor().getACLState();
ACLState aclState = getAclEditor().getACLState();
if (aclState == null) return;
if (aclState.isAccessPrivate() || (aclState.getAccessList() != null && aclState.getAccessList().length == 0)) {
if (aclState.getAclType() == ACLState.ACLType.PRIVATE) {
VersionInfo vInfo;
if (selectedVersionInfo instanceof BioModelInfo bmi) {
vInfo = docManager.setGroupPrivate(bmi);
Expand All @@ -202,7 +161,7 @@ public void run(Hashtable<String, Object> hashTable) throws Exception {
} else if (selectedVersionInfo instanceof VCImageInfo vcii) {
vInfo = docManager.setGroupPrivate(vcii);
}
} else if (aclState.isAccessPublic()) {
} else if (aclState.getAclType() == ACLState.ACLType.PUBLIC) {
VersionInfo vInfo = null;
if (selectedVersionInfo instanceof BioModelInfo bmi) {
vInfo = docManager.setGroupPublic(bmi);
Expand All @@ -214,7 +173,7 @@ public void run(Hashtable<String, Object> hashTable) throws Exception {
vInfo = docManager.setGroupPublic(vcii);
}
} else {
List<String> newGroupAccessNameList = Arrays.asList(aclState.getAccessList());
List<String> newGroupAccessNameList = aclState.getAccessList();
List<String> originalGroupAccessNameList = new ArrayList<>();
//Turn User[] into String[]
if (groupAccess instanceof GroupAccessSome gas) {
Expand Down
Loading

0 comments on commit cacf7ac

Please sign in to comment.