View Source Bonfire.Me.Users (Bonfire v0.9.10-classic-beta.169)
A User represents a visible identity within the system belonging to an Account (see Bonfire.Me.Accounts
) and having a Profile (see Bonfire.Me.Profiles
) and a Character identified by a username (see Bonfire.Me.Characters
).
Summary
Functions
Gets users by account.
Gets a user by canonical URI.
Gets a user by ID.
Gets a user by username or user ID and account ID, useful for switch-user functionality.
Gets a user by username.
Gets a user by username, raising an error if not found.
Checks if users are active.
Creates a remote user
Callback implementation for Bonfire.Federate.ActivityPub.FederationModules.federation_module/0
.
Fetches the current user by ID.
Gets the current user by ID.
Checks if a user is active.
Grants a user superpowers.
Callback implementation for Bonfire.Common.ContextModule.query_module/0
.
Revokes a user's superpowers.
Callback implementation for Bonfire.Common.ContextModule.schema_module/0
.
Searches for users.
Query for searching for users.
Updates a remote user
Types
@type changeset_extra() :: Bonfire.Data.Identity.Account.t() | :remote
@type changeset_name() :: :create
Functions
Gets users by account.
Examples
> Bonfire.Me.Users.by_account(%Bonfire.Data.Identity.Account{id: "account_id"})
[%Bonfire.Data.Identity.User{}]
> Bonfire.Me.Users.by_account!("account_id")
[%Bonfire.Data.Identity.User{}]
Gets a user by canonical URI.
Examples
> Bonfire.Me.Users.by_canonical_uri("http://example.com")
%Bonfire.Data.Identity.User{}
Gets a user by ID.
Examples
> Bonfire.Me.Users.by_id("user_id")
%Bonfire.Data.Identity.User{}
> Bonfire.Me.Users.by_id(["user_id"])
%Bonfire.Data.Identity.User{}
Gets a user by username or user ID and account ID, useful for switch-user functionality.
Will throw an error if any of the account's users is blocked instance-wide by admins.
Examples
> Bonfire.Me.Users.by_user_and_account("username", "account_id")
{:ok, %Bonfire.Data.Identity.User{}}
Gets a user by username.
Examples
> Bonfire.Me.Users.by_username("username")
%Bonfire.Data.Identity.User{}
Gets a user by username, raising an error if not found.
Examples
> Bonfire.Me.Users.by_username!("username")
%Bonfire.Data.Identity.User{}
@spec changeset( name :: changeset_name(), user :: Bonfire.Data.Identity.User.t(), params :: map(), extra :: Bonfire.Data.Identity.Account.t() | :remote ) :: Ecto.Changeset.t()
Checks if users are active.
Examples
iex> Bonfire.Me.Users.check_active([user1])
[{:ok, %Bonfire.Data.Identity.User{}}]
iex> Bonfire.Me.Users.check_active(user)
{:ok, %Bonfire.Data.Identity.User{}}
Creates a remote user
Callback implementation for Bonfire.Federate.ActivityPub.FederationModules.federation_module/0
.
Fetches the current user by ID.
Examples
> Bonfire.Me.Users.fetch_current("user_id")
%Bonfire.Data.Identity.User{}
Gets the current user by ID.
Examples
iex> Bonfire.Me.Users.get_current(nil)
nil
> Bonfire.Me.Users.get_current("user_id")
%Bonfire.Data.Identity.User{}
get_or_create_service_character(service_character_id, service_character_username)
View SourceChecks if a user is active.
Examples
> Bonfire.Me.Users.is_active?(user)
Grants a user superpowers.
Callback implementation for Bonfire.Common.ContextModule.query_module/0
.
Revokes a user's superpowers.
Callback implementation for Bonfire.Common.ContextModule.schema_module/0
.
Searches for users.
Examples
> Bonfire.Me.Users.search("username")
[%Bonfire.Data.Identity.User{}]
Query for searching for users.
Examples
> Bonfire.Me.Users.search_query("search_term")
%Ecto.Query{}
Updates a remote user