How to handle different roles with different previliges in PHP?

Posted by user261002 on Stack Overflow See other posts from Stack Overflow or by user261002
Published on 2010-05-24T20:26:22Z Indexed on 2010/05/24 20:31 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

I would like to know how we can create different "user Roles" for different users in PHP. example:

Administrator can create all types of users, add, view, manipulate data, delete managers, viewers, and workers, etc managers can only create, workers and viewers, can add and view data, workers can't create new users, but can only add data and view data, viewers can only view data that has been added to the DB by workers, managers and administrators.

I though its better to use different sessions like : $_SESSION['admin'] $_SESSION['manager'] $_SESSION['worker'] $_SESSION['viewvers'] and for every page check which of them have a true or yes value, but I want to know how do they do it in real and big projects??? is there any other way???

© Stack Overflow or respective owner

Related posts about php

Related posts about user