you might want to create a table called perms and have each row contain a
user id and a perm for each
the way i have mine setup is a bit more complex but fully configurable.
Here's how i would set it up
user_permissions
- user_id
- action
- value
user_actions
- id
- title
users
- id
- username
- passwd
then to get the permissions i would use a user object maybe something like
this
class user {
var $_id;
var $_permissions;
function user() {
$this->loadPermissions();
}
function hasPermission($val) {
$perm = $this->getPermission($val);
if(isset($perm) && $perm == 1) return true;
else return false
}
function loadPermissions() {
global $db;
$res = $db->Query("SELECT user_permissions.value, user_actions.title value
FROM user_permissions INNER JOIN user_actions ON
user_permissions.action==user_actions.id"
$data = $db->fetchAll($res);
return $data
}
}
Understand that this code will not work out of the box and no security
measures were implemented, i did this just to show an example ;)
In my system i have user permissions and group permissions, i load the group
permissions then override with the user permissions.
--
Joseph Crawford Jr.
Zend Certified Engineer
Codebowl Solutions, Inc.
1-802-671-2021
[EMAIL PROTECTED]