Esempio n. 1
0
        private static ADEvent EventOnObjectCreated(ADAttributes attributes, bool isUser)
        {
            if (attributes.Contains("whencreated") && (!attributes.Contains("useraccountcontrol")))
            {
                return(new ADEvent(0, OperationType.Create, ObjectType.OU, attributes, DateTime.Now, null));
            }

            else if (attributes.Contains("whencreated") && attributes.Contains("objectclass") && isUser)
            {
                return(new ADEvent(0, OperationType.Create, ObjectType.User, attributes, DateTime.Now, null));
            }

            return(null);
        }
Esempio n. 2
0
        private static ADEvent EventOnObjectDeleted(ADAttributes attributes, bool isUser)
        {
            if (!attributes.Contains(IS_DELETED_ATTRIBUTE))
            {
                return(null);
            }

            ADSingleValueAttribute isDeleted = (ADSingleValueAttribute)attributes.GetField(IS_DELETED_ATTRIBUTE);

            if (isDeleted.Value != null && "true".Equals((string)isDeleted.Value.ToLower()))
            {
                if (isUser)
                {
                    return(new ADEvent(0, OperationType.Remove, ObjectType.User, attributes, DateTime.Now, null));
                }
                else
                {
                    return(new ADEvent(0, OperationType.Remove, ObjectType.OU, attributes, DateTime.Now, null));
                }
            }

            return(null);
        }