Skip to main content
Version: 2.0.0

updateRole

Update an existing role.

Parameters

roleId - The ID of the role. This can also be the role key.
role - An object that contains the information about the new role. The payload is defined below.

Payload

name - The name of the role.
description - optional - The description string explaining what this role represents, or what permissions are granted to it.
permissions - optional - The list of action keys that define what actions this resource role is permitted to do.
extends - optional - The list of role keys that define what roles this role extends. In other words: this role will automatically inherit all the permissions of the given roles in this list.

{
name: "Editor",
description: "the editor role can read and write to documents",
permissions: ["document:write"],
extends: []
}

Implementation

const response = await permit.api.updateRole(roleId, JSON.stringify(role));