Dovetail v0.0.3 Dovetail.UserStore.PasswordFile

The Dovetail.Usertore.PasswordFile module provides a handler and functions for interacting with a dovecot password file.

Summary

Functions

Append the user to store. If a user with username already exists in the store, that users’s info will be replaced with the new user info

Decode the string or password file struct to a list of users. If attempting to decode a non-existent file, it will return an :ok tuple wrapping an empty list of users

Encode users into an iolist

Returns a new password file handler for path

Remove users with username from store

Types

t :: %Dovetail.UserStore.PasswordFile{path: String.t}

Functions

add(store, user)

Specs

add(t, Dovetail.User.username) ::
  {:ok, t} |
  {:error, term}

Append the user to store. If a user with username already exists in the store, that users’s info will be replaced with the new user info.

This function doesn’t support concurrent use for a common store path.

decode(string)

Specs

decode(String.t | t) ::
  {:ok, [Dovetail.User.t]} |
  {:error, term}

Decode the string or password file struct to a list of users. If attempting to decode a non-existent file, it will return an :ok tuple wrapping an empty list of users.

encode(users)

Specs

encode([Dovetail.User.t]) :: {:ok, iolist}

Encode users into an iolist.

encode_user(user)

Specs

encode_user(Dovetail.User.t) :: String.t
new!(path)

Specs

new!(String.t) :: t

Returns a new password file handler for path.

remove(store, username)

Specs

remove(t, Dovetail.User.username) ::
  {:ok, t} |
  {:error, term}

Remove users with username from store.