Make strict AD group names optional

This commit is contained in:
Meik
2026-03-13 14:45:06 +01:00
parent 32021dcfd8
commit 55ff17c4b4
3 changed files with 14 additions and 13 deletions

View File

@@ -23,7 +23,7 @@ namespace C4IT_IAM_Engine
public string domainName;
public string username;
public SecureString password;
public bool AllowExistingGroupWildcardMatch;
public bool ForceStrictAdGroupNames;
public List<IAM_SecurityGroup> IAM_SecurityGroups;
public string rootUID;
@@ -482,7 +482,7 @@ namespace C4IT_IAM_Engine
private void ApplyExistingGroup(IAM_SecurityGroup secGroup, DirectoryEntry existingGroup)
{
secGroup.ReusedExistingEntry = true;
secGroup.CreatedNewEntry = false;
secGroup.UID = getSID(existingGroup);
if (existingGroup.Properties.Contains("sAMAccountName") && existingGroup.Properties["sAMAccountName"].Count > 0)
@@ -544,9 +544,9 @@ namespace C4IT_IAM_Engine
LogMethodBegin(MethodBase.GetCurrentMethod());
try
{
secGroup.ReusedExistingEntry = false;
secGroup.CreatedNewEntry = false;
var existingGroup = FindGroupEntry(secGroup.Name);
if (existingGroup == null && AllowExistingGroupWildcardMatch)
if (existingGroup == null && !ForceStrictAdGroupNames)
existingGroup = FindGroupEntryByWildcard(ouPath, secGroup.WildcardPattern);
if (existingGroup == null)
@@ -572,7 +572,7 @@ namespace C4IT_IAM_Engine
LogMethodBegin(MethodBase.GetCurrentMethod());
try
{
secGroup.ReusedExistingEntry = false;
secGroup.CreatedNewEntry = false;
if (!GroupAllreadyExisting(secGroup.Name.ToUpper()))
{
@@ -609,6 +609,7 @@ namespace C4IT_IAM_Engine
var objectid = SecurityGroups.getSID(ent);
DefaultLogger.LogEntry(LogLevels.Debug, $"Security group created in ad: {secGroup.technicalName}");
secGroup.UID = objectid;
secGroup.CreatedNewEntry = true;
return ent;
}
else
@@ -686,7 +687,7 @@ namespace C4IT_IAM_Engine
public string Parent = "";
public string description;
public string WildcardPattern;
public bool ReusedExistingEntry;
public bool CreatedNewEntry;
public List<IAM_SecurityGroup> memberGroups;
public string Name;
public string technicalName;