A module representing roles on Auth0.
A role is a named bundle of permissions. Grant it to a user with
Auth0Client.Management.User.assign_roles/2; there is no endpoint for removing a
user from a role on this side, so use Auth0Client.Management.User.remove_roles/2.
Summary
Functions
Assigns groups to a role
Adds permissions to a role.
Assigns users to a role
Gets all the roles
Creates a role. name is required; description is optional.
Deletes a role. Users assigned to it lose the permissions it granted.
Gets a single role
Gets the groups a role is assigned to.
Gets the permissions a role grants
Removes groups from a role
Removes permissions from a role
Updates a role's name or description
Gets the users assigned to a role.
Functions
Assigns groups to a role
iex> Auth0Client.Management.Role.add_groups("rol_abc123", ["grp_1", "grp_2"])
Adds permissions to a role.
Accepts either the documented map form or {api_identifier, permission_name}
tuples.
iex> Auth0Client.Management.Role.add_permissions("rol_abc123", [{"https://api.example.com", "read:users"}])
iex> Auth0Client.Management.Role.add_permissions("rol_abc123", [%{resource_server_identifier: "https://api.example.com", permission_name: "read:users"}])
Assigns users to a role
iex> Auth0Client.Management.Role.add_users("rol_abc123", ["auth0|user1", "auth0|user2"])
Gets all the roles
Supports name_filter to search by name, and page / per_page /
include_totals for pagination.
iex> Auth0Client.Management.Role.all()
iex> Auth0Client.Management.Role.all(name_filter: "admin", per_page: 50)
Creates a role. name is required; description is optional.
iex> Auth0Client.Management.Role.create(%{name: "admin", description: "Can do anything"})
Deletes a role. Users assigned to it lose the permissions it granted.
iex> Auth0Client.Management.Role.delete("rol_abc123")
Gets a single role
iex> Auth0Client.Management.Role.get("rol_abc123")
Gets the groups a role is assigned to.
Uses checkpoint pagination only — from and take.
iex> Auth0Client.Management.Role.groups("rol_abc123")
Gets the permissions a role grants
iex> Auth0Client.Management.Role.permissions("rol_abc123")
iex> Auth0Client.Management.Role.permissions("rol_abc123", per_page: 50)
Removes groups from a role
iex> Auth0Client.Management.Role.remove_groups("rol_abc123", ["grp_1"])
Removes permissions from a role
iex> Auth0Client.Management.Role.remove_permissions("rol_abc123", [{"https://api.example.com", "read:users"}])
Updates a role's name or description
iex> Auth0Client.Management.Role.update("rol_abc123", %{description: "Updated"})
Gets the users assigned to a role.
Supports offset pagination (page / per_page) and checkpoint pagination
(from / take). Auth0 requires checkpoint pagination past 1000 records.
iex> Auth0Client.Management.Role.users("rol_abc123")
iex> Auth0Client.Management.Role.users("rol_abc123", take: 50)