What I think you're really asking is: What is the best way to handle users and permissions?
This is a difficult issue to tackle, because the more flexible you want to make your permissions levels, the more complicated it is to design the application. You need to create a database schema that efficiently stores these permissions and know where these permissions affect your application.
For this reason, many applications only have two or three real levels of permissions. This site, for example, only has three that I can figure. There's an administrative level, a moderator level, and a regular user level.
Each level gets more restrictive. In other words, a moderator can do everything a regular user can do plus some extra stuff. An administrator can do everything a moderator can do, plus extra stuff.
This style of permissions is fairly easy to implement. You can use a numeric ID for the permissions levels. If a user's permission level is >= some number, then they have permission to do something. If it's <, they don't.
If, on the other hand, you want permissions being assigned to specific bits of functionality, things get much more complex.
For example, if you want to have a lot of different "regular users" each have priveledges that other users don't, then you have to start dealing with creating groups. Permissions are assigned to a group of users. Users can belong to many different groups.
Suppose for example that I belonged to a group of "PHP moderators". I would ONLY have moderator priveldges on the PHP forums on this site. I would NOT have moderator priveledges in, say, the C++ forums.
As you can probably imagine, this is a much tougher nut to crack, so most people settle for the simpler style. I'm a "moderator" on this site, which means that I can muck with ANY of the forums, even though I only really post to the PHP ones.
Hope this helps,
Nik
|