createRole
Creates a new role.
Parameters
role
- An object that contains the information about the new role. The payload is defined below.
Payload
key
- A URL-friendly name of the role (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the role.
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.
{
"key": "editor",
"name": "Editor",
"description": "the editor role can read and write to documents",
"permissions": ["document:write"],
"extends": ["viewer"]
}
Implementation
response = await permit.api.create_role(role)