Beispiel #1
0
        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);
        }
Beispiel #2
0
        public bool ShouldWeSynchronize(ADEvent anEvent)
        {
            if (anEvent.AffectedObjectType.Equals(ObjectType.OU))
            {
                return(ShouldWeSynchronizeOU(anEvent));
            }

            return(ShouldWeSynchronizeUser(anEvent));
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        private bool ShouldWeSynchronizeUser(ADEvent user)
        {
            bool isBlocked = ADUtils.IsUserBlocked(user);

            if (isBlocked)
            {
                return(false);
            }

            return(true);
        }
Beispiel #5
0
        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));
        }
Beispiel #6
0
        private bool ShouldWeSynchronizeOU(ADEvent ou)
        {
            bool isFictive = ADUtils.IsFictive(ou);
            bool isBlocked = ADUtils.IsBlocked(ou);

            if (isFictive || isBlocked)
            {
                return(false);
            }

            return(true);
        }
Beispiel #7
0
        public bool IsRootOU(ADEvent anOU)
        {
            string dn = anOU.ADAttributes.DistinguishedName;

            string rootOU = AppConfiguration.RootOU;

            if (rootOU.ToLower().Equals(dn.ToLower()))
            {
                return(true);
            }

            return(false);
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
        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));
        }
Beispiel #10
0
        public bool IsUserFictive(ADEvent userEvent)
        {
            ADEvent parentOU = GetImmediateParent(userEvent);

            return(IsFictive(parentOU));
        }
Beispiel #11
0
        public bool IsUserBlocked(ADEvent userEvent)
        {
            ADEvent parentOU = GetUserParent(userEvent);

            return(IsBlocked(parentOU));
        }