Rivet.Ident.User.Lib (rivet_ident v3.5.0)

View Source

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

ecto_p_result()

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

model_p_result()

@type model_p_result() :: {:ok, Rivet.Ident.User.t()}

Functions

add_email(user, eaddr, verified \\ false)

add_phone(user, phone)

all_since(time)

check_authz(user, assertion)

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

check_user_status(user)

clean_email(eaddr)

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

get_authz(user)

@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

get_user(id, preload \\ [])

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

get_user_by_handle(id, preload \\ [])

has_other_admin?(arg1, arg2)

@spec has_other_admin?(Rivet.Ident.Role.t(), Rivet.Ident.User.t()) ::
  boolean() | {:error, String.t()}

search(map, args)

search_name!(pattern)

user_seen(user)

with_user(user, preloads, func)

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.