Merge pull request #5693 from rcordovano/5790-delete-multiuser-case-restriction

5790 delete multiuser case restriction
This commit is contained in:
Richard Cordovano 2020-03-10 16:56:00 -04:00 committed by GitHub
commit dd03573103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 7 deletions

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012-2019 Basis Technology Corp.
* Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -1114,7 +1114,7 @@ public class Case {
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
CallableSystemAction.get(CaseDetailsAction.class).setEnabled(true);
CallableSystemAction.get(DataSourceSummaryAction.class).setEnabled(true);
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(true);
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(FeatureAccessUtils.canDeleteCurrentCase());
CallableSystemAction.get(OpenTimelineAction.class).setEnabled(true);
CallableSystemAction.get(OpenCommVisualizationToolAction.class).setEnabled(true);
CallableSystemAction.get(CommonAttributeSearchAction.class).setEnabled(true);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -35,6 +35,7 @@ import org.openide.util.NbBundle.Messages;
import org.openide.util.actions.CallableSystemAction;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.featureaccess.FeatureAccessUtils;
/**
* The action associated with the Delete button of the Case Properties panel. It
@ -54,7 +55,7 @@ final class CaseDeleteAction extends CallableSystemAction {
/*
* A value of 'null' signifies that there is no case open.
*/
setEnabled(null != evt.getNewValue());
setEnabled(null != evt.getNewValue() && FeatureAccessUtils.canDeleteCurrentCase());
});
}

View File

@ -73,6 +73,15 @@ final public class FeatureAccessUtils {
return dataSourceDeletionAllowed;
}
/**
* Indicates whether or not a user can delete the current case.
*
* @return True or false.
*/
public static boolean canDeleteCurrentCase() {
return currentCaseIsSingleUserCase() || multiUserCaseRestrictionsFileAbsent();
}
/**
* Indicates whether or not the current case is a single-user case.
*
@ -83,12 +92,12 @@ final public class FeatureAccessUtils {
}
/**
* Indicates whether or not the current user is allowed to create or modify
* (add or delete data sources) multi-user cases.
* Indicates whether or not the multi-user case privileges restriction file
* is absent.
*
* @return True or false.
*/
public static boolean multiUserCaseRestrictionsFileAbsent() {
private static boolean multiUserCaseRestrictionsFileAbsent() {
File accessLimitingFile = new File(MULTIUSER_CASE_RESTRICTED_FILE_PATH);
return !accessLimitingFile.exists();
}