Skip to content

Commit

Permalink
Resolving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalmalani committed Apr 20, 2023
1 parent b9a1f10 commit c44a743
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion cmd/cloud/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,16 @@ func checkAPIToken(isDeploymentFile bool, args []string) (bool, error) {
}
workspaceID = strings.Replace(claims.Permissions[1], "workspaceId:", "", 1)
orgID := strings.Replace(claims.Permissions[2], "organizationId:", "", 1)
orgShortName := strings.Replace(claims.Permissions[3], "orgShortNameId:", "", 1)
orgShortName := strings.Replace(claims.Permissions[3], "orgShortName:", "", 1)

orgs, err := organization.ListOrganizations(coreClient)
if err != nil {
return false, err
}

org := orgs[0]
orgProduct := fmt.Sprintf("%s", *org.Product) //nolint

// If using api keys for virtual runtimes, we dont need to look up for this endpoint
if !(len(args) > 0 && strings.HasPrefix(args[0], "vr-")) {
err := c.SetContextKey("workspace", workspaceID) // c.Workspace
Expand Down
2 changes: 1 addition & 1 deletion cmd/cloud/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func TestCheckAPIToken(t *testing.T) {
"",
"workspaceId:workspace-id",
"organizationId:org-ID",
"orgShortNameId:org-short-name",
"orgShortName:org-short-name",
}
mockClaims := util.CustomClaims{
Permissions: permissions,
Expand Down

0 comments on commit c44a743

Please sign in to comment.