Auth0-PHP

RolesInterface
in

Interface RolesInterface.

Table of Contents

addPermissions()  : ResponseInterface
Associate permissions with a role.
addUsers()  : ResponseInterface
Add one or more users to a role.
create()  : ResponseInterface
Create a new Role.
delete()  : ResponseInterface
Delete a single Role by ID.
get()  : ResponseInterface
Get a single Role by ID.
getAll()  : ResponseInterface
Get all Roles Required scope: `read:roles`.
getPermissions()  : ResponseInterface
Get the permissions associated to a role.
getUsers()  : ResponseInterface
Get users assigned to a specific role.
removePermissions()  : ResponseInterface
Delete permissions from a role.
update()  : ResponseInterface
Update a Role by ID.

Methods

addPermissions()

Associate permissions with a role.

public addPermissions(string $id, array<string|int, mixed> $permissions[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:roles.

Parameters
$id : string

role ID to get permissions

$permissions : array<string|int, mixed>
$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
ArgumentException

when an invalid id or permissions are provided

throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/post_role_permission_assignment
Return values
ResponseInterface

addUsers()

Add one or more users to a role.

public addUsers(string $id, array<string|int, string> $users[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:roles.

Parameters
$id : string

role ID to add users

$users : array<string|int, string>

array of user IDs to add to the role

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
ArgumentException

when an invalid id or users are provided

throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/post_role_users
Return values
ResponseInterface

create()

Create a new Role.

public create(string $name[, array<string|int, mixed>|null $body = null ][, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: create:roles.

Parameters
$name : string

role name

$body : array<string|int, mixed>|null = null

Optional. Additional body content to pass with the API request. See @see for supported options.

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
ArgumentException

when an invalid name is provided

throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/post_roles
Return values
ResponseInterface

delete()

Delete a single Role by ID.

public delete(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: delete:roles.

Parameters
$id : string

role ID to delete

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
ArgumentException

when an invalid id is provided

throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/delete_roles_by_id
Return values
ResponseInterface

get()

Get a single Role by ID.

public get(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: read:roles.

Parameters
$id : string

role ID to get

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
ArgumentException

when an invalid id is provided

throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/get_roles_by_id
Return values
ResponseInterface

getAll()

Get all Roles Required scope: `read:roles`.

public getAll([array<string|int, int|string|null>|null $parameters = null ][, RequestOptions|null $options = null ]) : ResponseInterface
Parameters
$parameters : array<string|int, int|string|null>|null = null

Optional. Query parameters to pass with the API request. See @see for supported options.

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/get_roles
Return values
ResponseInterface

getPermissions()

Get the permissions associated to a role.

public getPermissions(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: read:roles.

Parameters
$id : string

role ID to get permissions

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
ArgumentException

when an invalid id is provided

throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/get_role_permission
Return values
ResponseInterface

getUsers()

Get users assigned to a specific role.

public getUsers(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scopes:

  • read:roles
  • read:users.
Parameters
$id : string

role ID assigned to users

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
ArgumentException

when an invalid id is provided

throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/get_role_user
Return values
ResponseInterface

removePermissions()

Delete permissions from a role.

public removePermissions(string $id, array<string|int, mixed> $permissions[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:roles.

Parameters
$id : string

role ID to get permissions

$permissions : array<string|int, mixed>
$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
ArgumentException

when an invalid id or permissions are provided

throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/delete_role_permission_assignment
Return values
ResponseInterface

update()

Update a Role by ID.

public update(string $id, array<string|int, mixed> $body[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:roles.

Parameters
$id : string

role ID update

$body : array<string|int, mixed>

Additional body content to pass with the API request. See @see for supported options.

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Tags
throws
ArgumentException

when an invalid id or body are provided

throws
NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/management/v2#!/Roles/patch_roles_by_id
Return values
ResponseInterface

Search results