Skip to content

Commit 1c079f8

Browse files
geroplona-agent
andcommitted
Exempt dedicated installations from sunset blocking
Add isDedicatedInstallation parameter to sunset check functions. Dedicated installations always return false (not blocked) regardless of feature flag state. Changes: - isUserLoginBlockedBySunset: add isDedicatedInstallation param - isWorkspaceStartBlockedBySunset: add isDedicatedInstallation param - UserController: pass config.isDedicatedInstallation to login check - WorkspaceServiceAPI: inject Config and pass isDedicatedInstallation This ensures the sunset only affects gitpod.io (PAYG) and not dedicated installations. Co-authored-by: Ona <[email protected]>
1 parent 8c014ff commit 1c079f8

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

components/server/src/api/workspace-service-api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import { isWorkspaceId } from "@gitpod/gitpod-protocol/lib/util/parse-workspace-
6363
import { SYSTEM_USER, SYSTEM_USER_ID } from "../authorization/authorizer";
6464
import { isWorkspaceStartBlockedBySunset } from "../util/featureflags";
6565
import { User } from "@gitpod/gitpod-protocol";
66+
import { Config } from "../config";
6667

6768
@injectable()
6869
export class WorkspaceServiceAPI implements ServiceImpl<typeof WorkspaceServiceInterface> {
@@ -71,9 +72,10 @@ export class WorkspaceServiceAPI implements ServiceImpl<typeof WorkspaceServiceI
7172
@inject(ContextService) private readonly contextService: ContextService;
7273
@inject(UserService) private readonly userService: UserService;
7374
@inject(ContextParser) private contextParser: ContextParser;
75+
@inject(Config) private readonly config: Config;
7476

7577
private async checkClassicPaygSunset(user: User, organizationId: string): Promise<void> {
76-
if (await isWorkspaceStartBlockedBySunset(user, organizationId)) {
78+
if (await isWorkspaceStartBlockedBySunset(user, organizationId, this.config.isDedicatedInstallation)) {
7779
throw new ApplicationError(
7880
ErrorCodes.PERMISSION_DENIED,
7981
"Gitpod Classic PAYG has sunset. Please visit https://app.ona.com/login to continue.",

components/server/src/user/user-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class UserController {
7373

7474
// Check if authenticated user is blocked by sunset
7575
const user = req.user as User;
76-
if (await isUserLoginBlockedBySunset(user)) {
76+
if (await isUserLoginBlockedBySunset(user, this.config.isDedicatedInstallation)) {
7777
log.info("(Auth) User blocked by Classic PAYG sunset", {
7878
userId: user.id,
7979
organizationId: user.organizationId,

components/server/src/util/featureflags.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ export async function getClassicPaygSunsetConfig(userId: string): Promise<Classi
3535
}
3636
}
3737

38-
export async function isWorkspaceStartBlockedBySunset(user: User, organizationId: string): Promise<boolean> {
38+
export async function isWorkspaceStartBlockedBySunset(
39+
user: User,
40+
organizationId: string,
41+
isDedicatedInstallation: boolean,
42+
): Promise<boolean> {
43+
// Dedicated installations are never blocked
44+
if (isDedicatedInstallation) {
45+
return false;
46+
}
47+
3948
const config = await getClassicPaygSunsetConfig(user.id);
4049

4150
if (!config.enabled) {
@@ -51,7 +60,12 @@ export async function isWorkspaceStartBlockedBySunset(user: User, organizationId
5160
return true;
5261
}
5362

54-
export async function isUserLoginBlockedBySunset(user: User): Promise<boolean> {
63+
export async function isUserLoginBlockedBySunset(user: User, isDedicatedInstallation: boolean): Promise<boolean> {
64+
// Dedicated installations are never blocked
65+
if (isDedicatedInstallation) {
66+
return false;
67+
}
68+
5569
const config = await getClassicPaygSunsetConfig(user.id);
5670

5771
if (!config.enabled) {

0 commit comments

Comments
 (0)