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

Fetches the current user by ID.

Gets the current user by ID.

Checks if a user is active.

Grants a user superpowers.

Revokes a user's superpowers.

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

Link to this function

ap_receive_activity(creator, activity, object)

View Source

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{}
Link to this function

by_user_and_account(username_or_user_id, account_id)

View Source

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{}}
Link to this function

by_username(username, opts \\ [])

View Source

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{}
Link to this function

changeset(name, user \\ %User{}, params, extra)

View Source
@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{}}
Link to this function

create(params_or_changeset, opts \\ [])

View Source

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{}
Link to this function

get_current(id, account_id)

View Source
Link to this function

get_only_in_account(account)

View Source
Link to this function

get_or_create_service_character(service_character_id, service_character_username)

View Source
Link to this function

ids_by_account(account_id)

View Source
Link to this function

indexing_object_format(u)

View Source

Checks if a user is active.

Examples

> Bonfire.Me.Users.is_active?(user)
Link to this function

list_boundarised_query(opts)

View Source
Link to this function

list_paginated(opts \\ [])

View Source

Grants a user superpowers.

Link to this function

make_user(attrs, account, opts \\ [])

View Source
Link to this function

maybe_count(show \\ :local)

View Source
Link to this function

maybe_index_user(object)

View Source

Callback implementation for Bonfire.Common.ContextModule.query_module/0.

Revokes a user's superpowers.

Callback implementation for Bonfire.Common.ContextModule.schema_module/0.

Link to this function

search(search, opts \\ [])

View Source

Searches for users.

Examples

> Bonfire.Me.Users.search("username")
[%Bonfire.Data.Identity.User{}]
Link to this function

search_query(search, opts \\ [])

View Source

Query for searching for users.

Examples

> Bonfire.Me.Users.search_query("search_term")
%Ecto.Query{}
Link to this function

update(user, params, extra \\ [])

View Source
Link to this function

update_local_actor(user, params)

View Source
Link to this function

update_remote_actor(user, params)

View Source

Updates a remote user