How can we manage three types of account in any website(My Startup). i.e, User, Super user, Admin?
I want to manage three type of accounts in my website but i am confused that how i can make it possible.Posted in: #Startups & Business
Vinay, the information you've provided is very limited; hence my answer will be generic.
The types of account User, Super User, Admin etc. are actually called "User Roles". The role assigned to any user determines their capabilities on the site. For example, you'd typically want a few functions available only to the Admins and not to the user.
The way to implement this in any website is quite easy; and it can mostly be done by having a "Roles" and "User_Roles" tables on your website.
The Roles table -
This table should define what all roles your website has; and it's optional if you have very limited roles ( typically < 5). But if you want your site to be more dynamic, you'll want to have a table that clearly defines various roles. It could be as simple as: -
id | role | description |
1 | SuperAdmin | Super Admin of The Site |
2 | User | Regular signed-in member of the site |
Then, the second table will be "User_Roles" table -
id | user_id | role_id | created_at | updated_at |
1 | 1 | 1 | 2019-03-15 00:00:00 | 2019-03-15 00:00:00
2 | 10 | 2 | 2019-03-15 00:00:00 | 2019-03-15 00:00:00
...this is your relationships table that will store the user_id and the corresponding role_id. For example, the second table defines "user_id" 1 has "role_id" 1 -> which is the SuperAdmin. Hence, whenever the user with ID = 1 logs-in to the site; they'll have greater privileges on the site.
How you make use of these two tables in your code is up to you and can be determined by the framework or programming language that you're using.
I hope this gives you some idea to get started. If you have follow up questions, post them below.
Yes! I got it. Thank you so much sir. I am proceeding with this, and will ask you if i have any other query. again thank you. It really give me a idea.