/[docman2]/docman.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /docman.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by dpavlin, Sun Jul 28 17:51:20 2002 UTC revision 1.21 by dpavlin, Sun Jul 28 18:27:18 2002 UTC
# Line 1393  function in_group($user,$group) { Line 1393  function in_group($user,$group) {
1393  }  }
1394    
1395  // helper function  // helper function
1396  function unroll_perm($u,$t,$user,$perm) {  function unroll_perm($u,$t,$user,$perm,$one_level) {
1397    
1398          // check user FIX          if ($t & trmask_one_level && !$one_level) return $perm;
1399          if ($t & trmask_not && ($u==$user)) continue;  
1400          if (!($t & trmask_not) && ($u!=$user)) continue;          // user is user whose trustee is this
1401            if ($t & trmask_not && ($u==$user)) return $perm;
1402            if (!($t & trmask_not) && ($u!=$user)) return $perm;
1403    
1404          if ($t & trmask_deny) {          if ($t & trmask_deny) {
1405                  if ($t & trmask_clear) {                  if ($t & trmask_clear) {
# Line 1429  $debug .= "<br>check_trustee $path ... " Line 1431  $debug .= "<br>check_trustee $path ... "
1431                  $tmppath.=array_shift($path_arr);                  $tmppath.=array_shift($path_arr);
1432  $debug.= ">> $tmppath ";  $debug.= ">> $tmppath ";
1433    
                 # clear one level flag  
                 $perm['allow'] &= ~trmask_one_level;  
                 $perm['deny'] &= ~trmask_one_level;  
   
1434                  if (! isset($trustees[$tmppath])) continue;                  if (! isset($trustees[$tmppath])) continue;
1435                  $tr = $trustees[$tmppath];                  $tr = $trustees[$tmppath];
1436    
1437                    $one_level = (!count($path_arr));
1438    $debug.=" O($one_level) ";
1439    
1440                  if (isset($tr)) {                  if (isset($tr)) {
1441                          // first apply trustee for all                          // first apply trustee for all
1442                          if (isset($tr['*'])) {                          if (isset($tr['*'])) {
1443                                  $perm = unroll_perm($user,$tr['*'],$user, $perm);                                  $perm = unroll_perm($user,$tr['*'],'*', $perm, $one_level);
1444                                  unset($tr['*']);                                  unset($tr['*']);
1445                          }                          }
1446                          // then apply group policies                          // then apply group policies
# Line 1447  $debug.= ">> $tmppath "; Line 1448  $debug.= ">> $tmppath ";
1448                                  if ($t & trmask_group && in_group($user,$g)) {                                  if ($t & trmask_group && in_group($user,$g)) {
1449                                          // resolv user                                          // resolv user
1450                                          $t = $t & ~trmask_group;                                          $t = $t & ~trmask_group;
1451                                          $perm = unroll_perm($user,$t,$user, $perm);                                          $perm = unroll_perm($user,$t,$g, $perm, $one_level);
1452                                          unset($tr[$g]);                                          unset($tr[$g]);
1453                                  }                                  }
1454                          }                          }
1455                          // then apply user policy                          // then apply user policy
1456                          if (isset($tr[$user])) {                          if (isset($tr[$user])) {
1457                                  $perm = unroll_perm($user,$tr[$user],$user, $perm);                                  $perm = unroll_perm($user,$tr[$user],$user, $perm,$one_level);
1458                                  unset($tr[$user]);                                  unset($tr[$user]);
1459                          }                          }
1460                  }                  }

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.26