Re: [phplib] A different Perm scheme From: Jesse Swensen (swensenj <email protected>)
Date: 09/13/00

Robin's solution may work. I have never tried it. What I have done is to
use the perms as follows:

First you decide on your "base" perms. The default are like:

  var $permissions = array(
                            "user" => 1,
                            "author" => 2,
                            "editor" => 4,
                            "supervisor" => 8,
                            "admin" => 16
                          );
I believe the design was to use binary math to produce the perms, so if we
wanted the admin to also have the user perm we would add 16 + 1 and assign
17 to admin. Let's say you want the admin to be able to do all roles then
you would add 16+8+4+2+1 to get 31. Now I say want the author and editor
role to be user, I would assign 5 to editor and 3 to author and if
supervisor was all the below then 8+4+2+1=15. Now we go back to the perms
subclass and define permissions this way:

  var $permissions = array(
                            "user" => 1,
                            "author" => 3,
                            "editor" => 5,
                            "supervisor" => 15,
                            "admin" => 31
                          );

This will do what you want...

-- 
Jesse Swensen
swensenj <email protected>

> From: "Robin Bowes" <robin.bowes <email protected>> > Date: Wed, 13 Sep 2000 19:42:41 +0100 > To: "'Nico Alberti'" <albertin <email protected>>, <phplib <email protected>> > Subject: RE: [phplib] A different Perm scheme > >> Does anybody know an authorization scheme to make a page with, for >> example >> >> $perm->check("admin", "user") >> >> be accessible with people with admin OR user rights? > > Nico, > > I believe the following will do what you want: > > $perm->check("admin,user") > > R. > > --------------------------------------------------------------------- > 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>