Page 2 of 2

Posted: Sat Jul 15, 2006 2:13 pm
by basdog22
maybe off topic or totally wrong:

Code: Select all

user_id user_of name
1             0         john
2             1         mary
3             0         bill
4              2        jack

couldn't this menu style user management be of any use?

Posted: Mon Jul 17, 2006 12:19 pm
by Ward
I have seen a system using bits that may work for you. You define levels of permission, and each action has a minimum level. For example:

Code: Select all

define("PERM_SUPER_ADMIN",3);
define("PERM_ADMIN",2);
define("PERM_POWER_USER",1);
define("PERM_USER",0);


// Sample to check user's permission level
if ($myPermissionLevel > PERM_ADMIN)
{
     // user is at least an admin
}

if ($myPermissionLevel == PERM_SUPER_ADMIN)
{
     // user is a super admin
}
This is of course a simple example, in a real-life situation you would probably have many more levels. However, this eliminates the need for join tables in a database, each user is simply assigned an integer value.

Posted: Mon Jul 17, 2006 7:47 pm
by Jenk
Permissions table: userID (key), edit, post, delete, ban, blah, blah..

Code: Select all

select * from permissions where userid = $userid

Code: Select all

public function checkPerm ($perm) //need a comb? :p
{
    if ($this->perms[$perm] == '1') return TRUE;
    else return FALSE;
}