Skip to content

feat: add user management commands#102

Merged
Davidonium merged 23 commits intomainfrom
feat/dhernando/user-management
Apr 10, 2026
Merged

feat: add user management commands#102
Davidonium merged 23 commits intomainfrom
feat/dhernando/user-management

Conversation

@Davidonium
Copy link
Copy Markdown
Collaborator

@Davidonium Davidonium commented Apr 2, 2026

Extends the iam command group with user management. Invite management has not been included because the api calls require the actor type to be user (i.e. a browser authenticated user). That leaves the possible commands in the CLI to only allow role management as user mutations.

Commands introduced

  • qcloud iam user list — list all users in the account
  • qcloud iam user describe <user-id-or-email> — show details for a user
  • qcloud iam user assign-role <user-id-or-email> --role <role> — assign one or more roles to a user
  • qcloud iam user remove-role <user-id-or-email> --role <role> — remove one or more roles from a user

@Davidonium Davidonium force-pushed the feat/dhernando/user-management branch from a054864 to cde16b7 Compare April 7, 2026 12:54
They are not useful while use a management api key, since invites can't
be accepted/rejected while using one.
assign/remove role commands to keep consistency with permission management
@Davidonium Davidonium changed the title feat: add user and invite commands feat: add user management commands Apr 7, 2026
@Davidonium Davidonium requested a review from a team April 7, 2026 16:14
JustAwesomeGuy
JustAwesomeGuy previously approved these changes Apr 10, 2026
Copy link
Copy Markdown

@JustAwesomeGuy JustAwesomeGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Just have a little nitpick. Feel free to ignore.

// modifyUserRoles calls AssignUserRoles with the given add/delete IDs, then
// fetches and prints the resulting role list. errVerb is used in the error
// message ("failed to <errVerb> roles").
func modifyUserRoles(s *state.State, cmd *cobra.Command, client *qcloudapi.Client, accountID string, user *iamv1.User, addIDs, removeIDs []string, errVerb string) error {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is errVerb necessary? I think we can assume it from the arguments or just print failed to modify roles: %w and keep an argument list a bit shorter.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good point, lemme change it, the less arguments the better.

… it's too much and a generic error can be returned
@Davidonium Davidonium merged commit 6e83875 into main Apr 10, 2026
7 checks passed
@Davidonium Davidonium deleted the feat/dhernando/user-management branch April 10, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants