Skip to content

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.

ptkl role create [options]

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.

ptkl role edit [options]

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.

ptkl role delete [options]

Options

Option Description
-u, --uuid <uuid> UUID of the role to delete

Example

ptkl role delete --uuid 550e8400-e29b-41d4-a716-446655440000

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.

ptkl role list [options]

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 list
ptkl role list --format json --output roles.json

ptkl role permissions-list

List all available permissions that can be assigned to roles.

ptkl role permissions-list [options]

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

See Also