| 319 | } |
| 320 | |
| 321 | func userRolesToRemovePickerOptions(ctx context.Context, cli *cli, userID string) ([]string, error) { |
| 322 | currentUserRoleList, err := cli.api.User.Roles(ctx, userID, management.PerPage(100)) |
| 323 | if err != nil { |
| 324 | return nil, fmt.Errorf("failed to read the current roles for user with ID %q: %w", userID, err) |
| 325 | } |
| 326 | |
| 327 | var options []string |
| 328 | for _, role := range currentUserRoleList.Roles { |
| 329 | options = append(options, fmt.Sprintf("%s (Name: %s)", role.GetID(), role.GetName())) |
| 330 | } |
| 331 | |
| 332 | return options, nil |
| 333 | } |
| 334 | |
| 335 | func containsRole(roles []*management.Role, roleID string) bool { |
| 336 | for _, role := range roles { |