- ABP Framework version: v7.4.2
- UI Type: Angular
- Database System: EF Core (SQL Server)
- Tiered (for MVC) or Auth Server Separated (for Angular): yes
I am developing a suite of 3 products, each consisting of 2 editions - a free plan and a paid/pro plan using ABP.io (Comercial - Team).
I have the following questions:
Will the same tenant be able to subscribe to different editions of the different products? In other words, to the free plan for one or two products and to the paid plan for others without having to create an edition for every permutation of Product-Edition combinations? In short, is it possible to have multiple editions per tenant (e.g. Product 1 Free, Product 2 Pro and Product 3, or Product 1 Pro, Product 2 Free and Product 3 Free), understanding that this could result in 3 "different" subscriptions/payment transactions in each payment period?
Will some users be able to subscribe to one edition (free plan) of a product while other users of the same tenant subscribe to the other edition (paid plan) of the same product? (i.e. Manage Edition at a User rather than a Tenant Level)
If your answer is negative on either question, will it be doable on the Business plan or is there another way to have multiple products in one codebase? (The one codebase is not as important, but we are after tenants to be able to log in to one "App" that has access to all three Products (if they so choose, or to just one product or any combination of 2 products, etc) as there is data sharing between the products (A tenant that has product 1, and now subscribes to product 2, Free or Pro, would have additional features made available that allows the tenant to link data across the products, both i.t.o reporting and functionality) and SSO - Single Sign On - across the suite of products is of paramount importance)
1 Answer(s)
-
0
Hi,
If your answer is negative on either question
The Saas module is designed to assign a single edition to a tenant; it can't assign multiple editions.
As I understand, you want user-level feature control. I think you can do this with Features.
First, you can use the Entity extension to add
EditionId
for the user.- Once the user pays, you need to set
EditionId
for the user
And add a new
FeatureValueProvider
:public class UserEditionFeatureValueProvider : FeatureManagementProvider, ITransientDependency { public override string Name => "TE"; private readonly ICurrentPrincipalAccessor _currentPrincipalAccessor; public UserEditionFeatureValueProvider( IFeatureStore featureStore, ICurrentPrincipalAccessor currentPrincipalAccessor) : base(featureStore) { _currentPrincipalAccessor = currentPrincipalAccessor; } public async override Task<string> GetOrNullAsync(FeatureDefinition feature) { // find the EditionId for current user, you can use cache or claims for performance var user = await UserRepository.GetAsync(...currentUserId); var userEditionId = user.GetProperty<string>("EditionId"); if(userEditionId.IsNullOrWhiteSpace()) { return null; } return await Store.GetOrNullAsync(feature.Name, EditionFeatureValueProvider.ProviderName, userEditionId); } }
Related document:
- https://docs.abp.io/en/abp/latest/Module-Entity-Extensions#quick-example
- https://docs.abp.io/en/abp/latest/Features
- https://docs.abp.io/en/commercial/latest/modules/payment#one-time-payments
- Once the user pays, you need to set