You are here

public function Users::removePermissions in Auth0 Single Sign On 8.2

Remove one or more permissions from a specific user. Required scope: "update:users"

@link https://auth0.com/docs/api/management/v2#!/Users/delete_permissions

Parameters

string $user_id User ID to remove permissions from.:

array $permissions Array of permissions to remove.:

Return value

mixed

Throws

EmptyOrInvalidParameterException Thrown if the user_id parameter is empty or is not a string.

InvalidPermissionsArrayException Thrown if the permissions parameter is malformed.

\Exception Thrown by the HTTP client when there is a problem with the API call.

File

vendor/auth0/auth0-php/src/API/Management/Users.php, line 403

Class

Users
Class Users. Handles requests to the Users endpoint of the v2 Management API.

Namespace

Auth0\SDK\API\Management

Code

public function removePermissions($user_id, array $permissions) {
  $this
    ->checkEmptyOrInvalidString($user_id, 'user_id');
  $this
    ->checkInvalidPermissions($permissions);
  $data = [
    'permissions' => $permissions,
  ];
  return $this->apiClient
    ->method('delete')
    ->addPath('users', $user_id)
    ->addPath('permissions')
    ->withBody(json_encode($data))
    ->call();
}