From 42f57ed7ba3a37bbd37ac7a463e81fdc99b1ff86 Mon Sep 17 00:00:00 2001 From: Meik Date: Fri, 13 Mar 2026 23:37:47 +0100 Subject: [PATCH] Fix NTFS ensure group reuse and parent mapping --- LiamNtfs/C4IT.LIAM.Ntfs.cs | 11 ++++++++--- LiamNtfs/C4IT_IAM_SET/SecurityGroup.cs | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/LiamNtfs/C4IT.LIAM.Ntfs.cs b/LiamNtfs/C4IT.LIAM.Ntfs.cs index 5dbdb80..02e0710 100644 --- a/LiamNtfs/C4IT.LIAM.Ntfs.cs +++ b/LiamNtfs/C4IT.LIAM.Ntfs.cs @@ -267,6 +267,9 @@ namespace C4IT.LIAM ? new DirectoryInfo(classification.NormalizedPath).CreationTimeUtc.ToString("s") : DateTime.MinValue.ToString("s") }; + folderData.Level = classification.Level; + if (folderData.Parent == null && !string.IsNullOrWhiteSpace(classification.ParentPath)) + folderData.Parent = new cNtfsResultFolder() { Path = classification.ParentPath }; var parentPath = !string.IsNullOrWhiteSpace(classification.ParentPath) ? classification.ParentPath : classification.ParentBoundaryPath; @@ -1147,7 +1150,11 @@ namespace C4IT.LIAM this.Level = NtfsFolder.Level; this.DataType = eLiamDataAreaTypes.NtfsFolder; this.CreatedDate = NtfsFolder.CreatedDate; - if (ntfsParent != null) + if (!string.IsNullOrWhiteSpace(parentPathOverride)) + { + this.ParentUID = GetUniqueDataAreaID(parentPathOverride); + } + else if (ntfsParent != null) { this.ParentUID = GetUniqueDataAreaID(ntfsParent.Path); } @@ -1155,8 +1162,6 @@ namespace C4IT.LIAM { this.ParentUID = GetUniqueDataAreaID(this.Provider.RootPath); } - if (string.IsNullOrWhiteSpace(this.ParentUID) && !string.IsNullOrWhiteSpace(parentPathOverride)) - this.ParentUID = GetUniqueDataAreaID(parentPathOverride); } public static string GetUniqueDataAreaID(string fullPath) diff --git a/LiamNtfs/C4IT_IAM_SET/SecurityGroup.cs b/LiamNtfs/C4IT_IAM_SET/SecurityGroup.cs index 0026c86..89e7bd0 100644 --- a/LiamNtfs/C4IT_IAM_SET/SecurityGroup.cs +++ b/LiamNtfs/C4IT_IAM_SET/SecurityGroup.cs @@ -617,7 +617,7 @@ namespace C4IT_IAM_Engine if (existingGroup == null) existingGroup = FindGroupEntry(secGroup.Name); - if (existingGroup == null && !ForceStrictAdGroupNames) + if (existingGroup == null && !ForceStrictAdGroupNames && string.IsNullOrWhiteSpace(folderPath)) existingGroup = FindGroupEntryByWildcard(ouPath, secGroup.WildcardPattern); if (existingGroup == null)