Skip to content

Commit e0e052d

Browse files
authored
[server] Remove OSS check (WEB-91) (#17133)
* [server] Remove OSS check * fix * Fix * Fix * fix
1 parent ee4a5a0 commit e0e052d

File tree

9 files changed

+0
-144
lines changed

9 files changed

+0
-144
lines changed

components/ee/payment-endpoint/src/accounting/subscription-service.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,6 @@ export class SubscriptionService {
9292
});
9393
}
9494

95-
/**
96-
* Subscribes the given user to the "Professional Open Source" plan if they are not already
97-
* @param user
98-
* @param now
99-
*/
100-
async checkAndSubscribeToOssSubscription(user: User, now: Date): Promise<void> {
101-
const userId = user.id;
102-
103-
// don't override but keep an existing, not-yet cancelled Prof. OSS subscription
104-
const subs = await this.getNotYetCancelledSubscriptions(user, now.toISOString());
105-
const uncancelledOssSub = subs.find(
106-
(s) => s.planId === Plans.FREE_OPEN_SOURCE.chargebeeId && !s.cancellationDate,
107-
);
108-
if (uncancelledOssSub) {
109-
log.debug({ userId: userId }, "already has professional OSS subscription");
110-
return;
111-
}
112-
113-
const subscription = await this.subscribe(userId, Plans.FREE_OPEN_SOURCE, undefined, now.toISOString());
114-
log.debug({ userId: userId }, "create new OSS subscription", { subscription });
115-
return;
116-
}
117-
11895
async addCredit(userId: string, amount: number, date: string, expiryDate?: string): Promise<AccountEntry> {
11996
const entry = <AccountEntry>{
12097
userId,

components/gitpod-db/src/container-module.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ import { ProjectDB } from "./project-db";
5757
import { ProjectDBImpl } from "./typeorm/project-db-impl";
5858
import { PersonalAccessTokenDB } from "./personal-access-token-db";
5959
import { EntityManager } from "typeorm";
60-
import { OssAllowListDB } from "./oss-allowlist-db";
61-
import { OssAllowListDBImpl } from "./typeorm/oss-allowlist-db-impl";
6260
import { TypeORMInstallationAdminImpl } from "./typeorm/installation-admin-db-impl";
6361
import { InstallationAdminDB } from "./installation-admin-db";
6462
import { TeamSubscription2DB } from "./team-subscription-2-db";
@@ -164,7 +162,6 @@ export const dbContainerModule = new ContainerModule((bind, unbind, isBound, reb
164162
bind(EmailDomainFilterDB).to(EmailDomainFilterDBImpl).inSingletonScope();
165163
bind(EduEmailDomainDB).to(EduEmailDomainDBImpl).inSingletonScope();
166164
bind(LicenseDB).to(LicenseDBImpl).inSingletonScope();
167-
bind(OssAllowListDB).to(OssAllowListDBImpl).inSingletonScope();
168165
bind(UserToTeamMigrationService).toSelf().inSingletonScope();
169166
bind(WorkspaceOrganizationIdMigration).toSelf().inSingletonScope();
170167
bind(Synchronizer).toSelf().inSingletonScope();

components/gitpod-db/src/oss-allowlist-db.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

components/gitpod-db/src/tables.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,6 @@ export class GitpodTableDescriptionProvider implements TableDescriptionProvider
263263
deletionColumn: "deleted",
264264
timeColumn: "_lastModified",
265265
},
266-
{
267-
name: "d_b_oss_allow_list",
268-
primaryKeys: ["identity"],
269-
deletionColumn: "deleted",
270-
timeColumn: "_lastModified",
271-
},
272266
{
273267
name: "d_b_project_env_var",
274268
primaryKeys: ["id", "projectId"],

components/gitpod-db/src/typeorm/entity/db-oss-allowlist.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

components/gitpod-db/src/typeorm/oss-allowlist-db-impl.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

components/server/ee/src/user/user-service.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ import { UserService, CheckSignUpParams, CheckTermsParams } from "../../../src/u
88
import { User } from "@gitpod/gitpod-protocol";
99
import { inject } from "inversify";
1010
import { SubscriptionService } from "@gitpod/gitpod-payment-endpoint/lib/accounting";
11-
import { OssAllowListDB } from "@gitpod/gitpod-db/lib/oss-allowlist-db";
1211
import { HostContextProvider } from "../../../src/auth/host-context-provider";
1312
import { Config } from "../../../src/config";
1413

1514
export class UserServiceEE extends UserService {
1615
@inject(SubscriptionService) protected readonly subscriptionService: SubscriptionService;
17-
@inject(OssAllowListDB) protected readonly OssAllowListDb: OssAllowListDB;
1816
@inject(HostContextProvider) protected readonly hostContextProvider: HostContextProvider;
1917
@inject(Config) protected readonly config: Config;
2018

@@ -39,19 +37,4 @@ export class UserServiceEE extends UserService {
3937

4038
return true;
4139
}
42-
43-
async checkAutomaticOssEligibility(user: User): Promise<boolean> {
44-
const idsWithHost = user.identities
45-
.map((id) => {
46-
const hostContext = this.hostContextProvider.findByAuthProviderId(id.authProviderId);
47-
if (!hostContext) {
48-
return undefined;
49-
}
50-
const info = hostContext.authProvider.info;
51-
return `${info.host}/${id.authName}`;
52-
})
53-
.filter((i) => !!i) as string[];
54-
55-
return this.OssAllowListDb.hasAny(idsWithHost);
56-
}
5740
}

components/server/src/auth/login-completion-handler.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ export class LoginCompletionHandler {
9393
);
9494
}
9595

96-
// Check for and automatically subscribe to Professional OpenSource subscription
97-
/** no await */ this.checkForAndSubscribeToProfessionalOss(user).catch((err) => {
98-
/** ignore */
99-
});
100-
10196
response.redirect(returnTo);
10297
}
10398

@@ -115,15 +110,6 @@ export class LoginCompletionHandler {
115110
}
116111
}
117112
}
118-
119-
protected async checkForAndSubscribeToProfessionalOss(user: User) {
120-
const eligible = await this.userService.checkAutomaticOssEligibility(user);
121-
log.debug({ userId: user.id }, "user eligible for OSS subscription?", { eligible });
122-
if (!eligible) {
123-
return;
124-
}
125-
await this.subscriptionService.checkAndSubscribeToOssSubscription(user, new Date());
126-
}
127113
}
128114
export namespace LoginCompletionHandler {
129115
export interface CompleteParams {

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,6 @@ export class UserService {
364364
// return !!accepted && (accepted.termsRevision === terms.revision);
365365
}
366366

367-
async checkAutomaticOssEligibility(user: User): Promise<boolean> {
368-
// EE implementation
369-
return false;
370-
}
371-
372367
async isBlocked(params: CheckIsBlockedParams): Promise<boolean> {
373368
if (params.user && params.user.blocked) {
374369
return true;

0 commit comments

Comments
 (0)