Back to Node Auth0

Class RolesClient

docs/classes/management.SDK.RolesClient-2.html

5.9.16.4 KB
Original Source

Class RolesClient

Index

Constructors

constructor

Methods

listassigndelete

Properties

_options

Constructors

constructor

new RolesClient(options: BaseClientOptions): RolesClient

Parameters

Returns RolesClient

Methods

list

list(
id: string,
request?: ListUserRolesRequestParameters,
requestOptions?: RolesClient.RequestOptions,
): Promise<Page<Role, ListUserRolesOffsetPaginatedResponseContent>>

Retrieve detailed list of all user roles currently assigned to a user.

Note : This action retrieves all roles assigned to a user in the context of your whole tenant. To retrieve Organization-specific roles, use the following endpoint: Get user roles assigned to an Organization member.

Parameters

  • id: string

ID of the user to list roles for.

Request-specific configuration.

Returns Promise<Page<Role, ListUserRolesOffsetPaginatedResponseContent>>

Throws

Management.UnauthorizedError

Throws

Management.ForbiddenError

Throws

Management.TooManyRequestsError

Example

await client.users.roles.list("id", { per_page: 1, page: 1, include_totals: true })Copy

assign

assign(
id: string,
request: AssignUserRolesRequestContent,
requestOptions?: RolesClient.RequestOptions,
): HttpResponsePromise<void>

Assign one or more existing user roles to a user. For more information, review Role-Based Access Control.

Note : New roles cannot be created through this action. Additionally, this action is used to assign roles to a user in the context of your whole tenant. To assign roles in the context of a specific Organization, use the following endpoint: Assign user roles to an Organization member.

Parameters

  • id: string

ID of the user to associate roles with.

Request-specific configuration.

Returns HttpResponsePromise<void>

Throws

Management.BadRequestError

Throws

Management.UnauthorizedError

Throws

Management.ForbiddenError

Throws

Management.TooManyRequestsError

Example

await client.users.roles.assign("id", { roles: ["roles"] })Copy

delete

delete(
id: string,
request: DeleteUserRolesRequestContent,
requestOptions?: RolesClient.RequestOptions,
): HttpResponsePromise<void>

Remove one or more specified user roles assigned to a user.

Note : This action removes a role from a user in the context of your whole tenant. If you want to unassign a role from a user in the context of a specific Organization, use the following endpoint: Delete user roles from an Organization member.

Parameters

  • id: string

ID of the user to remove roles from.

Request-specific configuration.

Returns HttpResponsePromise<void>

Throws

Management.UnauthorizedError

Throws

Management.ForbiddenError

Throws

Management.TooManyRequestsError

Example

await client.users.roles.delete("id", { roles: ["roles"] })Copy

Properties

Protected Readonly_options

_options: NormalizedClientOptionsWithAuth<BaseClientOptions>

Settings

Member Visibility

  • Protected
  • Inherited

ThemeOSLightDark

On This Page

Constructors constructor Methods listassigndelete Properties _options