remove freeAccess user logic (#9866)
closes #9763 --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
@ -8,7 +8,6 @@ import { BillingSubscription } from 'src/engine/core-modules/billing/entities/bi
|
||||
import { BillingEntitlementKey } from 'src/engine/core-modules/billing/enums/billing-entitlement-key.enum';
|
||||
import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service';
|
||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';
|
||||
|
||||
@Injectable()
|
||||
@ -26,23 +25,13 @@ export class BillingService {
|
||||
return this.environmentService.get('IS_BILLING_ENABLED');
|
||||
}
|
||||
|
||||
async hasWorkspaceSubscriptionOrFreeAccess(workspaceId: string) {
|
||||
async hasWorkspaceAnySubscription(workspaceId: string) {
|
||||
const isBillingEnabled = this.isBillingEnabled();
|
||||
|
||||
if (!isBillingEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const isFreeAccessEnabled =
|
||||
await this.isFeatureEnabledService.isFeatureEnabled(
|
||||
FeatureFlagKey.IsFreeAccessEnabled,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
if (isFreeAccessEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const subscription = await this.billingSubscriptionRepository.findOne({
|
||||
where: { workspaceId },
|
||||
});
|
||||
@ -50,7 +39,7 @@ export class BillingService {
|
||||
return isDefined(subscription);
|
||||
}
|
||||
|
||||
async hasFreeAccessOrEntitlement(
|
||||
async hasEntitlement(
|
||||
workspaceId: string,
|
||||
entitlementKey: BillingEntitlementKey,
|
||||
) {
|
||||
@ -60,16 +49,6 @@ export class BillingService {
|
||||
return true;
|
||||
}
|
||||
|
||||
const isFreeAccessEnabled =
|
||||
await this.isFeatureEnabledService.isFeatureEnabled(
|
||||
FeatureFlagKey.IsFreeAccessEnabled,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
if (isFreeAccessEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.billingSubscriptionService.getWorkspaceEntitlementByKey(
|
||||
workspaceId,
|
||||
entitlementKey,
|
||||
|
||||
@ -4,7 +4,6 @@ export enum FeatureFlagKey {
|
||||
IsPostgreSQLIntegrationEnabled = 'IS_POSTGRESQL_INTEGRATION_ENABLED',
|
||||
IsStripeIntegrationEnabled = 'IS_STRIPE_INTEGRATION_ENABLED',
|
||||
IsCopilotEnabled = 'IS_COPILOT_ENABLED',
|
||||
IsFreeAccessEnabled = 'IS_FREE_ACCESS_ENABLED',
|
||||
IsWorkflowEnabled = 'IS_WORKFLOW_ENABLED',
|
||||
IsAnalyticsV2Enabled = 'IS_ANALYTICS_V2_ENABLED',
|
||||
IsUniqueIndexesEnabled = 'IS_UNIQUE_INDEXES_ENABLED',
|
||||
|
||||
@ -28,12 +28,10 @@ export class OnboardingService {
|
||||
) {}
|
||||
|
||||
private async isSubscriptionIncompleteOnboardingStatus(workspace: Workspace) {
|
||||
const hasSubscription =
|
||||
await this.billingService.hasWorkspaceSubscriptionOrFreeAccess(
|
||||
workspace.id,
|
||||
);
|
||||
const hasAnySubscription =
|
||||
await this.billingService.hasWorkspaceAnySubscription(workspace.id);
|
||||
|
||||
return !hasSubscription;
|
||||
return !hasAnySubscription;
|
||||
}
|
||||
|
||||
private isWorkspaceActivationPending(workspace: Workspace) {
|
||||
|
||||
@ -35,11 +35,10 @@ export class SSOService {
|
||||
) {}
|
||||
|
||||
private async isSSOEnabled(workspaceId: string) {
|
||||
const isSSOBillingEnabled =
|
||||
await this.billingService.hasFreeAccessOrEntitlement(
|
||||
workspaceId,
|
||||
this.featureLookUpKey,
|
||||
);
|
||||
const isSSOBillingEnabled = await this.billingService.hasEntitlement(
|
||||
workspaceId,
|
||||
this.featureLookUpKey,
|
||||
);
|
||||
|
||||
if (!isSSOBillingEnabled) {
|
||||
throw new SSOException(
|
||||
|
||||
Reference in New Issue
Block a user