Auth0Client.Management.Group (auth0_client v1.1.0)

Copy Markdown View Source

A module representing group resource.

Groups carry roles, and a user in a group inherits them — which is why Auth0Client.Management.User.effective_role_source_groups/2 can name a group as the reason a user holds a role. This module is the other end of that answer.

Groups are not created through the Management API. They come from the identity provider, selected by Auth0Client.Management.Connection.DirectoryProvisioning.replace_synchronized_groups/2, so there is no create/1 here. delete/1 drops a synced group from the tenant.

The role side of the same relationship is Auth0Client.Management.Role.groups/2, add_groups/2 and remove_groups/2.

Summary

Functions

Assigns roles to a group

Gets all the groups

Deletes a group

Gets a group

Lists the users in a group

Removes roles from a group

Lists the roles assigned to a group

Functions

add_roles(id, role_ids)

Assigns roles to a group

Grants them to every current and future member. Returns :ok; Auth0 answers 204 with no body.

iex> Auth0Client.Management.Group.add_roles("grp_abc123", ["rol_1", "rol_2"])

all(params \\ %{})

Gets all the groups

Filters on connection_id, name, external_id and search. Supports offset pagination (page, per_page, include_totals) and checkpoint pagination (from, take).

iex> Auth0Client.Management.Group.all()
iex> Auth0Client.Management.Group.all(connection_id: "con_abc123")
iex> Auth0Client.Management.Group.all(%{search: "engineering", take: 50})

delete(id)

Deletes a group

Removes it from the tenant. If the connection still synchronizes it, the next run brings it back — stop selecting it with Auth0Client.Management.Connection.DirectoryProvisioning.replace_synchronized_groups/2 first.

iex> Auth0Client.Management.Group.delete("grp_abc123")

get(id)

Gets a group

iex> Auth0Client.Management.Group.get("grp_abc123")

members(id, params \\ %{})

Lists the users in a group

Uses checkpoint pagination — from and take.

iex> Auth0Client.Management.Group.members("grp_abc123")
iex> Auth0Client.Management.Group.members("grp_abc123", take: 50)

remove_roles(id, role_ids)

Removes roles from a group

Sends the role ids in the body of the DELETE, which is what Auth0 documents.

iex> Auth0Client.Management.Group.remove_roles("grp_abc123", ["rol_1"])

roles(id, params \\ %{})

Lists the roles assigned to a group

Every member of the group inherits these. The mirror of Auth0Client.Management.Role.groups/2.

Uses checkpoint pagination — from and take.

iex> Auth0Client.Management.Group.roles("grp_abc123")