Users stored in Sovite's database (Sovite.Core.Repo), and a
Sovite.SASL.Backend that authenticates against them.
Passwords are stored as Sovite.SASL.Password hashes; new ones are
{SCRAM-SHA-256}, so users can log in with PLAIN, LOGIN, and
SCRAM-SHA-256. Disabled users cannot log in.
Manage users with sovitectl user. Every function takes the repo
reference first; as a backend, pass it as repo: in the options.
Summary
Functions
Allows a user to send as address, see Sovite.Core.Repo.Schemas.SenderLogin.
Creates a user. The password is hashed with Sovite.SASL.Password.hash/1.
Deletes a user and their sender addresses.
Returns the user, or nil.
Lists all users, by name, with their sender addresses.
Removes a sender address from a user.
Returns the sender addresses a user may use (empty for unknown users).
Enables or disables a user.
Sets a new password.
Functions
@spec add_sender(Sovite.Core.Repo.t(), String.t(), String.t()) :: {:ok, Sovite.Core.Repo.Schemas.SenderLogin.t()} | {:error, :not_found | Ecto.Changeset.t()}
Allows a user to send as address, see Sovite.Core.Repo.Schemas.SenderLogin.
@spec create(Sovite.Core.Repo.t(), String.t(), String.t()) :: {:ok, Sovite.Core.Repo.Schemas.User.t()} | {:error, Ecto.Changeset.t()}
Creates a user. The password is hashed with Sovite.SASL.Password.hash/1.
@spec delete(Sovite.Core.Repo.t(), String.t()) :: :ok | {:error, :not_found}
Deletes a user and their sender addresses.
@spec get(Sovite.Core.Repo.t(), String.t()) :: Sovite.Core.Repo.Schemas.User.t() | nil
Returns the user, or nil.
@spec list(Sovite.Core.Repo.t()) :: [Sovite.Core.Repo.Schemas.User.t()]
Lists all users, by name, with their sender addresses.
@spec remove_sender(Sovite.Core.Repo.t(), String.t(), String.t()) :: :ok | {:error, :not_found}
Removes a sender address from a user.
@spec senders(Sovite.Core.Repo.t(), String.t()) :: [String.t()]
Returns the sender addresses a user may use (empty for unknown users).
@spec set_enabled(Sovite.Core.Repo.t(), String.t(), boolean()) :: {:ok, Sovite.Core.Repo.Schemas.User.t()} | {:error, :not_found | Ecto.Changeset.t()}
Enables or disables a user.
@spec set_password(Sovite.Core.Repo.t(), String.t(), String.t()) :: {:ok, Sovite.Core.Repo.Schemas.User.t()} | {:error, :not_found | Ecto.Changeset.t()}
Sets a new password.