Skip to content
Merged
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
21 changes: 21 additions & 0 deletions components/server/src/workspace/gitpod-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ import { getPrimaryEmail } from "@gitpod/public-api-common/lib/user-utils";
import { AnalyticsController } from "../analytics-controller";
import { ClientHeaderFields } from "../express-util";
import { filter } from "../util/objects";
import { isWorkspaceStartBlockedBySunset } from "../util/featureflags";

// shortcut
export const traceWI = (ctx: TraceContext, wi: Omit<LogContext, "userId">) => TraceContext.setOWI(ctx, wi); // userId is already taken care of in WebsocketConnectionManager
Expand Down Expand Up @@ -581,6 +582,16 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
const { workspace, latestInstance: instance } = await this.workspaceService.getWorkspace(user.id, workspaceId);
await this.guardAccess({ kind: "workspace", subject: workspace }, "get");

// Check if user is blocked by Classic PAYG sunset
if (
await isWorkspaceStartBlockedBySunset(user, workspace.organizationId, this.config.isDedicatedInstallation)
) {
throw new ApplicationError(
ErrorCodes.PERMISSION_DENIED,
"Gitpod Classic PAYG has sunset. Please visit https://app.ona.com/login to continue.",
);
}

// (gpl) We keep this check here for backwards compatibility, it should be superfluous in the future
if (instance && instance.status.phase !== "stopped") {
traceWI(ctx, { instanceId: instance.id });
Expand Down Expand Up @@ -850,6 +861,16 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {

logContext = { userId: user.id };

// Check if user is blocked by Classic PAYG sunset
if (
await isWorkspaceStartBlockedBySunset(user, options.organizationId, this.config.isDedicatedInstallation)
) {
throw new ApplicationError(
ErrorCodes.PERMISSION_DENIED,
"Gitpod Classic PAYG has sunset. Please visit https://app.ona.com/login to continue.",
);
}

normalizedContextUrl = this.contextParser.normalizeContextURL(contextUrl);

const { context, project } = await this.contextService.parseContext(user, contextUrl, {
Expand Down
Loading