Merge pull request #5694 from rcordovano/6028-restrict-adding-hashsets-to-cr

6028 Restrict ability to add hash sets to CR
This commit is contained in:
Richard Cordovano 2020-03-12 10:47:14 -04:00 committed by GitHub
commit e8e05d634e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 112 additions and 97 deletions

View File

@ -81,6 +81,16 @@ final public class FeatureAccessUtils {
public static boolean canDeleteCurrentCase() { public static boolean canDeleteCurrentCase() {
return currentCaseIsSingleUserCase() || multiUserCaseRestrictionsFileAbsent(); return currentCaseIsSingleUserCase() || multiUserCaseRestrictionsFileAbsent();
} }
/**
* Indicates whether or not a user can add hash sets to the central
* repository.
*
* @return True or false.
*/
public static boolean canAddHashSetsToCentralRepo() {
return multiUserCaseRestrictionsFileAbsent();
}
/** /**
* Indicates whether or not the current case is a single-user case. * Indicates whether or not the current case is a single-user case.

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013-2018 Basis Technology Corp. * Copyright 2013-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -44,6 +44,7 @@ import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDbManagerExc
import org.sleuthkit.datamodel.TskData; import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import org.sleuthkit.autopsy.featureaccess.FeatureAccessUtils;
/** /**
* Instances of this class allow a user to create a new hash database and add it * Instances of this class allow a user to create a new hash database and add it
@ -124,29 +125,29 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
setLocationRelativeTo(getOwner()); setLocationRelativeTo(getOwner());
setVisible(true); setVisible(true);
} }
private void enableComponents(){ private void enableComponents() {
if(! CentralRepository.isEnabled()){ if (!CentralRepository.isEnabled() || !FeatureAccessUtils.canAddHashSetsToCentralRepo()) {
centralRepoRadioButton.setEnabled(false); centralRepoRadioButton.setEnabled(false);
fileTypeRadioButton.setSelected(true); fileTypeRadioButton.setSelected(true);
} else { } else {
populateCombobox(); populateCombobox();
} }
boolean isFileType = fileTypeRadioButton.isSelected(); boolean isFileType = fileTypeRadioButton.isSelected();
// Type type only // Type type only
databasePathLabel.setEnabled(isFileType); databasePathLabel.setEnabled(isFileType);
databasePathTextField.setEnabled(isFileType); databasePathTextField.setEnabled(isFileType);
saveAsButton.setEnabled(isFileType); saveAsButton.setEnabled(isFileType);
// Central repo only // Central repo only
lbOrg.setEnabled(! isFileType); lbOrg.setEnabled(!isFileType);
orgButton.setEnabled(! isFileType); orgButton.setEnabled(!isFileType);
orgComboBox.setEnabled(! isFileType); orgComboBox.setEnabled(!isFileType);
} }
@NbBundle.Messages({"HashDbCreateDatabaseDialog.populateOrgsError.message=Failure loading organizations."}) @NbBundle.Messages({"HashDbCreateDatabaseDialog.populateOrgsError.message=Failure loading organizations."})
private void populateCombobox() { private void populateCombobox() {
orgComboBox.removeAllItems(); orgComboBox.removeAllItems();
@ -155,7 +156,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
orgs = dbManager.getOrganizations(); orgs = dbManager.getOrganizations();
orgs.forEach((org) -> { orgs.forEach((org) -> {
orgComboBox.addItem(org.getName()); orgComboBox.addItem(org.getName());
if(CentralRepoDbUtil.isDefaultOrg(org)){ if (CentralRepoDbUtil.isDefaultOrg(org)) {
orgComboBox.setSelectedItem(org.getName()); orgComboBox.setSelectedItem(org.getName());
selectedOrg = org; selectedOrg = org;
} }
@ -167,7 +168,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
JOptionPane.showMessageDialog(this, Bundle.HashDbCreateDatabaseDialog_populateOrgsError_message()); JOptionPane.showMessageDialog(this, Bundle.HashDbCreateDatabaseDialog_populateOrgsError_message());
Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Failure loading organizations", ex); Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Failure loading organizations", ex);
} }
} }
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
@ -413,7 +414,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
path.append(lastBaseDirectory); path.append(lastBaseDirectory);
File hashDbFolder = new File(path.toString()); File hashDbFolder = new File(path.toString());
// create the folder if it doesn't exist // create the folder if it doesn't exist
if (!hashDbFolder.exists()){ if (!hashDbFolder.exists()) {
hashDbFolder.mkdir(); hashDbFolder.mkdir();
} }
if (!hashSetNameTextField.getText().isEmpty()) { if (!hashSetNameTextField.getText().isEmpty()) {
@ -452,7 +453,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
return; return;
} }
if(fileTypeRadioButton.isSelected()){ if (fileTypeRadioButton.isSelected()) {
if (databasePathTextField.getText().isEmpty()) { if (databasePathTextField.getText().isEmpty()) {
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
@ -463,13 +464,13 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
return; return;
} }
} else { } else {
if(selectedOrg == null){ if (selectedOrg == null) {
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.missingOrg"), "HashDbCreateDatabaseDialog.missingOrg"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.createHashDbErr"), "HashDbCreateDatabaseDialog.createHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
} }
@ -487,7 +488,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
String errorMessage = NbBundle String errorMessage = NbBundle
.getMessage(this.getClass(), "HashDbCreateDatabaseDialog.errMsg.hashDbCreationErr"); .getMessage(this.getClass(), "HashDbCreateDatabaseDialog.errMsg.hashDbCreationErr");
if(fileTypeRadioButton.isSelected()){ if (fileTypeRadioButton.isSelected()) {
try { try {
newHashDb = HashDbManager.getInstance().addNewHashDatabaseNoSave(hashSetNameTextField.getText(), fileChooser.getSelectedFile().getCanonicalPath(), true, sendIngestMessagesCheckbox.isSelected(), type); newHashDb = HashDbManager.getInstance().addNewHashDatabaseNoSave(hashSetNameTextField.getText(), fileChooser.getSelectedFile().getCanonicalPath(), true, sendIngestMessagesCheckbox.isSelected(), type);
} catch (IOException ex) { } catch (IOException ex) {
@ -510,17 +511,17 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
} }
} else { } else {
// Check if a hash set with the same name/version already exists // Check if a hash set with the same name/version already exists
try{ try {
if(CentralRepository.getInstance().referenceSetExists(hashSetNameTextField.getText(), "")){ if (CentralRepository.getInstance().referenceSetExists(hashSetNameTextField.getText(), "")) {
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.duplicateName"), "HashDbCreateDatabaseDialog.duplicateName"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.createHashDbErr"), "HashDbCreateDatabaseDialog.createHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
} catch (CentralRepoException ex){ } catch (CentralRepoException ex) {
Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error looking up reference set", ex); Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error looking up reference set", ex);
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
@ -528,16 +529,16 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.createHashDbErr"), "HashDbCreateDatabaseDialog.createHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
try{ try {
int referenceSetID = CentralRepository.getInstance().newReferenceSet(new CentralRepoFileSet(selectedOrg.getOrgID(), hashSetNameTextField.getText(), int referenceSetID = CentralRepository.getInstance().newReferenceSet(new CentralRepoFileSet(selectedOrg.getOrgID(), hashSetNameTextField.getText(),
"", fileKnown, false, CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID))); "", fileKnown, false, CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID)));
newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetNameTextField.getText(), newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetNameTextField.getText(),
"", referenceSetID, "", referenceSetID,
true, sendIngestMessagesCheckbox.isSelected(), type, false); true, sendIngestMessagesCheckbox.isSelected(), type, false);
} catch (CentralRepoException | TskCoreException ex){ } catch (CentralRepoException | TskCoreException ex) {
Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error creating new reference set", ex); Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error creating new reference set", ex);
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
@ -545,8 +546,8 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.createHashDbErr"), "HashDbCreateDatabaseDialog.createHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
} }
dispose(); dispose();
@ -561,11 +562,13 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
// update the combobox options // update the combobox options
if (dialog.isChanged()) { if (dialog.isChanged()) {
populateCombobox(); populateCombobox();
} }
}//GEN-LAST:event_orgButtonActionPerformed }//GEN-LAST:event_orgButtonActionPerformed
private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgComboBoxActionPerformed private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgComboBoxActionPerformed
if (null == orgComboBox.getSelectedItem()) return; if (null == orgComboBox.getSelectedItem()) {
return;
}
String orgName = this.orgComboBox.getSelectedItem().toString(); String orgName = this.orgComboBox.getSelectedItem().toString();
for (CentralRepoOrganization org : orgs) { for (CentralRepoOrganization org : orgs) {
if (org.getName().equals(orgName)) { if (org.getName().equals(orgName)) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2018 Basis Technology Corp. * Copyright 2013-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -42,6 +42,7 @@ import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb.KnownFile
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDbManagerException; import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDbManagerException;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb; import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import org.sleuthkit.autopsy.featureaccess.FeatureAccessUtils;
/** /**
* Instances of this class allow a user to select an existing hash database and * Instances of this class allow a user to select an existing hash database and
@ -89,7 +90,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
String[] EXTENSION = new String[]{"txt", "kdb", "idx", "hash", "Hash", "hsh"}; //NON-NLS String[] EXTENSION = new String[]{"txt", "kdb", "idx", "hash", "Hash", "hsh"}; //NON-NLS
FileNameExtensionFilter filter = new FileNameExtensionFilter( FileNameExtensionFilter filter = new FileNameExtensionFilter(
NbBundle.getMessage(this.getClass(), "HashDbImportDatabaseDialog.fileNameExtFilter.text"), EXTENSION); NbBundle.getMessage(this.getClass(), "HashDbImportDatabaseDialog.fileNameExtFilter.text"), EXTENSION);
fileChooser.setFileFilter(filter); fileChooser.setFileFilter(filter);
fileChooser.setMultiSelectionEnabled(false); fileChooser.setMultiSelectionEnabled(false);
} }
@ -105,29 +106,28 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
} }
return shortenedPath; return shortenedPath;
} }
private void enableComponents(){ private void enableComponents() {
if (!CentralRepository.isEnabled() || !FeatureAccessUtils.canAddHashSetsToCentralRepo()) {
if(! CentralRepository.isEnabled()){
centralRepoRadioButton.setEnabled(false); centralRepoRadioButton.setEnabled(false);
fileTypeRadioButton.setSelected(true); fileTypeRadioButton.setSelected(true);
} else { } else {
populateCombobox(); populateCombobox();
} }
boolean isFileType = fileTypeRadioButton.isSelected(); boolean isFileType = fileTypeRadioButton.isSelected();
// Central repo only // Central repo only
lbVersion.setEnabled((! isFileType) && (readOnlyCheckbox.isSelected())); lbVersion.setEnabled((!isFileType) && (readOnlyCheckbox.isSelected()));
versionTextField.setEnabled((! isFileType) && (readOnlyCheckbox.isSelected())); versionTextField.setEnabled((!isFileType) && (readOnlyCheckbox.isSelected()));
lbOrg.setEnabled(! isFileType); lbOrg.setEnabled(!isFileType);
orgButton.setEnabled(! isFileType); orgButton.setEnabled(!isFileType);
orgComboBox.setEnabled(! isFileType); orgComboBox.setEnabled(!isFileType);
readOnlyCheckbox.setEnabled(! isFileType); readOnlyCheckbox.setEnabled(!isFileType);
} }
@NbBundle.Messages({"HashDbImportDatabaseDialog.populateOrgsError.message=Failure loading organizations."}) @NbBundle.Messages({"HashDbImportDatabaseDialog.populateOrgsError.message=Failure loading organizations."})
private void populateCombobox() { private void populateCombobox() {
orgComboBox.removeAllItems(); orgComboBox.removeAllItems();
@ -136,7 +136,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
orgs = dbManager.getOrganizations(); orgs = dbManager.getOrganizations();
orgs.forEach((org) -> { orgs.forEach((org) -> {
orgComboBox.addItem(org.getName()); orgComboBox.addItem(org.getName());
if(CentralRepoDbUtil.isDefaultOrg(org)){ if (CentralRepoDbUtil.isDefaultOrg(org)) {
orgComboBox.setSelectedItem(org.getName()); orgComboBox.setSelectedItem(org.getName());
selectedOrg = org; selectedOrg = org;
} }
@ -468,28 +468,28 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
if(centralRepoRadioButton.isSelected()){ if (centralRepoRadioButton.isSelected()) {
if(readOnlyCheckbox.isSelected() && versionTextField.getText().isEmpty()){ if (readOnlyCheckbox.isSelected() && versionTextField.getText().isEmpty()) {
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbImportDatabaseDialog.missingVersion"), "HashDbImportDatabaseDialog.missingVersion"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbImportDatabaseDialog.importHashDbErr"), "HashDbImportDatabaseDialog.importHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
if(selectedOrg == null){ if (selectedOrg == null) {
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbImportDatabaseDialog.missingOrg"), "HashDbImportDatabaseDialog.missingOrg"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbImportDatabaseDialog.importHashDbErr"), "HashDbImportDatabaseDialog.importHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
} }
if (selectedFilePath.isEmpty()) { if (selectedFilePath.isEmpty()) {
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
@ -500,7 +500,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
File file = new File(selectedFilePath); File file = new File(selectedFilePath);
if (!file.exists()) { if (!file.exists()) {
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
@ -523,11 +523,11 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
String errorMessage = NbBundle.getMessage(this.getClass(), "HashDbImportDatabaseDialog.unableToCopyToUserDirMsg", locationInUserConfigDir); String errorMessage = NbBundle.getMessage(this.getClass(), "HashDbImportDatabaseDialog.unableToCopyToUserDirMsg", locationInUserConfigDir);
Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, errorMessage, ex); Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, errorMessage, ex);
JOptionPane.showMessageDialog(this, errorMessage, NbBundle.getMessage(this.getClass(), "HashDbImportDatabaseDialog.importHashDbErr"), JOptionPane.showMessageDialog(this, errorMessage, NbBundle.getMessage(this.getClass(), "HashDbImportDatabaseDialog.importHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
} }
KnownFilesType type; KnownFilesType type;
if (knownRadioButton.isSelected()) { if (knownRadioButton.isSelected()) {
type = KnownFilesType.KNOWN; type = KnownFilesType.KNOWN;
@ -536,9 +536,9 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
} }
String errorMessage = NbBundle.getMessage(this.getClass(), String errorMessage = NbBundle.getMessage(this.getClass(),
"HashDbImportDatabaseDialog.errorMessage.failedToOpenHashDbMsg", "HashDbImportDatabaseDialog.errorMessage.failedToOpenHashDbMsg",
selectedFilePath); selectedFilePath);
if(fileTypeRadioButton.isSelected()){ if (fileTypeRadioButton.isSelected()) {
try { try {
selectedHashDb = HashDbManager.getInstance().addExistingHashDatabaseNoSave(hashSetNameTextField.getText(), selectedFilePath, true, sendIngestMessagesCheckbox.isSelected(), type); selectedHashDb = HashDbManager.getInstance().addExistingHashDatabaseNoSave(hashSetNameTextField.getText(), selectedFilePath, true, sendIngestMessagesCheckbox.isSelected(), type);
@ -552,19 +552,19 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
return; return;
} }
} else { } else {
// Check if a hash set with the same name/version already exists // Check if a hash set with the same name/version already exists
try{ try {
if(CentralRepository.getInstance().referenceSetExists(hashSetNameTextField.getText(), versionTextField.getText())){ if (CentralRepository.getInstance().referenceSetExists(hashSetNameTextField.getText(), versionTextField.getText())) {
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbImportDatabaseDialog.duplicateName"), "HashDbImportDatabaseDialog.duplicateName"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbImportDatabaseDialog.importHashDbErr"), "HashDbImportDatabaseDialog.importHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
} catch (CentralRepoException ex){ } catch (CentralRepoException ex) {
Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error looking up reference set", ex); Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error looking up reference set", ex);
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
@ -572,20 +572,20 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbImportDatabaseDialog.importHashDbErr"), "HashDbImportDatabaseDialog.importHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
return; return;
} }
String version; String version;
if(readOnlyCheckbox.isSelected()){ if (readOnlyCheckbox.isSelected()) {
version = versionTextField.getText(); version = versionTextField.getText();
} else { } else {
// Editable databases don't have a version // Editable databases don't have a version
version = ""; version = "";
} }
ImportCentralRepoDbProgressDialog progressDialog = new ImportCentralRepoDbProgressDialog(); ImportCentralRepoDbProgressDialog progressDialog = new ImportCentralRepoDbProgressDialog();
progressDialog.importFile(hashSetNameTextField.getText(), version, progressDialog.importFile(hashSetNameTextField.getText(), version,
selectedOrg.getOrgID(), true, sendIngestMessagesCheckbox.isSelected(), type, selectedOrg.getOrgID(), true, sendIngestMessagesCheckbox.isSelected(), type,
readOnlyCheckbox.isSelected(), selectedFilePath); readOnlyCheckbox.isSelected(), selectedFilePath);
selectedHashDb = progressDialog.getDatabase(); selectedHashDb = progressDialog.getDatabase();
} }
@ -609,11 +609,13 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
// update the combobox options // update the combobox options
if (dialog.isChanged()) { if (dialog.isChanged()) {
populateCombobox(); populateCombobox();
} }
}//GEN-LAST:event_orgButtonActionPerformed }//GEN-LAST:event_orgButtonActionPerformed
private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgComboBoxActionPerformed private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgComboBoxActionPerformed
if (null == orgComboBox.getSelectedItem()) return; if (null == orgComboBox.getSelectedItem()) {
return;
}
String orgName = this.orgComboBox.getSelectedItem().toString(); String orgName = this.orgComboBox.getSelectedItem().toString();
for (CentralRepoOrganization org : orgs) { for (CentralRepoOrganization org : orgs) {
if (org.getName().equals(orgName)) { if (org.getName().equals(orgName)) {