PowAssent v0.2.3 PowAssent.Ecto.UserIdentities.Context behaviour View Source
Handles pow assent user identity context for user identities.
Usage
This module will be used by PowAssent by default. If you wish to have control
over context methods, you can do configure
lib/my_project/user_identities/user_identities.ex
the following way:
defmodule MyApp.UserIdentities do
use PowAssent.Ecto.UserIdentities.Context,
repo: MyApp.Repo,
user: MyApp.Users.User
def all(user) do
pow_assent_all(user)
end
end
Remember to update configuration with
user_identities_context: MyApp.UserIdentities
.
The following Pow methods can be accessed:
pow_assent_get_user_by_provider_id/3
pow_assent_create/4
pow_assent_create_user/4
pow_assent_delete/2
pow_assent_all/1
Configuration options
:repo
- the ecto repo module (required):user
- the user schema module (required)
Link to this section Summary
Functions
Fetches all user identities for user
Creates a user identity
Creates a user with user identity
Deletes a user identity for the provider and user
Finds a user based on the provider and uid
Link to this section Types
user()
View Source
user() :: map()
user() :: map()
user_identity()
View Source
user_identity() :: map()
user_identity() :: map()
Link to this section Functions
all(user, config)
View Source
all(user(), PowAssent.Config.t()) :: [map()]
all(user(), PowAssent.Config.t()) :: [map()]
Fetches all user identities for user.
User schema module and repo module will be fetched from config.
create(user, provider, uid, config)
View Source
create(user(), binary(), binary(), PowAssent.Config.t()) ::
{:ok, user_identity()}
| {:error, {:bound_to_different_user, map()}}
| {:error, Ecto.Changeset.t()}
create(user(), binary(), binary(), PowAssent.Config.t()) :: {:ok, user_identity()} | {:error, {:bound_to_different_user, map()}} | {:error, Ecto.Changeset.t()}
Creates a user identity.
User schema module and repo module will be fetched from config.
create_user(provider, uid, params, user_id_params, config)
View Source
create_user(binary(), binary(), map(), map() | nil, PowAssent.Config.t()) ::
{:ok, map()}
| {:error,
{:bound_to_different_user | :invalid_user_id_field, Ecto.Changeset.t()}}
| {:error, Ecto.Changeset.t()}
create_user(binary(), binary(), map(), map() | nil, PowAssent.Config.t()) :: {:ok, map()} | {:error, {:bound_to_different_user | :invalid_user_id_field, Ecto.Changeset.t()}} | {:error, Ecto.Changeset.t()}
Creates a user with user identity.
User schema module and repo module will be fetched from config.
delete(user, provider, config)
View Source
delete(user(), binary(), PowAssent.Config.t()) ::
{:ok, {number(), nil}} | {:error, {:no_password, Ecto.Changeset.t()}}
delete(user(), binary(), PowAssent.Config.t()) :: {:ok, {number(), nil}} | {:error, {:no_password, Ecto.Changeset.t()}}
Deletes a user identity for the provider and user.
User schema module and repo module will be fetched from config.
get_user_by_provider_uid(provider, uid, config)
View Source
get_user_by_provider_uid(binary(), binary(), PowAssent.Config.t()) ::
user() | nil
get_user_by_provider_uid(binary(), binary(), PowAssent.Config.t()) :: user() | nil
Finds a user based on the provider and uid.
User schema module and repo module will be fetched from the config.
repo(config) View Source
user_schema_mod(config) View Source
Link to this section Callbacks
all(user) View Source
create(user, binary, binary) View Source
create_user(binary, binary, map, arg3)
View Source
create_user(binary(), binary(), map(), map() | nil) ::
{:ok, map()}
| {:error,
{:bound_to_different_user | :invalid_user_id_field, Ecto.Changeset.t()}}
| {:error, Ecto.Changeset.t()}
create_user(binary(), binary(), map(), map() | nil) :: {:ok, map()} | {:error, {:bound_to_different_user | :invalid_user_id_field, Ecto.Changeset.t()}} | {:error, Ecto.Changeset.t()}
delete(user, binary)
View Source
delete(user(), binary()) ::
{:ok, {number(), nil}} | {:error, {:no_password, Ecto.Changeset.t()}}
delete(user(), binary()) :: {:ok, {number(), nil}} | {:error, {:no_password, Ecto.Changeset.t()}}