Module: Another::Ldap::Proxy::EntryConverter

Defined in:
lib/another/ldap/proxy/entry_converter.rb

Constant Summary collapse

NORMALIZED_ATTRIBUTE =
{
  'objectclass' => 'objectClass',
  'memberof' => 'memberOf'
}.freeze

Class Method Summary collapse

Class Method Details

.from_client_to_server(entry) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/another/ldap/proxy/entry_converter.rb', line 12

def self.from_client_to_server(entry)
  dn = entry.dn
  attributes = {}

  entry.each do |attribute, value|
    next if attribute.to_s == 'dn'

    attribute = normalize_attribute(attribute)
    attributes[attribute] = value
  end

  [dn, attributes]
end

.normalize_attribute(attribute) ⇒ Object



26
27
28
29
# File 'lib/another/ldap/proxy/entry_converter.rb', line 26

def self.normalize_attribute(attribute)
  attribute = attribute.to_s
  NORMALIZED_ATTRIBUTE.fetch(attribute, attribute)
end