ptkl role
Create, edit, list, and delete roles from the command line.
Overview
ptkl role manages the role-based access control (RBAC) configuration of your project. Roles
define which permissions a user or API user has and which workspaces they can access. Use this
command to automate role provisioning in scripts or CI pipelines.
Subcommands
| Subcommand | Description |
|---|---|
create |
Create a new role |
edit |
Edit an existing role |
delete |
Delete a role |
list |
List all roles |
permissions-list |
List all available permissions |
ptkl role create
Create a new role with the specified permissions, workspaces, and access level.
Options
| Option | Description |
|---|---|
-n, --name <name> |
Role name |
-p, --permissions <permissions...> |
One or more permission strings |
-w, --workspaces <workspaces...> |
One or more workspace identifiers |
-l, --level <level> |
Access level |
Example
ptkl role create \
--name editor \
--permissions "components.read" "components.write" "functions.read" \
--workspaces default \
--level 2
ptkl role edit
Edit an existing role's permissions, workspaces, or access level.
Options
| Option | Description |
|---|---|
-u, --uuid <uuid> |
UUID of the role to edit |
-p, --permissions <permissions...> |
Updated permission strings |
-w, --workspaces <workspaces...> |
Updated workspace identifiers |
-l, --level <level> |
Updated access level |
Example
ptkl role edit \
--uuid 550e8400-e29b-41d4-a716-446655440000 \
--permissions "components.*" "functions.*" \
--level 3
ptkl role delete
Delete a role by UUID.
Options
| Option | Description |
|---|---|
-u, --uuid <uuid> |
UUID of the role to delete |
Example
Warning
Deleting a role immediately revokes the associated permissions from all users and API users assigned to that role.
ptkl role list
List all roles in the current project.
Options
| Option | Description |
|---|---|
-f, --format <format> |
Output format — json or table (default: table) |
-o, --output <file> |
Write output to a file instead of stdout |
Example
ptkl role permissions-list
List all available permissions that can be assigned to roles.
Options
| Option | Description |
|---|---|
-f, --format <format> |
Output format — json or table (default: table) |
-o, --output <file> |
Write output to a file instead of stdout |
Example
Roles and run identity
A role can be a run identity. You can choose a role as one if you are a member of it. The Owner and Maintainers can choose any role except admin roles.
Role edits have limits:
- A role can't be given
admin,maintaineror a pattern that matches either. Only the Owner assigns the Maintainer role. See Owner and Maintainer. - Admin roles can't be created or assigned. A project has one admin, its Owner.
- The Owner and Maintainer roles can be changed or deleted by the Owner only. Others get 403 Owner required.
- A role that is some code's run identity can't be deleted. The delete is refused with 409
identity_in_useand lists where it is used. - A role that belongs to a template installation can't be edited, deleted or assigned.
Narrowing a role changes what code running as it can do, at the code's next run.
See Also
ptkl api-users— manage API users and assign rolesptkl users— invite and manage project users- Toolkit Overview — all available toolkit commands