FusionAuth.Groups (FusionAuth v0.3.0) View Source

The FusionAuth.Groups module provides access methods to the FusionAuth Groups API.

All methods require a Tesla Client struct created with FusionAuth.client(base_url, api_key).

Group Fields

  • id :: String.t()

    The unique Id of this Group. If not specified a secure random UUID will be generated.

  • tenantId :: String.t()

    The tenant of which this Group belongs to.

  • name :: String.t()

    The unique name of the Group.

  • data :: map()

    An object that can hold any information about the Group that should be persisted.

  • roles :: map()

    The roles assigned to this Group. The map key is the Application Id, the value is an array of Application Roles.

Member Fields

  • id :: String.t()

    The unique Id of this Group Member. If not specified a secure random UUID will be generated.

  • userId :: String.t()

    The user of which this Group Member belongs to.

  • data :: map()

    An object that can hold any information about the Group Member that should be persisted.

  • insertInstant :: integer()

    Value represents the instant them member was created in epoch time

Examples

  iex> client = FusionAuth.client(...)
  iex> FusionAuth.Groups.get_group(client, "a4c99f4f-24d5-49bf-921f-ff80fc76b3ef")
  {
    :ok,
    %{
      "group" => %{
        "data" => %{"description" => "My First Group"},
        "id" => "a4c99f4f-24d5-49bf-921f-ff80fc76b3ef",
        "name" => "Group",
        "roles" => %{
          "861f5558-34a8-43e4-ab50-317bdcd47671" => [
            %{
              "description" => "admin",
              "id" => "3ebbc43c-7add-42cd-87b4-c6eca0438c6c",
              "isDefault" => true,
              "isSuperRole" => true,
              "name" => "admin"
            }
          ]
        },
        "tenantId" => "edad5b36-25a2-0631-3694-64ba3d39bce9"
      }
    },
    %Tesla.Env{...}
  }
  iex> FusionAuth.Groups.add_member(client, "a4c99f4f-24d5-49bf-921f-ff80fc76b3ef", "84846873-89d2-44f8-91e9-dac80f420cb2")
  {
    :ok,
    %{
      "members" => %{
        "a4c99f4f-24d5-49bf-921f-ff80fc76b3ef" => [
          %{
            "id" => "67c66607-d3ed-4073-adb2-53de8d10ac4e",
            "insertInstant" => 1591306181126,
            "userId" => "84846873-89d2-44f8-91e9-dac80f420cb2"
          }
        ]
      }
    },
    %Tesla.Env{...}
  }

Link to this section Summary

Functions

Add member to a group.

Add multiple members to a group.

For more information visit the FusionAuth API Documentation for Create a Group

For more information visit the FusionAuth API Documentation for Delete a Group

For more information visit the FusionAuth API Documentation for Retrieve a Group

For more information visit the FusionAuth API Documentation for Retrieve a Group

Remove member by member_id

Remove member by group_id and user_id

Remove members by member_ids or a group_id

Remove members by group_id and user_ids

For more information visit the FusionAuth API Documentation for Update a Group

Link to this section Types

Specs

client() :: FusionAuth.client()

Specs

group() :: %{name: String.t(), data: map()}

Specs

group_id() :: String.t()

Specs

member() :: %{userId: user_id(), data: map()}

Specs

member_id() :: String.t()

Specs

member_ids() :: [member_id()]

Specs

member_list() :: [member()]

Specs

result() :: FusionAuth.result()

Specs

role_id() :: String.t()

Specs

role_ids() :: [role_id()]

Specs

user_id() :: String.t()

Specs

user_ids() :: [user_id()]

Link to this section Functions

Link to this function

add_member(client, group_id, user_id)

View Source

Specs

add_member(client(), group_id(), user_id()) :: result()
add_member(client(), group_id(), member()) :: result()

Add member to a group.

For more information visit the FusionAuth API Documentation for Add Users to a Group

Link to this function

add_members(client, group_id, members)

View Source

Specs

add_members(client(), group_id(), member_list()) :: result()

Add multiple members to a group.

For more information visit the FusionAuth API Documentation for Add Users to a Group

Link to this function

create_group(client, group, roles_ids \\ [])

View Source

Specs

create_group(client(), group(), role_ids()) :: result()

For more information visit the FusionAuth API Documentation for Create a Group

Link to this function

delete_group(client, group_id)

View Source

Specs

delete_group(client(), group_id()) :: result()

For more information visit the FusionAuth API Documentation for Delete a Group

Link to this function

get_group(client, group_id)

View Source

Specs

get_group(client(), group_id()) :: result()

For more information visit the FusionAuth API Documentation for Retrieve a Group

Specs

get_groups(client()) :: result()

For more information visit the FusionAuth API Documentation for Retrieve a Group

Link to this function

remove_member(client, member_id)

View Source

Specs

remove_member(client(), member_id()) :: result()

Remove member by member_id

For more information visit the FusionAuth API Documentation for Remove Users from a Group

Link to this function

remove_member(client, group_id, user_id)

View Source

Specs

remove_member(client(), group_id(), user_id()) :: result()

Remove member by group_id and user_id

For more information visit the FusionAuth API Documentation for Remove Users from a Group

Link to this function

remove_members(client, member_ids)

View Source

Specs

remove_members(client(), member_ids()) :: result()
remove_members(client(), group_id()) :: result()

Remove members by member_ids or a group_id

For more information visit the FusionAuth API Documentation for Remove Users from a Group

Link to this function

remove_members(client, group_id, user_ids)

View Source

Specs

remove_members(client(), group_id(), user_ids()) :: result()

Remove members by group_id and user_ids

For more information visit the FusionAuth API Documentation for Remove Users from a Group

Link to this function

update_group(client, group_id, group, roles_ids \\ [])

View Source

Specs

update_group(client(), group_id(), group(), role_ids()) :: result()

For more information visit the FusionAuth API Documentation for Update a Group