public function Roles::addPermissions in Auth0 Single Sign On 8.2
Associate permissions with a role. Required scope: "update:roles"
@link https://auth0.com/docs/api/management/v2#!/Roles/post_role_permission_as...
Parameters
string $role_id Role to ID to get permissions.:
array $permissions Permissions to add, array of permission arrays.:
Return value
mixed
Throws
EmptyOrInvalidParameterException Thrown if the role_id parameter is empty or is not a string.
InvalidPermissionsArrayException Thrown if the permissions parameter is empty or invalid.
\Exception Thrown by the HTTP client when there is a problem with the API call.
File
- vendor/
auth0/ auth0-php/ src/ API/ Management/ Roles.php, line 174
Class
- Roles
- Class Roles. Handles requests to the Roles endpoint of the v2 Management API.
Namespace
Auth0\SDK\API\ManagementCode
public function addPermissions($role_id, array $permissions) {
$this
->checkEmptyOrInvalidString($role_id, 'role_id');
$this
->checkInvalidPermissions($permissions);
$data = [
'permissions' => $permissions,
];
return $this->apiClient
->method('post')
->addPath('roles', $role_id)
->addPath('permissions')
->withBody(json_encode($data))
->call();
}