Rivet.Ident.User.Lib (rivet_ident v3.5.0)
View SourceSummary
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
@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
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
@spec has_other_admin?(Rivet.Ident.Role.t(), Rivet.Ident.User.t()) :: boolean() | {:error, String.t()}
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.