Base solution for your next web application
Open Closed

Editions And Features for individual users #3534


User avatar
0
soonjoo created

Hello, my software will cater for individual users, as well as enterprise users. For enterprise users, they will become their own tenant and have their own users, so the editions and features are great. However, for individual users, all of them will be within the same tenant (default tenant), and they can sign up as free or paid with different pricing tiers and allowing them to different features and limitations. How would I go about allowing the individual users within the same tenant to have different editions?

Thank you.


11 Answer(s)
  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    There is no built-in solution for this. May be you can create a tenant per user. Or with a more difficult way: you should develop your own logic for this.

  • User Avatar
    0
    soonjoo created

    Thank you for your reply, I am building a software with a tenancy concept similar to event cloud, where many users are together within the default tenant that can create and share events with each other. So I don't think the first option to have each user become a tenant is viable. For the second option, how would you suggest developing myself? I was thinking of adding another column into the edition table, to tie it to a user. Another way would be to utilize the setting table, to have each feature become a setting. What do you think? Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think it is easier to implement this with settings or permissions.

    Thanks.

  • User Avatar
    0
    soonjoo created

    Hello, I'm starting to implement this and trying to figure out the way to do this. How would I implement a feature checker and setting checker together, since essentially they will be the restriction for the same items?

    The default tenant is where all the individual users (not tied to a company) will reside in. Am I right to say that in the default tenant, all features will be set to allowed, all maximum count will all be unlimited. However, each individual user will have their own settings depending on their pricing tiers. The settings will be on the user scope.

    For other tenants, all users within those tenants won't have any individual user settings, their only restrictions are the values in the tenant features.

    Should I implement both features and editions, and settings, to cater for my scenario? However this means double checking for every restriction I have. I would have to check for the features values, then individual setting values, before allowing user access. It will be messy on the front end too as I need to check both values too.

    Or should I just forgo the features and editions module and build this entirely on settings, since settings is much more powerful? Seems a waste because the editions and features deal with what I plan to do and it ties to payment module, just that it is not powerful enough to tie to individual users.

    Or lastly, should I extend features and editions to individual users? How much work do I need to do if I want to extend features and editions to individual users?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Binding features to individual users is a bit hard work. We didn't think it like that at the beginning and it is hard for us to change it now.

    I suggest you to consider this as the last option. Maybe it is better to implement it with settings.

    By the way, why do you grant unlimited access to default tenant ?

    Thanks.

  • User Avatar
    0
    soonjoo created

    I was thinking to grant default tenant unlimited access and restrict based on the user settings. For any other tenant I will grant access based on their edition. This way, I won't have to write specific code for just default tenant I think. So I will create 2 tables, called Tiers, and TierSettings. and add one more column into User table binding to Tiers. When user registers inside default tenant, depending on which pricing tier they choose, I will insert the respective settings into their user settings. The checking will be something like

    var createdTaskCountInThisMonth = GetCreatedTaskCountInThisMonth();
    if (createdTaskCountInThisMonth >= FeatureChecker.GetValue("MaxTaskCreationLimitPerMonth").To<int>()
    || createdTaskCountInThisMonth >= SettingManager.GetSettingValue("MaxTaskCreationLimitPerMonth"))
    {
        throw new AbpAuthorizationException("You exceed task creation limit for this month, sorry :(");
    }
    

    Is this what you mean when u said to use settings?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Is this what you mean when u said to use settings?

    No, I didn't think tier level but your solution seems better.

  • User Avatar
    0
    soonjoo created

    May I know what did you originally mean?

    I decide to skip using settings entirely, and implement the pricing tier on my own. Otherwise I will have 2 things to maintain and i wish to keep things DRY. Like if we decide to change a tier setting values, we need to trace back all the user settings which implemented it and change that too..

    However, is there a way I can put it in the client side dynamic scripts?? For example using settings, I can call abp.setting.get("MaxTaskCreationPerMonth"); How would I create one for my tier system?

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Do you use MVC 5.x or ASP.NET Core version ?

  • User Avatar
    0
    soonjoo created

    I am using .NET Core and Angular, with the .NET Core 1.1 Framework

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    We call GetAll action from AbpUserConfigurationController from client side to get all necessary values. You can create a similar controller and action to get your settings from client side.

    Please take a look at our code here and investigate it to write your own version. <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Common/Web/Configuration/AbpUserConfigurationBuilder.cs#L66">https://github.com/aspnetboilerplate/as ... der.cs#L66</a>

    Thanks.