mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
Merge branch 'main' of github.com:/coder/coder into dk/prebuilds
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
This commit is contained in:
@ -9,6 +9,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -22,7 +23,6 @@ import (
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.14.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"golang.org/x/exp/maps"
|
||||
"golang.org/x/exp/slices"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/xerrors"
|
||||
protobuf "google.golang.org/protobuf/proto"
|
||||
@ -608,6 +608,19 @@ func (s *server) acquireProtoJob(ctx context.Context, job database.ProvisionerJo
|
||||
})
|
||||
}
|
||||
|
||||
roles, err := s.Database.GetAuthorizationUserRoles(ctx, owner.ID)
|
||||
if err != nil {
|
||||
return nil, failJob(fmt.Sprintf("get owner authorization roles: %s", err))
|
||||
}
|
||||
ownerRbacRoles := []*sdkproto.Role{}
|
||||
for _, role := range roles.Roles {
|
||||
if s.OrganizationID == uuid.Nil {
|
||||
ownerRbacRoles = append(ownerRbacRoles, &sdkproto.Role{Name: role, OrgId: ""})
|
||||
continue
|
||||
}
|
||||
ownerRbacRoles = append(ownerRbacRoles, &sdkproto.Role{Name: role, OrgId: s.OrganizationID.String()})
|
||||
}
|
||||
|
||||
protoJob.Type = &proto.AcquiredJob_WorkspaceBuild_{
|
||||
WorkspaceBuild: &proto.AcquiredJob_WorkspaceBuild{
|
||||
WorkspaceBuildId: workspaceBuild.ID.String(),
|
||||
@ -635,6 +648,7 @@ func (s *server) acquireProtoJob(ctx context.Context, job database.ProvisionerJo
|
||||
WorkspaceOwnerSshPrivateKey: ownerSSHPrivateKey,
|
||||
WorkspaceBuildId: workspaceBuild.ID.String(),
|
||||
WorkspaceOwnerLoginType: string(owner.LoginType),
|
||||
WorkspaceOwnerRbacRoles: ownerRbacRoles,
|
||||
IsPrebuild: input.IsPrebuild,
|
||||
RunningWorkspaceAgentToken: runningWorkspaceAgentToken,
|
||||
},
|
||||
|
Reference in New Issue
Block a user