Re: [phplib] A different Perm scheme From: Nico Alberti (albertin <email protected>)
Date: 09/16/00

> > 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")
>
I tryed, but it doesn't seem to work for me, if I don't overload the check()
function of the Perm class this way (actually I get stuck in understanding
the have_perm() function, so there are probably better ways do achieve my
goal):

  function check() {
      global $auth;

      $Perm_ok=0;

      global $auth;

      $Perm_ok=0;

      $arg_list = explode(",",$p);
      foreach ($arg_list as $perm_value) {
        if ($this->have_perm($perm_value)) {
          $Perm_ok=1;
        }
      }
      if (!$Perm_ok) {
        if (! isset($auth->auth["perm"]) ) {
            $auth->auth["perm"] = "";
        }
        foreach ($arg_list as $value) {
          $p.="$value ";
        }
        $this->perm_invalid($auth->auth["perm"], $p);
        exit();
      }
    }

Ciao
Nico

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