View Single Post
  #51 (permalink)  
Old 07-12-2008, 09:39 AM
ben ben is offline
Administrator
 
Join Date: Mar 2007
Posts: 93
ben has disabled reputation
Default Re: Fine Grained Role Based Access Control (RBAC) system

Quote:
Originally Posted by koveras225 View Post
I just downloaded this a few days ago and was exploring the code to get a better idea of how it works. I noticed something that seems rather odd and no matter what values I throw at it can't make any sense of it.

Code:
else if ($new_weight == $weight && (int) $is_allowed === 1 && (int) $is_allowed === 0){
This line in class.rbac_bv.php as far as I can tell, will never return true and run the code within the block. Perhaps I'm wrong, although I've just spent the last hour throwing values at it and haven't got it to return true. Is it an error, a mistype of !== or something perhaps? Or am I completely missing something...
Good catch, you are right the line will always return false.

The code is actually redundant and will not affect the results. You can safely remove the code snippet:

Code:
else if ($new_weight == $weight && (int) $is_allowed === 1 && (int) $conn->is_allowed === 0){
                
                // We always give more weight to denials.
                $is_allowed = $conn->is_allowed; // i.e. set to FALSE or 0
                $weight = $new_weight;
            }
If you do not remove it, it will not change anything either, it is just dead code that I forgot to remove.

Thanks for the heads up!

Ben
Reply With Quote