Files
coder/docs/reference/cli/users/edit-roles.md
T
Nick Vigilante cf60604a75 feat!: confirm role changes in coder users edit-roles (#30140)
`coder users edit-roles --roles ...` replaces the user's whole set of
site roles, so granting one role could silently remove others, including
owner.
It registered `-y` but never prompted, and `-y` didn't skip the
interactive role picker.

It now prints the roles being added and removed and asks for
confirmation; `-y` skips it.
The `--roles` help says it replaces the full set.

**Behavior change:** **New prompt; can break scripts.** `edit-roles
--roles ...` without `-y` now prompts.
`-y` without `--roles` now fails with an error instead of opening the
picker.
If the requested roles match the current roles, it prints `No role
changes for <user>.` and doesn't prompt.

<details>
<summary>Decisions</summary>

- No-op requests skip the prompt so idempotent scripted calls stay
quiet.

</details>

Closes [CLI-21](https://linear.app/codercom/issue/CLI-21)

_This PR was generated by Coder Agents on behalf of @nickvigilante._
2026-09-30 12:36:30 -04:00

862 B
Generated

title, description
title description
`coder users edit-roles` Edit a user's roles by username or id

Edit a user's roles by username or id

Usage

coder users edit-roles [flags] <username|user_id>

Description

  - --roles replaces the user's full set of site roles; any role not listed is
removed:

     $ coder users edit-roles example_user --roles owner user-admin

Options

-y, --yes

Type bool

Bypass confirmation prompts.

--roles

Type string-array

Replaces the user's full set of site roles with this list. Any existing role not included here is removed.