Skip to content

Commit c5a0ce1

Browse files
committed
fix: ignore users and groups with WorkspaceRoleDeleted
1 parent 0963ca6 commit c5a0ce1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cli/sharing.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ func (r *RootCmd) shareWorkspace(orgContext *OrganizationContext) *serpent.Comma
112112
}
113113

114114
groupRoles := make(map[string]codersdk.WorkspaceRole)
115+
fmt.Printf("%v\n", groups)
115116
if len(groups) > 0 {
116117
orgGroups, err := client.Groups(inv.Context(), codersdk.GroupArguments{
117118
Organization: org.ID.String(),
@@ -162,13 +163,21 @@ func (r *RootCmd) shareWorkspace(orgContext *OrganizationContext) *serpent.Comma
162163

163164
outputRows := make([]workspaceShareRow, 0)
164165
for _, user := range workspaceAcl.Users {
166+
if user.Role == codersdk.WorkspaceRoleDeleted {
167+
continue
168+
}
169+
165170
outputRows = append(outputRows, workspaceShareRow{
166171
User: user.Username,
167172
Group: "-",
168173
Role: user.Role,
169174
})
170175
}
171176
for _, group := range workspaceAcl.Groups {
177+
if group.Role == codersdk.WorkspaceRoleDeleted {
178+
continue
179+
}
180+
172181
for _, user := range group.Members {
173182
outputRows = append(outputRows, workspaceShareRow{
174183
User: user.Username,

0 commit comments

Comments
 (0)