Skip to content

Commit

Permalink
display is idp managed flag in list users cmd (#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
missing1984 authored Jul 7, 2023
1 parent e672f4c commit 52606f8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
6 changes: 4 additions & 2 deletions cloud/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func ListOrgUsers(out io.Writer, client astrocore.CoreClient) error {
table := printutil.Table{
Padding: []int{30, 50, 10, 50, 10, 10, 10},
DynamicPadding: true,
Header: []string{"FULLNAME", "EMAIL", "ID", "ORGANIZATION ROLE", "CREATE DATE"},
Header: []string{"FULLNAME", "EMAIL", "ID", "ORGANIZATION ROLE", "IDP MANAGED", "CREATE DATE"},
}
users, err := GetOrgUsers(client)
if err != nil {
Expand All @@ -233,6 +233,7 @@ func ListOrgUsers(out io.Writer, client astrocore.CoreClient) error {
users[i].Username,
users[i].Id,
*users[i].OrgRole,
strconv.FormatBool(*users[i].OrgUserRelationIsIdpManaged),
users[i].CreatedAt.Format(time.RFC3339),
}, false)
}
Expand Down Expand Up @@ -392,7 +393,7 @@ func ListWorkspaceUsers(out io.Writer, client astrocore.CoreClient, workspace st
table := printutil.Table{
Padding: []int{30, 50, 10, 50, 10, 10, 10},
DynamicPadding: true,
Header: []string{"FULLNAME", "EMAIL", "ID", "WORKSPACE ROLE", "CREATE DATE"},
Header: []string{"FULLNAME", "EMAIL", "ID", "WORKSPACE ROLE", "IDP MANAGED", "CREATE DATE"},
}
users, err := GetWorkspaceUsers(client, workspace, userPagnationLimit)
if err != nil {
Expand All @@ -405,6 +406,7 @@ func ListWorkspaceUsers(out io.Writer, client astrocore.CoreClient, workspace st
users[i].Username,
users[i].Id,
*users[i].WorkspaceRole,
strconv.FormatBool(*users[i].OrgUserRelationIsIdpManaged),
users[i].CreatedAt.Format(time.RFC3339),
}, false)
}
Expand Down
23 changes: 13 additions & 10 deletions cloud/user/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ var (
errorNetwork = errors.New("network error")
errorInvite = errors.New("test-inv-error")
orgRole = "ORGANIZATION_MEMBER"
isIdpManaged = true
user1 = astrocore.User{
CreatedAt: time.Now(),
FullName: "user 1",
Id: "user1-id",
OrgRole: &orgRole,
Username: "user@1.com",
CreatedAt: time.Now(),
FullName: "user 1",
Id: "user1-id",
OrgRole: &orgRole,
OrgUserRelationIsIdpManaged: &isIdpManaged,
Username: "user@1.com",
}
users = []astrocore.User{
user1,
Expand Down Expand Up @@ -94,11 +96,12 @@ var (
var (
workspaceRole = "WORKSPACE_MEMBER"
workspaceUser1 = astrocore.User{
CreatedAt: time.Now(),
FullName: "user 1",
Id: "user1-id",
WorkspaceRole: &workspaceRole,
Username: "user@1.com",
CreatedAt: time.Now(),
FullName: "user 1",
Id: "user1-id",
WorkspaceRole: &workspaceRole,
OrgUserRelationIsIdpManaged: &isIdpManaged,
Username: "user@1.com",
}
workspaceUsers = []astrocore.User{
workspaceUser1,
Expand Down

0 comments on commit 52606f8

Please sign in to comment.