Exldap Update v0.1.0 Exldap.Update
A module for adding / updating information in LDAP from Elixir via Exldap
Link to this section Summary
Functions
Add an entry. The entry must not exist. Attributes can be supplied either as a map or a keyword list, with either atoms or strings as keys.
Delete an entry.
Modify an entry.
Link to this section Types
Link to this section Functions
Link to this function
add(connection, dn, attrs)
add(pid(), distinguished_name(), map() | [keyword()]) :: return_value()
Add an entry. The entry must not exist. Attributes can be supplied either as a map or a keyword list, with either atoms or strings as keys.
Examples:
iex> Exldap.Update.add(
...> connection,
...> "CN=someUser,OU=Accounts,DC=example,DC=com",
...> %{objectClass: ["person", "top"], sn: "User", cn: "someUser"}
...> )
:ok
iex> Exldap.Update.add(
...> connection,
...> "CN=someUser,OU=Accounts,DC=example,DC=com",
...> [{"objectClass", "top"}, objectClass: "person", sn: "User", cn: "someUser"]
...> )
:ok
Delete an entry.
Example:
iex> Exldap.Update.delete(connection, "CN=someUser,OU=Accounts,DC=example,DC=com")
:ok
iex> Exldap.Update.delete(connection, "CN=someUser,OU=Accounts,DC=example,DC=com")
{:error, :noSuchObject}
Link to this function
mod_replace(type, values)
Link to this function
modify(connection, dn, ops)
modify(pid(), distinguished_name(), modify_op() | [modify_op()]) :: return_value()
Modify an entry.
Examples:
# Single modification
iex> Exldap.Update.modify(
...> connection,
...> "CN=someUser,OU=Accounts,DC=example,DC=com",
...> Exldap.Update.mod_add("displayName", "Some User")
...> )
:ok
# Multiple modifications
iex> Exldap.Update.modify(
...> connection,
...> "CN=someUser,OU=Accounts,DC=example,DC=com",
...> [
...> Exldap.Update.mod_add("mail", ["someuser@example.com", "some.user@example.com"]),
...> Exldap.Update.mod_delete("displayName", "Some User")
...> ]
...> )
:ok
# Flat form
iex> Exldap.Update.modify(
...> connection,
...> "CN=someUser,OU=Accounts,DC=example,DC=com",
...> {:add, :displayName, "Some User"}
...> )
:ok
iex> Exldap.Update.modify(
...> connection,
...> "CN=someUser,OU=Accounts,DC=example,DC=com",
...> [
...> {:add, :mail, ["someuser@example.com", "some.user@example.com"]},
...> {:delete, :displayName, "Some User"}
...> ]
...> )
:ok