View Source Rivet.Ident.User.Lib (rivet_ident v3.1.1)

Summary

Functions

iex> clean_email(" narf@narf.com.") "narf@narf.com"

Bring in the list of authorized actions onto the user object (into :authz)

iex> get_user("asdf")

Helper function which accepts either user_id or user, and calls the passed function with the user model loaded including any preloads. Send preloads as [] if none are desired.

Types

@type ecto_p_result() :: {:ok | :error, Ecto.Changeset.t()}
@type model_p_result() :: {:ok, Rivet.Ident.User.t()}

Functions

Link to this function

add_email(user, eaddr, verified \\ false)

View Source
Link to this function

check_authz(user, assertion)

View Source
@spec check_authz(user :: Rivet.Ident.User.t(), Rivet.Auth.Assertion.t()) ::
  {:ok | :error, Rivet.Ident.User.t()}

iex> clean_email(" narf@narf.com.") "narf@narf.com"

@spec get_authz(user :: Rivet.Ident.User.t()) :: Rivet.Ident.User.t()

Bring in the list of authorized actions onto the user object (into :authz)

Only load once, if authz is nil

Link to this function

get_user(id, preload \\ [])

View Source

iex> get_user("asdf")

iex> get_user("A73DD874-A724-494F-B9E2-2042A4383144")

iex> handle = insert(:ident_handle) ...> {:ok, u} = get_user(handle.user_id) ...> u.id handle.user_id

iex> handle = insert(:ident_handle) ...> {:ok, u} = get_user(handle.handle, [:handle]) ...> u.id handle.user_id

Link to this function

get_user_by_handle(id, preload \\ [])

View Source
Link to this function

has_other_admin?(arg1, arg2)

View Source
@spec has_other_admin?(Rivet.Ident.Role.t(), Rivet.Ident.User.t()) ::
  boolean() | {:error, String.t()}
Link to this function

with_user(user, preloads, func)

View Source

Helper function which accepts either user_id or user, and calls the passed function with the user model loaded including any preloads. Send preloads as [] if none are desired.