mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 16:36:15 +00:00
Data source deletion support changes
This commit is contained in:
parent
5a8e401723
commit
a52786d3fc
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.casemodule;
|
package org.sleuthkit.autopsy.casemodule;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.featureaccess.AccessLimiterUtils;
|
import org.sleuthkit.autopsy.featureaccess.UserFeatureAccessUtils;
|
||||||
import com.google.common.annotations.Beta;
|
import com.google.common.annotations.Beta;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import org.sleuthkit.autopsy.casemodule.multiusercases.CaseNodeData;
|
import org.sleuthkit.autopsy.casemodule.multiusercases.CaseNodeData;
|
||||||
@ -1089,7 +1089,7 @@ public class Case {
|
|||||||
/*
|
/*
|
||||||
* Enable the case-specific actions.
|
* Enable the case-specific actions.
|
||||||
*/
|
*/
|
||||||
CallableSystemAction.get(AddImageAction.class).setEnabled(Case.getCurrentCase().getMetadata().getCaseType() == CaseType.SINGLE_USER_CASE || !AccessLimiterUtils.limitMultiUserAccess());
|
CallableSystemAction.get(AddImageAction.class).setEnabled(Case.getCurrentCase().getMetadata().getCaseType() == CaseType.SINGLE_USER_CASE || UserFeatureAccessUtils.canCreateOrModifyMultiUserCases());
|
||||||
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
|
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
|
||||||
CallableSystemAction.get(CaseDetailsAction.class).setEnabled(true);
|
CallableSystemAction.get(CaseDetailsAction.class).setEnabled(true);
|
||||||
CallableSystemAction.get(DataSourceSummaryAction.class).setEnabled(true);
|
CallableSystemAction.get(DataSourceSummaryAction.class).setEnabled(true);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.casemodule;
|
package org.sleuthkit.autopsy.casemodule;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.featureaccess.AccessLimiterUtils;
|
import org.sleuthkit.autopsy.featureaccess.UserFeatureAccessUtils;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
|
|||||||
*/
|
*/
|
||||||
void readSettings() {
|
void readSettings() {
|
||||||
caseNameTextField.setText("");
|
caseNameTextField.setText("");
|
||||||
if (UserPreferences.getIsMultiUserModeEnabled() && !AccessLimiterUtils.limitMultiUserAccess()) {
|
if (UserPreferences.getIsMultiUserModeEnabled() && UserFeatureAccessUtils.canCreateOrModifyMultiUserCases()) {
|
||||||
multiUserCaseRadioButton.setEnabled(true);
|
multiUserCaseRadioButton.setEnabled(true);
|
||||||
multiUserCaseRadioButton.setSelected(true);
|
multiUserCaseRadioButton.setSelected(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,7 +33,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
import org.openide.nodes.Sheet;
|
import org.openide.nodes.Sheet;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.sleuthkit.autopsy.featureaccess.AccessLimiterUtils;
|
import org.sleuthkit.autopsy.featureaccess.UserFeatureAccessUtils;
|
||||||
import org.sleuthkit.autopsy.casemodule.DeleteDataSourceAction;
|
import org.sleuthkit.autopsy.casemodule.DeleteDataSourceAction;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
@ -220,8 +220,8 @@ public class ImageNode extends AbstractContentNode<Image> {
|
|||||||
private Boolean canAddDeleteDataSourceAction() {
|
private Boolean canAddDeleteDataSourceAction() {
|
||||||
boolean canAddAction = false;
|
boolean canAddAction = false;
|
||||||
CaseDbSchemaVersionNumber creationVersion = Case.getCurrentCase().getSleuthkitCase().getDBSchemaCreationVersion();
|
CaseDbSchemaVersionNumber creationVersion = Case.getCurrentCase().getSleuthkitCase().getDBSchemaCreationVersion();
|
||||||
if ((creationVersion.getMajor() == 8 && creationVersion.getMinor() >= 3) || (creationVersion.getMajor() > 8)) {
|
if ((creationVersion.getMajor() == 8 && creationVersion.getMinor() >= 4) || (creationVersion.getMajor() > 8)) {
|
||||||
canAddAction = Case.getCurrentCase().getCaseType() == Case.CaseType.SINGLE_USER_CASE || !AccessLimiterUtils.limitMultiUserAccess();
|
canAddAction = Case.getCurrentCase().getCaseType() == Case.CaseType.SINGLE_USER_CASE || UserFeatureAccessUtils.canCreateOrModifyMultiUserCases();
|
||||||
}
|
}
|
||||||
return canAddAction;
|
return canAddAction;
|
||||||
}
|
}
|
||||||
|
@ -23,27 +23,28 @@ import java.nio.file.Paths;
|
|||||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for methods to check if access should be limited to a feature
|
* Check if access to various features is permitted for the current user.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
final public class AccessLimiterUtils {
|
final public class UserFeatureAccessUtils {
|
||||||
|
|
||||||
private final static String MULTI_USER_ACCESS_FILE_NAME = "mualimit"; // NON-NLS
|
private final static String MULTI_USER_ACCESS_FILE_NAME = "mualimit"; // NON-NLS
|
||||||
private final static String MULTI_USER_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), MULTI_USER_ACCESS_FILE_NAME).toString();
|
private final static String MULTI_USER_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), MULTI_USER_ACCESS_FILE_NAME).toString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if privileges regarding multi-user cases should be restricted.
|
* Indicates whether or not the current user is allowed to create or modify
|
||||||
|
* (add or delete data sourcess) multi-user cases.
|
||||||
*
|
*
|
||||||
* @return True if privileges should be restricted, false otherwise.
|
* @return True if privileges should be restricted, false otherwise.
|
||||||
*/
|
*/
|
||||||
public static boolean limitMultiUserAccess() {
|
public static boolean canCreateOrModifyMultiUserCases() {
|
||||||
return new File(MULTI_USER_ACCESS_FILE_PATH).exists();
|
File accessLimitingFile = new File(MULTI_USER_ACCESS_FILE_PATH);
|
||||||
|
return !accessLimitingFile.exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private constructor for a utility class
|
* Private constructor to prevent instatiation of this utility class.
|
||||||
*/
|
*/
|
||||||
private AccessLimiterUtils() {
|
private UserFeatureAccessUtils() {
|
||||||
//private constructer left empty intentionally
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user