Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfee785d

Browse files
committed
Add user and group data to endpoint response
1 parent12f6148 commitfee785d

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

‎coderd/workspaces.go‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,10 +2662,36 @@ func convertWorkspace(
26622662
}
26632663
// TODO(geokat): using a pointer that's serialized with
26642664
// "omitempty" so that we can hide it behind an experiment. This
2665-
// won't be necessary once workspace sharing is inbeta.
2665+
// won't be necessary once workspace sharing is inGA.
26662666
varsharedWith*[]codersdk.SharedWorkspaceActor
26672667
ifexperiments.Enabled(codersdk.ExperimentWorkspaceSharing) {
2668-
sharedWith=&[]codersdk.SharedWorkspaceActor{}
2668+
out:=make([]codersdk.SharedWorkspaceActor,0,len(workspace.UserACL)+len(workspace.GroupACL))
2669+
2670+
// Users
2671+
foruid,aclEntry:=rangeworkspace.UserACL {
2672+
user:=userData[uid]
2673+
out=append(out, codersdk.SharedWorkspaceActor{
2674+
ID:user.ID,
2675+
ActorType:codersdk.SharedWorkspaceActorTypeUser,
2676+
Name:user.Name,
2677+
AvatarURL:user.AvatarURL,
2678+
Roles: []codersdk.WorkspaceRole{convertToWorkspaceRole(aclEntry.Permissions)},
2679+
})
2680+
}
2681+
2682+
// Groups
2683+
forgid,aclEntry:=rangeworkspace.GroupACL {
2684+
group:=groupData[gid]
2685+
out=append(out, codersdk.SharedWorkspaceActor{
2686+
ID:group.ID,
2687+
ActorType:codersdk.SharedWorkspaceActorTypeGroup,
2688+
Name:group.Name,
2689+
AvatarURL:group.AvatarURL,
2690+
Roles: []codersdk.WorkspaceRole{convertToWorkspaceRole(aclEntry.Permissions)},
2691+
})
2692+
}
2693+
2694+
sharedWith=&out
26692695
}
26702696

26712697
ttlMillis:=convertWorkspaceTTLMillis(workspace.Ttl)

‎codersdk/workspaces.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ type WorkspaceUser struct {
697697
}
698698

699699
typeSharedWorkspaceActorstruct {
700+
ID uuid.UUID`json:"id" format:"uuid"`
700701
ActorTypeSharedWorkspaceActorType`json:"actor_type" enums:"group,user"`
701702
Namestring`json:"name"`
702703
AvatarURLstring`json:"avatar_url,omitempty" format:"uri"`

‎site/src/api/typesGenerated.ts‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp