Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions cmd/repro.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,12 @@ func ensureCorrectWorkspace(ctx context.Context, orgSlug, workspaceSlug string,
currentOrgSlug := core.GetOrgSlugFromContext(ctx)
currentWorkspaceSlug := core.GetWorkspaceSlugFromContext(ctx)

// Allow admin users (speakeasy-self workspace) to access any workspace for repro purposes
if currentWorkspaceSlug == "speakeasy-self" {
logger.Infof("Using admin workspace credentials to access %s/%s", orgSlug, workspaceSlug)
return ctx, nil
}

if currentOrgSlug == orgSlug && currentWorkspaceSlug == workspaceSlug {
logger.Infof("Already authenticated to workspace %s/%s", orgSlug, workspaceSlug)
return ctx, nil
Expand Down Expand Up @@ -623,10 +629,15 @@ func ensureCorrectWorkspace(ctx context.Context, orgSlug, workspaceSlug string,
return ctx, fmt.Errorf("authentication failed: %w", err)
}

// Verify we're now in the correct workspace
newOrgSlug := core.GetOrgSlugFromContext(authCtx)
// Check if we authenticated as speakeasy-self
newWorkspaceSlug := core.GetWorkspaceSlugFromContext(authCtx)
if newWorkspaceSlug == "speakeasy-self" {
logger.Infof("Using admin workspace credentials to access %s/%s", orgSlug, workspaceSlug)
return authCtx, nil
}

// Verify we're now in the correct workspace
newOrgSlug := core.GetOrgSlugFromContext(authCtx)
if newOrgSlug != orgSlug || newWorkspaceSlug != workspaceSlug {
return authCtx, fmt.Errorf("authenticated to %s/%s but expected %s/%s. Please run 'speakeasy auth switch' and select the correct workspace", newOrgSlug, newWorkspaceSlug, orgSlug, workspaceSlug)
}
Expand Down
Loading