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,
|
||||
|
||||
Reference in New Issue
Block a user