View Source Plausible.Auth (Plausible v0.0.1)

Functions for user authentication context.

Summary

Types

@type rate_limit_type() ::
  :password_change_user | :email_change_user | :login_user | :login_ip

Functions

Link to this function

check_password(user, password)

View Source
@spec check_password(Plausible.Auth.User.t(), String.t()) ::
  :ok | {:error, :wrong_password}
Link to this function

create_api_key(user, name, key)

View Source
@spec create_api_key(Plausible.Auth.User.t(), String.t(), String.t()) ::
  {:ok, Plausible.Auth.ApiKey.t()}
  | {:error, Ecto.Changeset.t() | :upgrade_required}
Link to this function

create_user(name, email, pwd)

View Source
Link to this function

delete_api_key(user, id)

View Source
@spec delete_api_key(Plausible.Auth.User.t(), integer()) :: :ok | {:error, :not_found}
Link to this function

enterprise_configured?(user)

View Source
@spec find_api_key(String.t()) ::
  {:ok, Plausible.Auth.ApiKey.t()} | {:error, :invalid_api_key}
@spec find_user_by(Keyword.t()) :: Plausible.Auth.User.t() | nil
@spec get_user_by(Keyword.t()) ::
  {:ok, Plausible.Auth.User.t()} | {:error, :user_not_found}
Link to this function

has_active_sites?(user, roles \\ [:owner, :admin, :viewer])

View Source
Link to this function

is_super_admin?(user_id)

View Source
Link to this function

rate_limit(limit_type, key)

View Source
@spec rate_limit(rate_limit_type(), Plausible.Auth.User.t() | Plug.Conn.t()) ::
  :ok | {:error, {:rate_limit, rate_limit_type()}}
@spec rate_limits() :: map()