We have an existing implementation where all users belong to an organisation will depend on the organisation subscription, so if the subscription has ended all users belong to this organisation will not be able to access our web application. They won't be able to login due to expired subscription.

Sample DB Schema for Existing Implementation:

enter image description here

Now we want to implement a subscription not only for an organisation but also for individual user. So there will be:

Trial (for 1 user and with limited access to some features) Subscription 1 (for 1 user) Subscription 2 (for 20 user) Subscription 3 (this is an enterprise and would depend on how many allowed users an enterprise want). By this I have to track user who are in trial subscription with their start and end date however there is also a problem this trial user has an organisation which in the existing implementation organisation has allowed accounts and renewal date (expiration date of their subscription).

I'm thinking to create a subscription table where I will add user_id and organisation_id in this table and will include the start and end date also the type of subscription whether trial, subscription 1, subscription 2 or subscription 3. But I'm worried this would be a bad implementation knowing organisation table has already allowed accounts (how many user could access our web application) and renewal date (which is their expiration date of their subscription). Any suggestion on this? I would really appreciate it.

  • Could there be a case where a certain resource is owned by a user or organisation separately? Using a file storage service as an example, me.jpg is owned by a user subscription and importants_financial_stuff.xls is owned by an organisation. The user has access to both files, and the user is signed up for Subscription 1. If the org's subscription expires, does access to the .xls file get cut off for the user? What do you expect the User to experience? Those are business decisions that you need to make before anyone can properly answer your question. – Core.B Aug 23 '16 at 22:20
  • @Core.B all resources can be owned by user but these resources can also be available/seen by the admin of the organisation. so an organisation has users and admins. If the organisation subscription expires all of the users/associated to it will be cut off and will not be able to use the web application. – rpmansion Aug 23 '16 at 23:16
  • @Core.B the older implementation is only designed for organisation's subscription where an organisation subscribes with number of users they can allow to their subscription. so the challenging part for me is to implement an individual subscription knowing the user will always be bound to an organisation so during an individual user register they have to select their organisation we have provided in the list in our registration form. – rpmansion Aug 23 '16 at 23:20
  • Can I assume organisation == employer and user == employee? If the organisation has access to everything, what is the incentive for a user to get their own subscription? Why charge both an employer and an employee for access to your service? If I, as a user, give you money for a Subscription 1 account, why should the organisation get access to MY data/resources/files that I'm paying you to store? I think every subscription should become their own "organisation". I'm sure I'm missing some crucial detail because I don't know exactly what is being subscribed to in your service. – Core.B Aug 24 '16 at 12:52
  • @Core.B yes. Good question, i think for the 1 account could be the user can be the admin of that org and if the user wanted to add more users s/he can avail more allowed accounts on the subscription which will still end up as organisation subscription. I think the purpose of the individual subscription is to give the user a try out on the application then if the user seems to like it s/he can expand his/her subscription. Which end up still an org subscription. Okay to give you some detials this is about researchers, in the app you can store your researches and information about those research. – rpmansion Aug 24 '16 at 19:43

I'm making assumptions that may not be true about your service.

If your service is implemented in a way where an organization is given their special URL or instance of your service (e.g. http://myorg.yourservice.com), you could give each subscription their own instance and not allow data from a user subscription to mix with another subscription. Going back to the example in my comment, me.jpg would only be accessible when I'm logged into myusername.yourservice.com and _important_financial_stuff.xls_ is on myorg.yourservice.com. Don't let data from the two subscriptions mix.

To implement that, I would replace much of what the organisation table does with the subscription table you mentioned and add subscription_member table. (Assume user from example is user.id = 2)

| id | type | instance_name| start_date | end_date   | allowed_accounts |
| 1  | org  | myorg        | 2016-08-01 | 2016-08-30 | 50               |
| 2  | sub1 | myuser       | 2016-08-01 | 2017-12-31 | 1                |

| subscription_id | user_id | user_type   |
| 1               | 2       | regular user|
| 2               | 2       | owner       |

If all of your data/files/resources are linked back to subscription.id, it will be easy to control access based on if the subscription is active or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.