public ADEvent GetOUParent(ADEvent anOU) { if (IsRootOU(anOU)) { return(null); } string parentCandidateDN = GetParentString(anOU); ADAttributes parentCandidateAttributes = AttributeLoader.Load(parentCandidateDN); // lookup direct parent in Active Directory; ADEvent parentCandidate = WrapInEvent(parentCandidateAttributes); // we add this check before the “fictive” check to avoid fictive flags on roots if (IsRootOU(parentCandidate)) { return(parentCandidate); } // we skip fictive parents if (IsFictive(parentCandidate)) { return(GetOUParent(parentCandidate)); } return(parentCandidate); }
public bool ShouldWeSynchronize(ADEvent anEvent) { if (anEvent.AffectedObjectType.Equals(ObjectType.OU)) { return(ShouldWeSynchronizeOU(anEvent)); } return(ShouldWeSynchronizeUser(anEvent)); }
public bool IsFictive(ADEvent anOU) { if (anOU.ADAttributes.Contains(AppConfiguration.OUAttributeFiltered) && !(anOU.ADAttributes.Attributes[AppConfiguration.OUAttributeFiltered] is ADNullValueAttribute)) { ADSingleValueAttribute filtering = (ADSingleValueAttribute)anOU.ADAttributes.Attributes[AppConfiguration.OUAttributeFiltered]; return(filtering.Value.Equals(Constants.FICTIVE)); } return(false); }
private bool ShouldWeSynchronizeUser(ADEvent user) { bool isBlocked = ADUtils.IsUserBlocked(user); if (isBlocked) { return(false); } return(true); }
private string GetParentString(ADEvent anOU) { int idx = anOU.ADAttributes.DistinguishedName.IndexOf(",OU="); if (idx < 0) { idx = anOU.ADAttributes.DistinguishedName.IndexOf(",DC="); } return(anOU.ADAttributes.DistinguishedName.Substring(idx + 1)); }
private bool ShouldWeSynchronizeOU(ADEvent ou) { bool isFictive = ADUtils.IsFictive(ou); bool isBlocked = ADUtils.IsBlocked(ou); if (isFictive || isBlocked) { return(false); } return(true); }
public bool IsRootOU(ADEvent anOU) { string dn = anOU.ADAttributes.DistinguishedName; string rootOU = AppConfiguration.RootOU; if (rootOU.ToLower().Equals(dn.ToLower())) { return(true); } return(false); }
public ADEvent GetImmediateParent(ADEvent anOU) { if (IsRootOU(anOU)) { return(null); } string parentCandidateDN = GetParentString(anOU); ADAttributes parentCandidateAttributes = AttributeLoader.Load(parentCandidateDN); // lookup direct parent in Active Directory; ADEvent parentCandidate = WrapInEvent(parentCandidateAttributes); return(parentCandidate); }
public bool IsBlocked(ADEvent anOU) { if (IsRootOU(anOU)) { return(false); // this is how this recursive method stops and returns false } else if (anOU.ADAttributes.Contains(AppConfiguration.OUAttributeFiltered) && !(anOU.ADAttributes.Attributes[AppConfiguration.OUAttributeFiltered] is ADNullValueAttribute)) { ADSingleValueAttribute filtering = (ADSingleValueAttribute)anOU.ADAttributes.Attributes[AppConfiguration.OUAttributeFiltered]; return(filtering.Value.Equals(Constants.BLOCKED)); } ADEvent parent = GetOUParent(anOU); return(IsBlocked(parent)); }
public bool IsUserFictive(ADEvent userEvent) { ADEvent parentOU = GetImmediateParent(userEvent); return(IsFictive(parentOU)); }
public bool IsUserBlocked(ADEvent userEvent) { ADEvent parentOU = GetUserParent(userEvent); return(IsBlocked(parentOU)); }