diff --git a/LiamNtfs/C4IT.LIAM.Ntfs.cs b/LiamNtfs/C4IT.LIAM.Ntfs.cs index 7e4d0e7..a925db9 100644 --- a/LiamNtfs/C4IT.LIAM.Ntfs.cs +++ b/LiamNtfs/C4IT.LIAM.Ntfs.cs @@ -1101,11 +1101,24 @@ namespace C4IT.LIAM private IEnumerable BuildSecurityGroupTemplates() { var templates = new List(); - foreach (var namingConvention in NamingConventions ?? Enumerable.Empty()) + var namingConventions = (NamingConventions ?? Enumerable.Empty()).ToList(); + var hasStrategyMatchingTraverseConvention = namingConventions.Any(i => + TryMapSecurityGroupType(i.AccessRole, out var securityGroupType) + && securityGroupType == SecurityGroupType.Traverse + && IsStrategyMatchingTraverseScope(i.Scope)); + + foreach (var namingConvention in namingConventions) { if (!TryMapSecurityGroupType(namingConvention.AccessRole, out var securityGroupType)) continue; + if (securityGroupType == SecurityGroupType.Traverse + && hasStrategyMatchingTraverseConvention + && !IsStrategyMatchingTraverseScope(namingConvention.Scope)) + { + continue; + } + if (!TryMapGroupScope(namingConvention.Scope, securityGroupType, out var groupScope)) continue; @@ -1145,6 +1158,12 @@ namespace C4IT.LIAM private bool TryMapGroupScope(eLiamAccessRoleScopes scope, SecurityGroupType type, out GroupScope groupScope) { groupScope = GroupScope.Global; + if (type == SecurityGroupType.Traverse) + { + groupScope = GetStrategyTraverseGroupScope(); + return true; + } + switch (scope) { case eLiamAccessRoleScopes.Global: @@ -1154,17 +1173,30 @@ namespace C4IT.LIAM groupScope = GroupScope.Local; return true; case eLiamAccessRoleScopes.Unknown: - if (type == SecurityGroupType.Traverse) - { - groupScope = this.GroupStrategy == eLiamGroupStrategies.Ntfs_AGDLP ? GroupScope.Local : GroupScope.Global; - return true; - } return false; default: return false; } } + private GroupScope GetStrategyTraverseGroupScope() + { + return this.GroupStrategy == eLiamGroupStrategies.Ntfs_AGDLP + ? GroupScope.Local + : GroupScope.Global; + } + + private bool IsStrategyMatchingTraverseScope(eLiamAccessRoleScopes scope) + { + if (scope == eLiamAccessRoleScopes.Unknown) + return true; + + var strategyScope = GetStrategyTraverseGroupScope(); + return strategyScope == GroupScope.Local + ? scope == eLiamAccessRoleScopes.DomainLocal + : scope == eLiamAccessRoleScopes.Global; + } + private string GetRequiredCustomTag(string key) { if (CustomTags.TryGetValue(key, out var value) && !string.IsNullOrWhiteSpace(value)) diff --git a/Sonstiges/LIAM_NTFS_AdditionalConfiguration_BlackWhitelist_Konzept.md b/Sonstiges/LIAM_NTFS_AdditionalConfiguration_BlackWhitelist_Konzept.md index f7de10a..a2b9c7b 100644 --- a/Sonstiges/LIAM_NTFS_AdditionalConfiguration_BlackWhitelist_Konzept.md +++ b/Sonstiges/LIAM_NTFS_AdditionalConfiguration_BlackWhitelist_Konzept.md @@ -182,6 +182,13 @@ ACL_G_FILE_SHARES_SHARE2_T Wenn das Traverse-`NamingTemplate` leer ist, ist das kein Fehler. Es wird dann keine neue Traverse-Gruppe angelegt. Bestehende Gruppen werden aber weiterhin ueber ACLs und, sofern gepflegt, ueber `Wildcard` gesucht und konfiguriert. Sind `NamingTemplate` und `Wildcard` leer, ist die Traverse-Verarbeitung fuer diesen Parent ein No-op. +Der Scope von Traverse-Gruppen wird aus der NTFS-Gruppenstrategie abgeleitet: + +- `Ntfs_AGP`: Traverse-Gruppen werden als Global-Gruppen erstellt +- `Ntfs_AGDLP`: Traverse-Gruppen werden als DomainLocal-Gruppen erstellt + +Wenn mehrere Traverse-Naming-Conventions vorhanden sind, wird die zur Strategie passende Konvention bevorzugt. Ist keine passende Konvention vorhanden, wird die vorhandene Traverse-Konvention weiterverwendet, der Scope aber trotzdem strategy-driven gesetzt. + ### 10. Root-Path-Platzhalter Naming Conventions koennen zusaetzlich Bestandteile des konfigurierten `RootPath` verwenden. Die Platzhalter funktionieren in `NamingTemplate`, `DescriptionTemplate` und `Wildcard`.