Exemplo n.º 1
0
 /// <summary>
 /// Returns an LdapFilter for Users and contacts in a group.
 /// </summary>
 /// <param name="group">The group's Distinguished Name.</param>
 /// <returns>LdapFilter for the Users and Contacts.</returns>
 public static LdapFilter UsersContactsInGroup(DistinguishedName group) =>
 LdapFilter.And(
     new LdapFilter("objectCategory=person"),
     LdapFilter.Or(
         new LdapFilter("objectClass=contact"),
         new LdapFilter("objectClass=user")),
     new LdapFilter("memberOf", "=", $"{group}"));
Exemplo n.º 2
0
        public void Compound_Element_Or_Multiple_Filters()
        {
            // Arrange
            var expected = "(|(objectCategory=person)(objectClass=contact)(sn=Easterling))";

            var filter1 = new LdapFilter("objectCategory=person");
            var filter2 = new LdapFilter("objectClass=contact");
            var filter3 = new LdapFilter("sn=Easterling");

            // Act
            var filter = LdapFilter.Or(filter1, filter2, filter3);

            // Assert
            Assert.Equal(expected, filter.ToString());
        }