Skip to content

Commit

Permalink
[server] Usage-Based: Don't block slot operations on old Team Subscri…
Browse files Browse the repository at this point in the history
…ptions

Instead, we just block signin up for new Team Subscriptions
  • Loading branch information
geropl authored and roboquat committed Sep 21, 2022
1 parent b422b93 commit 13d9fa9
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions components/server/ee/src/workspace/gitpod-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,6 @@ export class GitpodServerEEImpl extends GitpodServerImpl {

const user = this.checkAndBlockUser("tsAddSlots");
const ts = await this.internalGetTeamSubscription(teamSubscriptionId, user.id);
await this.ensureChargebeeApiIsAllowedTS(ts);

if (addQuantity <= 0) {
const err = new Error(`Invalid quantity!`);
Expand Down Expand Up @@ -1689,7 +1688,6 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
const user = this.checkAndBlockUser("tsAssignSlot");
// assigning a slot can be done by third users
const ts = await this.internalGetTeamSubscription(teamSubscriptionId, identityStr ? user.id : undefined);
await this.ensureChargebeeApiIsAllowedTS(ts);
const logCtx = { userId: user.id };

try {
Expand Down Expand Up @@ -1770,7 +1768,6 @@ export class GitpodServerEEImpl extends GitpodServerImpl {

const user = this.checkAndBlockUser("tsReassignSlot");
const ts = await this.internalGetTeamSubscription(teamSubscriptionId, user.id);
await this.ensureChargebeeApiIsAllowedTS(ts);
const logCtx = { userId: user.id };
const assigneeInfo = await this.findAssignee(logCtx, newIdentityStr);

Expand Down Expand Up @@ -1854,7 +1851,6 @@ export class GitpodServerEEImpl extends GitpodServerImpl {

const user = this.checkAndBlockUser("tsReactivateSlot");
const ts = await this.internalGetTeamSubscription(teamSubscriptionId, user.id);
await this.ensureChargebeeApiIsAllowedTS(ts);

this.updateTeamSubscriptionQueue
.enqueue(async () => {
Expand All @@ -1874,14 +1870,6 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
});
}

protected async ensureChargebeeApiIsAllowedTS(ts: TeamSubscription): Promise<void> {
const tsOwner = await this.userDB.findUserById(ts.userId);
if (!tsOwner) {
throw new ResponseError(ErrorCodes.INTERNAL_SERVER_ERROR, "Cannot find TeamSubscription owner!");
}
await this.ensureChargebeeApiIsAllowed({ user: tsOwner });
}

async getGithubUpgradeUrls(ctx: TraceContext): Promise<GithubUpgradeURL[]> {
const user = this.checkUser("getGithubUpgradeUrls");
const ghidentity = user.identities.find((i) => i.authProviderId == "Public-GitHub");
Expand Down

0 comments on commit 13d9fa9

Please sign in to comment.