Class: ROM::LDAP::ExpressionEncoder Private

Inherits:
Object
  • Object
show all
Extended by:
Initializer
Defined in:
lib/rom/ldap/expression_encoder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Used in ROM::LDAP::Expression#to_ber.

Filter ::=
    CHOICE {
        and             [0] SET OF Filter,
        or              [1] SET OF Filter,
        not             [2] Filter,
        equalityMatch   [3] AttributeValueAssertion,
        substrings      [4] SubstringFilter,
        greaterOrEqual  [5] AttributeValueAssertion,
        lessOrEqual     [6] AttributeValueAssertion,
        present         [7] AttributeType,
        approxMatch     [8] AttributeValueAssertion,
        extensibleMatch [9] MatchingRuleAssertion
    }

SubstringFilter ::=
    SEQUENCE {
        type               AttributeType,
        SEQUENCE OF CHOICE {
            initial        [0] LDAPString,
            any            [1] LDAPString,
            final          [2] LDAPString
        }
    }

MatchingRuleAssertion ::=
    SEQUENCE {
      matchingRule    [1] MatchingRuleId OPTIONAL,
      type            [2] AttributeDescription OPTIONAL,
      matchValue      [3] AssertionValue,
      dnAttributes    [4] BOOLEAN DEFAULT FALSE
    }

Matching Rule Suffixes
    Less than   [.1] or .[lt]
    Less than or equal to  [.2] or [.lte]
    Equality  [.3] or  [.eq] (default)
    Greater than or equal to  [.4] or [.gte]
    Greater than  [.5] or [.gt]
    Substring  [.6] or  [.sub]

Instance Method Summary collapse

Instance Method Details

#callBER

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (BER)


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/rom/ldap/expression_encoder.rb', line 63

def call
  case op
  when :op_eql
    if value == WILDCARD
      field.to_s.to_ber_contextspecific(7)
    elsif /[*]/.match?(value.to_s) # substring
      substring
    else
      to_context(3)
    end
  when :op_bineq
    [
      field.to_s.to_ber,
      unescape(value).to_ber_bin
    ].to_ber_contextspecific(3)
  when :op_ext
    extensible
  when :op_gte
    to_context(5)
  when :op_lte
    to_context(6)
  when :op_prx
    to_context(8)
  when :con_and
    exps.map(&:to_ber).to_ber_contextspecific(0)
  when :con_or
    exps.map(&:to_ber).to_ber_contextspecific(1)
  when :con_not
    exps.map(&:to_ber).to_ber_contextspecific(2)
  end
end