1. Home >
  2. Apps >
  3. Groups >

How can we manage three types of account in any website(My Startup). i.e, User, Super user, Admin?

Question asked by Vinay Mishra in #Startups & Business on Mar 16, 2019
Vinay Mishra
Vinay Mishra · Mar 16, 2019
Rank C1 - EXPERT

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
Kaustubh Katdare
Kaustubh Katdare · Mar 17, 2019
Rank A1 - PRO

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 | 

...like that.

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.

Vinay Mishra
Vinay Mishra · Mar 17, 2019
Rank C1 - EXPERT

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.

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up