LDIF.Entry (LDIF v0.1.1)

View Source

LIDF.Entry provides a struct and various helper functions for working with normal LDIF/LDAP entries.

Summary

Functions

Adds a value to an attribute and returns a new Entry.

Returns the values of the named attribute.

Returns all attributes as a map.

Deletes an attribute and all its values, returning a new entry

Deletes the specified value from an attribute, returning a new entry

Returns the DN (Distinguished Name) of the entry

Returns the values of the named attribute.

Merge together all tagged attributes, returning a new Entry.

Replaces the entire DN of the entry, returning a new Entry

Replaces the RDN of the entry, returning a new entry.

Returns a normalized version of the DN (Distinguished Name) of the entry

Returns a normalized version of the RDN (Relative Distinguished Name) of the entry

Returns the RDN (Relative Distinguished Name) of the entry

Replaces all the values of the specified attribute with the provided values, returning a new Entry.

Replaces the old value the specified attribute with the new value, returning a new Entry.

Returns the superior part of the entry's DN (this is the opposite of the RDN, the tail)

Converts the entry into a simple map with atom keys.

Types

t()

@type t() :: %LDIF.Entry{attributes: map(), dn: binary()}

Functions

add(entry, attribute, values)

@spec add(entry :: t(), attribute :: binary(), values :: list()) :: t()

Adds a value to an attribute and returns a new Entry.

If an attribute is missing it will be created.

attribute(entry, attribute)

@spec attribute(entry :: t(), attribute :: binary()) :: list()

Returns the values of the named attribute.

Attribute names are strings. Values will usually be lists of strings. Empty or missing attributes will result in empty lists being returned.

attributes(entry)

@spec attributes(entry :: t()) :: map()

Returns all attributes as a map.

Attribute names (the keys) will be strings.

delete(entry, attribute)

@spec delete(entry :: t(), attribute :: binary()) :: t()

Deletes an attribute and all its values, returning a new entry

delete(entry, attribute, value)

@spec delete(entry :: t(), attribute :: binary(), value :: binary()) :: t()

Deletes the specified value from an attribute, returning a new entry

dn(entry)

@spec dn(entry :: t()) :: binary()

Returns the DN (Distinguished Name) of the entry

get(entry, attribute)

@spec get(entry :: t(), attribute :: binary()) :: list() | nil

Returns the values of the named attribute.

Attribute names are strings. Values will usually be lists of strings. Missing attributes will result in a nil being returned.

merge_tagged(entry)

@spec merge_tagged(entry :: t()) :: t()

Merge together all tagged attributes, returning a new Entry.

moddn(entry, dn)

@spec moddn(entry :: t(), dn :: binary()) :: t()

Replaces the entire DN of the entry, returning a new Entry

modrdn(entry, rdn)

@spec modrdn(entry :: t(), rdn :: binary()) :: t()

Replaces the RDN of the entry, returning a new entry.

ndn(entry)

@spec ndn(entry :: t()) :: binary()

Returns a normalized version of the DN (Distinguished Name) of the entry

nrdn(entry)

@spec nrdn(entry :: t()) :: binary()

Returns a normalized version of the RDN (Relative Distinguished Name) of the entry

rdn(entry)

@spec rdn(entry :: t()) :: binary()

Returns the RDN (Relative Distinguished Name) of the entry

replace(entry, attribute, values)

@spec replace(entry :: t(), attribute :: binary(), values :: list()) :: t()

Replaces all the values of the specified attribute with the provided values, returning a new Entry.

replace(entry, attribute, old_value, new_value)

@spec replace(
  entry :: t(),
  attribute :: binary(),
  old_value :: binary(),
  new_value :: binary()
) :: t()

Replaces the old value the specified attribute with the new value, returning a new Entry.

superior(entry)

@spec superior(entry :: t()) :: binary()

Returns the superior part of the entry's DN (this is the opposite of the RDN, the tail)

to_map(entry, opts \\ [])

@spec to_map(entry :: t(), opts :: keyword()) :: map()

Converts the entry into a simple map with atom keys.

You may provide your own custom mapping for keys using the :attr_map option.