Skip to content
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

Show the subject display name along with the ID in minder role #3772

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions cmd/cli/app/project/role/role_grant_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func GrantListCommand(ctx context.Context, cmd *cobra.Command, _ []string, conn
case app.Table:
t := initializeTableForGrantListRoleAssignments()
for _, r := range resp.RoleAssignments {
t.AddRow(r.Subject, r.Role, *r.Project)
t.AddRow(fmt.Sprintf("%s / %s", r.DisplayName, r.Subject), r.Role, *r.Project)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it's worth adding another column to the table, because the current column title is "Subject" and with this change it will contain both the subject and the display name.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did do it like that initially, but it stretched the table too much, so I thought to reuse what we do in the auth command (where projects are displayed in a similar pattern - project_name / project_id). I can make it in the other way if you think it would be better 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we include both in the same column, but change the title from "Subject" to "User"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good 👍 I'll push a commit 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Done 👍

}
t.Render()
if len(resp.Invitations) > 0 {
Expand All @@ -98,7 +98,7 @@ func GrantListCommand(ctx context.Context, cmd *cobra.Command, _ []string, conn
}

func initializeTableForGrantListRoleAssignments() table.Table {
return table.New(table.Simple, layouts.Default, []string{"Subject", "Role", "Project"})
return table.New(table.Simple, layouts.Default, []string{"User", "Role", "Project"})
}

func initializeTableForGrantListInvitations() table.Table {
Expand Down
3 changes: 2 additions & 1 deletion cmd/cli/app/project/role/role_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package role

import (
"context"
"fmt"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -81,7 +82,7 @@ func UpdateCommand(ctx context.Context, cmd *cobra.Command, _ []string, conn *gr
// Otherwise, print the role assignments if it was about updating a role
t := initializeTableForGrantListRoleAssignments()
for _, r := range ret.RoleAssignments {
t.AddRow(r.Subject, r.Role, *r.Project)
t.AddRow(fmt.Sprintf("%s / %s", r.DisplayName, r.Subject), r.Role, *r.Project)
}
t.Render()
return nil
Expand Down