internal override IADOPathNode IdentitySearchConverter(object identity) { if (identity != null) { string str = identity as string; if (str != null) { string str1 = ADDomainUtil.FindDomainNCHead(str, base.CmdletSessionInfo); if (str1 != null) { return(ADOPathUtil.CreateFilterClause(ADOperator.Eq, "distinguishedName", str1)); } } SecurityIdentifier securityIdentifier = identity as SecurityIdentifier; if (securityIdentifier == null) { IADOPathNode aDOPathNode = base.IdentitySearchConverter(identity); return(aDOPathNode); } else { return(ADDomainUtil.CreateSidFilterClause(securityIdentifier)); } } else { throw new ArgumentNullException("Identity"); } }
internal override IADOPathNode IdentitySearchConverter(object identity) { if (identity != null) { if (identity as ADDefaultDomainPasswordPolicy != null) { ADDefaultDomainPasswordPolicy aDDefaultDomainPasswordPolicy = (ADDefaultDomainPasswordPolicy)identity; if (aDDefaultDomainPasswordPolicy.DistinguishedName == null) { while (identity as ADDefaultDomainPasswordPolicy != null) { identity = ((ADDefaultDomainPasswordPolicy)identity).Identity; } } else { identity = aDDefaultDomainPasswordPolicy.DistinguishedName; } } string str = identity as string; if (str != null) { string str1 = ADDomainUtil.FindDomainNCHead(str, base.CmdletSessionInfo); if (str1 != null) { return(ADOPathUtil.CreateFilterClause(ADOperator.Eq, "distinguishedName", str1)); } } SecurityIdentifier securityIdentifier = identity as SecurityIdentifier; if (securityIdentifier == null) { if (identity as string == null) { if (!(identity is Guid)) { if (identity as ADObject == null) { throw new ArgumentException(string.Format(StringResources.SearchConverterUnrecognizedObjectType, identity.GetType())); } else { ADObject aDObject = identity as ADObject; List <IADOPathNode> aDOPathNodes = new List <IADOPathNode>(2); if (!string.IsNullOrEmpty(aDObject.DistinguishedName)) { aDOPathNodes.Add(ADOPathUtil.CreateFilterClause(ADOperator.Eq, "distinguishedName", aDObject.DistinguishedName)); } Guid?objectGuid = aDObject.ObjectGuid; if (objectGuid.HasValue) { Guid?nullable = aDObject.ObjectGuid; Guid value = nullable.Value; aDOPathNodes.Add(ADOPathUtil.CreateFilterClause(ADOperator.Eq, "objectGuid", value.ToByteArray())); } if (aDOPathNodes.Count != 0) { return(ADOPathUtil.CreateAndClause(aDOPathNodes.ToArray())); } else { throw new ArgumentException(StringResources.SearchConverterIdentityAttributeNotSet); } } } else { Guid guid = (Guid)identity; return(ADOPathUtil.CreateFilterClause(ADOperator.Eq, "objectGuid", guid.ToByteArray())); } } else { Guid?nullable1 = null; if (!Utils.TryParseGuid(str, out nullable1)) { List <IADOPathNode> aDOPathNodes1 = new List <IADOPathNode>((int)ADDefaultDomainPasswordPolicyFactory <T> ._ddppIdentityLdapAttributes.Length); string[] strArrays = ADDefaultDomainPasswordPolicyFactory <T> ._ddppIdentityLdapAttributes; for (int i = 0; i < (int)strArrays.Length; i++) { string str2 = strArrays[i]; aDOPathNodes1.Add(ADOPathUtil.CreateFilterClause(ADOperator.Eq, str2, str)); } if (aDOPathNodes1.Count <= 1) { return(aDOPathNodes1[0]); } else { return(ADOPathUtil.CreateOrClause(aDOPathNodes1.ToArray())); } } else { Guid value1 = nullable1.Value; return(ADOPathUtil.CreateFilterClause(ADOperator.Eq, "objectGuid", value1.ToByteArray())); } } } else { return(ADDomainUtil.CreateSidFilterClause(securityIdentifier)); } } else { throw new ArgumentNullException("Identity"); } }