Skip to content

Commit

Permalink
Use tctl users update in add-role-to-user.mdx (#38445)
Browse files Browse the repository at this point in the history
Closes #19067

This allows a reader to copy commands to update a local user without
needing to open a YAML file in a text editor.
  • Loading branch information
ptgott authored Feb 26, 2024
1 parent 5e5be3e commit 9bf7ff7
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions docs/pages/includes/add-role-to-user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,17 @@ commands for your authentication provider:
<Tabs>
<TabItem label="Local User">

1. Retrieve your local user's configuration resource:
1. Retrieve your local user's roles as a comma-separated list:

```code
$ tctl get users/$(tsh status -f json | jq -r '.active.username') > out.yaml
$ ROLES=$(tsh status -f json | jq -r '.active.roles | join(",")')
```

1. Edit `out.yaml`, adding `{{ role }}` to the list of existing roles:

```diff
roles:
- access
- auditor
- editor
+ - {{ role }}
```
1. Edit your local user to add the new role:

1. Apply your changes:

```code
$ tctl create -f out.yaml
$ tctl users update $(tsh status -f json | jq -r '.active.username') \
--set-roles "${ROLES?},{{ role }}"
```

1. Sign out of the Teleport cluster and sign in again to assume the new role.
Expand Down

0 comments on commit 9bf7ff7

Please sign in to comment.