Hello, i am just curious how i would implement a feature where a user subscribes to my site but they have the option to add users to their account with restricted privileges.
The logic is a user subscribes and pays a monthly fee, by default this user would be the admin for the account. The admin now will have the option to add 2 supervisors to his/her account. How exactly would i allow multiple users to sign into this subscribers account?
admin will be the only one to access the billing info and restricted things of that nature while the supervisors can manage other aspects of the subscribers account.
I havent wrote any code for this yet just want to get a few opinions before i hack away at this.
you can add a company or contract or tenancy model (whatever term makes sense in your application). I'll call this company here for ease of conversation
The user model would have a foreign key to this Company model so that each user belongs to the company.
The company would have an owner which is the foreign key of the user that started the whole thing.
@Snapey Hello friend this exactly what also been looking for... according to your suggestion..how do i list other users created by this admin user under this admin user ????
This particular app is going to share a single database, where as to my understanding a multi tenant app provides a database for each instance of the app which is not what i am doing.
@Snapey would the relationship basically be company hasMany users and if the role is admin they control the company settings IE billing?
Also, the admin would be in charge of adding the other user accounts. would the relationship be created through a column like company_id? if so how would that column be populated?
@afoster009 Did you ever solve this? I'm in the same boat at the moment, with a working user system that I need to add the ability to invite others to register and allow that invitee access to their account content. What did you end up doing?
Do you want them all to login with thesame credentials or each member can login with different credentials and manage the company with different roles?