Skip to content

feat: add edit-role within user command #17341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions cli/testdata/coder_users_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ USAGE:
Aliases: user

SUBCOMMANDS:
activate Update a user's status to 'active'. Active users can fully
interact with the platform
create
delete Delete a user by username or user_id.
list
show Show a single user. Use 'me' to indicate the currently
authenticated user.
suspend Update a user's status to 'suspended'. A suspended user cannot
log into the platform
activate Update a user's status to 'active'. Active users can fully
interact with the platform
create
delete Delete a user by username or user_id.
edit-roles Edit a member's roles
list
show Show a single user. Use 'me' to indicate the currently
authenticated user.
suspend Update a user's status to 'suspended'. A suspended user cannot
log into the platform

———
Run `coder --help` for a list of global options.
11 changes: 11 additions & 0 deletions cli/testdata/coder_users_edit-roles_--help.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coder v0.0.0-devel

USAGE:
coder users edit-roles <username | user_id> [roles...]

Edit a member's roles

Aliases: edit-role

———
Run `coder --help` for a list of global options.
11 changes: 11 additions & 0 deletions cli/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@ func (r *RootCmd) users() *serpent.Command {
r.userList(),
r.userSingle(),
r.userDelete(),
r.userEditRoles(),
r.createUserStatusCommand(codersdk.UserStatusActive),
r.createUserStatusCommand(codersdk.UserStatusSuspended),
},
}
return cmd
}

// An alias for `organization members edit-roles` for single-organization
// deployments.
func (r *RootCmd) userEditRoles() *serpent.Command {
orgContext := NewOrganizationContext()
cmd := r.assignOrganizationRoles(orgContext)
cmd.Short = "Edit a member's roles"

return cmd
}
5 changes: 5 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,11 @@
"description": "Delete a user by username or user_id.",
"path": "reference/cli/users_delete.md"
},
{
"title": "users edit-roles",
"description": "Edit a member's roles",
"path": "reference/cli/users_edit-roles.md"
},
{
"title": "users list",
"path": "reference/cli/users_list.md"
Expand Down
17 changes: 9 additions & 8 deletions docs/reference/cli/users.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions docs/reference/cli/users_edit-roles.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provisioner/terraform/testdata/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.11.3
1.11.4
Loading