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. 

Replies

  • Kaustubh Katdare
    Kaustubh Katdare

    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

    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 are reading an archived discussion.

Related Posts

MamePlease send me my e. maileSaharawatkumar@gmail.comJlpt N5past question paper  please help me
Design News says: Over the past few years, the world of small robots has expanded considerably. Robots have become affordable for smaller manufacturers. The result is that robots are getting...
Actually i am interested in a much more creative field such as animation and graphics drawing and painting and i really don't enjoy being  software developer for sure so i...
In school, I had chance to learn about the movement of the gyroscope, its orbits, dynamic energy etc.However the spinning direction  was not referred to.Recently I played with a spindle,...
I got 60.77 marks in gate 2019 mechanical (general category).score 637 rank 4610. can I get into top NITs?