mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-20 11:26:53 +00:00
beginning to integrate postgres with multiuser settings to be used with central repository
This commit is contained in:
parent
86285c071c
commit
70e62f28c0
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.centralrepository.optionspanel;
|
package org.sleuthkit.autopsy.centralrepository.optionspanel;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
@ -78,26 +79,77 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
|
|||||||
ingestStateUpdated(Case.isCaseOpen());
|
ingestStateUpdated(Case.isCaseOpen());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Messages({"GlobalSettingsPanel.updateFailed.title=Central repository disabled"})
|
|
||||||
private void updateDatabase() {
|
private void updateDatabase() {
|
||||||
|
updateDatabase(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean invokeCbChoice(Component parent) {
|
||||||
|
EamDbSettingsDialog dialog = new EamDbSettingsDialog();
|
||||||
|
if (dialog.wasConfigurationChanged()) {
|
||||||
|
updateDatabase(parent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NbBundle.Messages({
|
||||||
|
"GlobalSettingsPanel.onMultiUserChange.enable.title=Enable Central Repository?",
|
||||||
|
"GlobalSettingsPanel.onMultiUserChange.enable.description=Do you want to enable Central Repository using these settings?",
|
||||||
|
"GlobalSettingsPanel.onMultiUserChange.disabledMu.title=Central Repository Change Necessary",
|
||||||
|
"GlobalSettingsPanel.onMultiUserChange.disabledMu.description=Since mult-user cases have been disabled, 'PostgreSQL using multi-user settings' is no longer a valid option for Central Repository."
|
||||||
|
})
|
||||||
|
public static void onMultiUserChange(Component parent, boolean muPreviouslySelected, boolean muCurrentlySelected, boolean muChange) {
|
||||||
|
if (!muPreviouslySelected && muCurrentlySelected) {
|
||||||
|
if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(parent,
|
||||||
|
NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.onMultiUserChange.enable.description"),
|
||||||
|
NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.onMultiUserChange.enable.title"),
|
||||||
|
JOptionPane.YES_NO_OPTION)) {
|
||||||
|
|
||||||
|
// TODO: test and/or setup database for CR
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// moving from selected to not selected && 'PostgreSQL using multi-user settings' is selected
|
||||||
|
else if (muPreviouslySelected && !muCurrentlySelected && crMultiUser) {
|
||||||
|
if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(parent,
|
||||||
|
NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.onMultiUserChange.disabledMu.description"),
|
||||||
|
NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.onMultiUserChange.disabledMu.title"),
|
||||||
|
JOptionPane.YES_NO_OPTION)) {
|
||||||
|
|
||||||
|
invokeCbChoice(parent);
|
||||||
|
// TODO: test and/or setup database for CR
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// TODO: disable central repository
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// changing multi-user settings connection && 'PostgreSQL using multi-user settings' is selected
|
||||||
|
else if (muChange && crMultiUser) {
|
||||||
|
// todo test and/or setup database for CR
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Messages({"GlobalSettingsPanel.updateFailed.title=Central repository disabled"})
|
||||||
|
private static void updateDatabase(Component parent) {
|
||||||
if (CentralRepoPlatforms.getSelectedPlatform().equals(DISABLED)) {
|
if (CentralRepoPlatforms.getSelectedPlatform().equals(DISABLED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CentralRepoDbManager.upgradeDatabase();
|
CentralRepoDbManager.upgradeDatabase();
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
} catch (CentralRepoException ex) {
|
} catch (CentralRepoException ex) {
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
JOptionPane.showMessageDialog(this,
|
JOptionPane.showMessageDialog(parent,
|
||||||
ex.getUserMessage(),
|
ex.getUserMessage(),
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(GlobalSettingsPanel.class,
|
||||||
"GlobalSettingsPanel.updateFailed.title"),
|
"GlobalSettingsPanel.updateFailed.title"),
|
||||||
JOptionPane.WARNING_MESSAGE);
|
JOptionPane.WARNING_MESSAGE);
|
||||||
} finally {
|
} finally {
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,9 +477,8 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
|
|||||||
|
|
||||||
private void bnDbConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnDbConfigureActionPerformed
|
private void bnDbConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnDbConfigureActionPerformed
|
||||||
store();
|
store();
|
||||||
EamDbSettingsDialog dialog = new EamDbSettingsDialog();
|
boolean changed = invokeCbChoice(this);
|
||||||
if (dialog.wasConfigurationChanged()) {
|
if (changed) {
|
||||||
updateDatabase();
|
|
||||||
load(); // reload db settings content and update buttons
|
load(); // reload db settings content and update buttons
|
||||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
|||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
import org.openide.util.ImageUtilities;
|
import org.openide.util.ImageUtilities;
|
||||||
import org.openide.util.Lookup;
|
import org.openide.util.Lookup;
|
||||||
import org.sleuthkit.autopsy.core.UserPreferencesException;
|
import org.sleuthkit.autopsy.core.UserPreferencesException;
|
||||||
@ -684,6 +685,8 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
return (isUserSet == isPwSet);
|
return (isUserSet == isPwSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void store() {
|
void store() {
|
||||||
|
|
||||||
boolean multiUserCasesEnabled = cbEnableMultiUser.isSelected();
|
boolean multiUserCasesEnabled = cbEnableMultiUser.isSelected();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user