Sv: [phplib] Numeric check on permissions From: Klaus Seidenfaden (ks <email protected>)
Date: 05/11/01

-----Oprindelig meddelelse-----
Fra: James Johnson <james <email protected>>

>if ( user has perm represented in $perm_required )
> do_something ();
>
>What is the most elegant way to do this?

Bitwise or/bitwise and, depending on whether the user must have just one of the permissions in $perm_required, or all of them. Check the source (perm.inc) - Perm::have_perm() and Perm::permsum() contain relevant code. Make a subclass of Perm with a method to return a numeric representation of the user's permissions, then do your check. Or, better yet, pass $perm_required to your new method, and have it perform the check for you.

-- KLaus.

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