import type { Filter } from "../lib/modules/Lightweight-Directory-Access-Protocol-V3/Filter.ta.mjs"; import type { PartialAttributeList } from "../lib/modules/Lightweight-Directory-Access-Protocol-V3/PartialAttributeList.ta.mjs"; import type { LDAPString } from "../lib/modules/Lightweight-Directory-Access-Protocol-V3/LDAPString.ta.mjs"; import type { AttributeValue } from "../lib/modules/Lightweight-Directory-Access-Protocol-V3/AttributeValue.ta.mjs"; import type AttributeTypeAndValue from "../lib/types/AttributeTypeAndValue.mjs"; import type EqualityMatcher from "../lib/types/EqualityMatcher.mjs"; import type SubstringsMatcher from "../lib/types/SubstringsMatcher.mjs"; import type OrderingMatcher from "../lib/types/OrderingMatcher.mjs"; import type ApproxMatcher from "../lib/types/ApproxMatcher.mjs"; import type LDAPSyntaxDecoder from "../lib/types/LDAPSyntaxDecoder.mjs"; export interface EvaluateFilterOptions { /** * A function that accepts an attribute description and returns a function * that can convert the LDAP-encoding of an attribute into an equivalent * ASN.1 data type / data structure. * * @readonly * @property */ readonly getLDAPSyntaxDecoder: (ad: LDAPString) => LDAPSyntaxDecoder | undefined; /** * A function that accepts an attribute description and returns a function * that can perform an equality comparison on an asserted value against an * attribute value. * * @readonly * @property */ readonly getEqualityMatcher: (ad: LDAPString) => EqualityMatcher | undefined; /** * A function that accepts an attribute description and returns a function * that can perform a substrings matching on an asserted value against an * attribute value. * * @readonly * @property */ readonly getSubstringsMatcher: (ad: LDAPString) => SubstringsMatcher | undefined; /** * A function that accepts an attribute description and returns a function * that can perform a ordering matching on an asserted value against an * attribute value. * * @readonly * @property */ readonly getOrderingMatcher: (ad: LDAPString) => OrderingMatcher | undefined; /** * A function that accepts an attribute description and returns a function * that can perform an approximate matching on an asserted value against an * attribute value. */ readonly getApproxMatcher: (ad: LDAPString) => ApproxMatcher | undefined; /** * A function that accepts two attribute descriptions, one for an attribute * and one for a potential parent attribute type. This function returns a * `boolean` indicating whether the attribute type is a subtype of `parent`. * * @readonly * @property */ readonly isSubtype: (ad: LDAPString, parent: LDAPString) => boolean; /** * A function that accepts an attribute description and optionally an * attribute value. If only an attribute type is supplied, this function * returns a `boolean` indicating whether the user is permitted to filter * on that attribute type. If the attribute value is supplied as well, this * function returns a `boolean` indicating whether the user is permitted to * filter on that attribute type and value. * * @readonly * @property */ readonly permittedToMatch: (ad: LDAPString, value?: AttributeValue) => boolean; } /** * @summary Implementation of LDAP filtering, as specified in IETF RFC 4511. * @description * * This function filters an entry according to a `Filter` as specified in * IETF RFC 4511. * * ### Relevant ASN.1 Definitions * * ```asn1 * Filter ::= CHOICE { * and [0] SET SIZE (1..MAX) OF filter Filter, * or [1] SET SIZE (1..MAX) OF filter Filter, * not [2] Filter, * equalityMatch [3] AttributeValueAssertion, * substrings [4] SubstringFilter, * greaterOrEqual [5] AttributeValueAssertion, * lessOrEqual [6] AttributeValueAssertion, * present [7] AttributeDescription, * approxMatch [8] AttributeValueAssertion, * extensibleMatch [9] MatchingRuleAssertion, * ... * } * * SubstringFilter ::= SEQUENCE { * type AttributeDescription, * substrings * SEQUENCE SIZE (1..MAX) OF substring * CHOICE {initial [0] AssertionValue, -- can occur at most once-- * any [1] AssertionValue, * final [2] AssertionValue} -- can occur at most once * } * * MatchingRuleAssertion ::= SEQUENCE { * matchingRule [1] MatchingRuleId OPTIONAL, * type [2] AttributeDescription OPTIONAL, * matchValue [3] AssertionValue, * dnAttributes [4] BOOLEAN DEFAULT FALSE * } * ``` * * @param filter The LDAP Filter by which to filter the entry. * @param dn The distinguished name of the entry. The order of RDNs does not matter. * @param entry The attributes of the entry. * @param options Despite the name, all fields of this object are not optional. * @returns `true` if the entry matched, `false` if it does not, or `undefined` * if it could not be determined whether the entry matches or not. * @function */ export declare function evaluateFilter(filter: Filter, dn: AttributeTypeAndValue[][], entry: PartialAttributeList, options: EvaluateFilterOptions): boolean | undefined; export default evaluateFilter; //# sourceMappingURL=evaluateFilter.d.mts.map