Apply NTFS level filters to data area creation
This commit is contained in:
@@ -1105,15 +1105,25 @@ namespace C4IT.LIAM
|
||||
}
|
||||
|
||||
public Task<ResultToken> CreateDataAreaAsync(
|
||||
string newFolderPath,
|
||||
string newFolderParent,
|
||||
IDictionary<string, string> customTags,
|
||||
IEnumerable<string> ownerSids,
|
||||
IEnumerable<string> readerSids,
|
||||
IEnumerable<string> writerSids,
|
||||
bool whatIf = false
|
||||
)
|
||||
string newFolderPath,
|
||||
string newFolderParent,
|
||||
IDictionary<string, string> customTags,
|
||||
IEnumerable<string> ownerSids,
|
||||
IEnumerable<string> readerSids,
|
||||
IEnumerable<string> writerSids,
|
||||
bool whatIf = false)
|
||||
{
|
||||
var classification = ClassifyPath(newFolderPath);
|
||||
string levelSkipReason;
|
||||
if (!IsCreateDataAreaLevelManagedPath(classification, out levelSkipReason))
|
||||
{
|
||||
return Task.FromResult(new ResultToken(System.Reflection.MethodBase.GetCurrentMethod().ToString())
|
||||
{
|
||||
resultErrorId = 30008,
|
||||
resultMessage = levelSkipReason
|
||||
});
|
||||
}
|
||||
|
||||
var engine = CreateFilesystemEngine(
|
||||
newFolderPath,
|
||||
newFolderParent,
|
||||
@@ -1456,6 +1466,15 @@ namespace C4IT.LIAM
|
||||
out skipReason);
|
||||
}
|
||||
|
||||
private bool IsCreateDataAreaLevelManagedPath(cNtfsPathClassification classification, out string skipReason)
|
||||
{
|
||||
return IsLevelManagedPath(
|
||||
classification,
|
||||
GetPermissionLevelRange(),
|
||||
"create data area",
|
||||
out skipReason);
|
||||
}
|
||||
|
||||
private bool IsTraverseLevelManagedPath(cNtfsPathClassification classification, out string skipReason)
|
||||
{
|
||||
return IsLevelManagedPath(
|
||||
@@ -1468,15 +1487,15 @@ namespace C4IT.LIAM
|
||||
private bool IsLevelManagedPath(cNtfsPathClassification classification, cNtfsLevelRange range, string operationName, out string skipReason)
|
||||
{
|
||||
skipReason = string.Empty;
|
||||
if (range == null || !range.IsConfigured)
|
||||
return true;
|
||||
|
||||
if (classification == null)
|
||||
{
|
||||
skipReason = $"NTFS {operationName} skipped because the path could not be classified.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (range == null || !range.IsConfigured)
|
||||
return true;
|
||||
|
||||
if (!range.IsValid)
|
||||
{
|
||||
skipReason = $"NTFS {operationName} skipped for '{classification.NormalizedPath}' because {range.ErrorMessage}";
|
||||
|
||||
Reference in New Issue
Block a user