RE: [phplib] permissions From: Taylor, Stewart (Stewart.Taylor <email protected>)
Date: 05/25/01

You want to use the have_perm function

If you say have the permissions

user,designer,qa,admin

And the permissions property of perms is setup as

  permissions = array("user"=>1,
                      "designer"=>3,
                      "qa"=>7,
                      "admin"=>15);

The following should work.

// if permissions the same
if ($auth->auth["perms"] == $db->f("perms"))
{
 // permissions not higher so VIEW
}
// else, if got the permission
elseif ($perm->have_perm($db->f("perms"))
{
  // permissions must be higher so lets EDIT
}
// otherwise,
else
{
  // permissions lower to so VIEW

}

-Stewart

-----Original Message-----
From: Daniel Bondurant [mailto:bondu <email protected>]
Sent: 25 May 2001 01:10
To: phplib <email protected>
Subject: [phplib] permissions

I am printing out a list of all the users in the system, and if logged
in user's permission is higher then the user from the db, I want them to
be able to edit the user's info, otherwise they can only view.

How do check the permission of the logged in users versus the permission
in the database.

if ($perm->permissions[$q->f("Perms")]) <
$perm->permissions[$auth->auth["Perm"]] {
        edit
} else {
        view
}

this obviously won't work, but it is basically what i want to do. I
need to use permsum here somewhere, but I am not sure where it fits in.

thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>