includes/sessions.php
changeset 1155 a1770361ef88
parent 1148 dcf6e9394e02
child 1157 e154e8176700
child 1158 e733f984c990
equal deleted inserted replaced
1154:87cd48776632 1155:a1770361ef88
  3351    * @return bool
  3351    * @return bool
  3352    */
  3352    */
  3353    
  3353    
  3354   function acl_check_deps($type, $debug = false)
  3354   function acl_check_deps($type, $debug = false)
  3355   {
  3355   {
       
  3356     global $paths;
       
  3357     
  3356     // This will only happen if the permissions table is hacked or improperly accessed
  3358     // This will only happen if the permissions table is hacked or improperly accessed
  3357     if(!isset($this->acl_deps[$type]))
  3359     if(!isset($this->acl_deps[$type]))
  3358       return true;
  3360       return true;
  3359     // Permission has no dependencies?
  3361     // Permission has no dependencies?
  3360     if(sizeof($this->acl_deps[$type]) < 1)
  3362     if(sizeof($this->acl_deps[$type]) < 1)
  3365     {
  3367     {
  3366       $j = sizeof($deps);
  3368       $j = sizeof($deps);
  3367       for ( $i = 0; $i < $j; $i++ )
  3369       for ( $i = 0; $i < $j; $i++ )
  3368       {
  3370       {
  3369         $b = $deps;
  3371         $b = $deps;
       
  3372         if ( !$this->check_acl_scope($deps[$i], $paths->namespace) )
       
  3373         {
       
  3374           // Action $type depends on action $deps[$i] which cannot be satisfied because $deps[$i] is out of scope.
       
  3375           trigger_error("acl_check_deps: $type depends on {$deps[$i]} which is not within scope of $paths->namespace; this indicats a bug in ACL rule specification", E_USER_WARNING);
       
  3376           return false;
       
  3377         }
  3370         $deps = array_merge($deps, $this->acl_deps[$deps[$i]]);
  3378         $deps = array_merge($deps, $this->acl_deps[$deps[$i]]);
  3371         if( $b == $deps )
  3379         if( $b == $deps )
  3372         {
  3380         {
  3373           break 2;
  3381           break 2;
  3374         }
  3382         }
  4522     {
  4530     {
  4523       $j = sizeof($deps);
  4531       $j = sizeof($deps);
  4524       for ( $i = 0; $i < $j; $i++ )
  4532       for ( $i = 0; $i < $j; $i++ )
  4525       {
  4533       {
  4526         $b = $deps;
  4534         $b = $deps;
       
  4535         if ( !isset($this->acl_deps[$deps[$i]]) )
       
  4536         {
       
  4537           // Action $type depends on action $deps[$i] which cannot be satisfied because $deps[$i] is out of scope.
       
  4538           trigger_error("acl_check_deps: $type depends on {$deps[$i]} which is not within scope of $this->namespace; this indicats a bug in ACL rule specification", E_USER_WARNING);
       
  4539           return false;
       
  4540         }
  4527         $deps = array_merge($deps, $this->acl_deps[$deps[$i]]);
  4541         $deps = array_merge($deps, $this->acl_deps[$deps[$i]]);
  4528         if( $b == $deps )
  4542         if( $b == $deps )
  4529         {
  4543         {
  4530           break 2;
  4544           break 2;
  4531         }
  4545         }