Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class TmViewerManager implements GlobalViewerController {
private ProjectInitFacade projectInit;
private DomainObject currProject;
private int NUMBER_FRAGMENTS_THRESHOLD = 100;
private boolean isTempOwnershipAdmin = false;
private boolean areOperationsLogged = false;


Expand Down Expand Up @@ -195,25 +194,12 @@ public boolean editsAllowed() {
return ClientDomainUtils.hasWriteAccess(modelManager.getCurrentWorkspace());
}

public boolean isTempOwnershipAdmin() {
return isTempOwnershipAdmin;
}

public void setTempOwnershipAdmin(boolean tempOwnershipAdmin) {
isTempOwnershipAdmin = tempOwnershipAdmin;
}

public boolean isOwnershipAdmin() {
// workstation admins always qualify
if (AccessManager.getAccessManager().isAdmin()) {
return true;
}

// user has temporary admin (think of it as sudo)
if (isTempOwnershipAdmin()) {
return true;
}

// check if user has admin role in tracers group:
Subject subject = AccessManager.getAccessManager().getAuthenticatedSubject();
if (subject==null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public void actionPerformed(ActionEvent actionEvent) {
private WorkspaceSaveAsAction saveAsAction;
private JCheckBoxMenuItem automaticTracingMenuItem;
private JCheckBoxMenuItem automaticRefinementMenuItem;
private JCheckBoxMenuItem tempOwnerAdminItem;
private NeuronExportAllAction exportAllSWCAction;
private NeuronFilterAction neuronFilterAction;
private ImportSWCAction importSWCAction;
Expand Down Expand Up @@ -259,31 +258,6 @@ public void itemStateChanged(ItemEvent itemEvent) {
saveAsAction = new WorkspaceSaveAsAction();
workspaceToolMenu.add(new JMenuItem(saveAsAction));

tempOwnerAdminItem = new JCheckBoxMenuItem("Temp ownership admin");
tempOwnerAdminItem.setSelected(false);
tempOwnerAdminItem.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
// about to get temporary ownership admin: dialog warning!
int ans = JOptionPane.showConfirmDialog(
ComponentUtil.getMainWindow(),
"You are about to give yourself permission to change any neuron's owner. Be careful!\n\nContinue?",
"Become owner admin?",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE
);
if (ans == JOptionPane.CANCEL_OPTION) {
tempOwnerAdminItem.setSelected(false);
} else {
TmViewerManager.getInstance().setTempOwnershipAdmin(true);
}
} else {
// giving up admin
TmViewerManager.getInstance().setTempOwnershipAdmin(false);
}
}
);
workspaceToolMenu.add(tempOwnerAdminItem);

// workspace tool menu button
final JButton workspaceToolButton = new JButton();
String gearIconFilename = "cog.png";
Expand Down