示例#1
0
 /**
  * @desc      Alter the specified permissions bits
  * @param     mixed    $vPermissions   AclList (array) or simple permissions (int)
  * @param     int        $iWhat        Which permissions bit are involved
  * @param     string     $sUid         uid to check
  * @param     array      $aGid         groups to check
  * @param     bool       $bSet         set or remove
  * @return    bool                     success
  * @access    public
  * @author    Marc Groot Koerkamp
  */
 function alterPermission(&$vPermission, $iWhat, $sUid, $aGid, $bSet = true)
 {
     $bResult = true;
     if ($this->enable_acl) {
         // use tree defaults if sUid/aGid are not supplied
         if (!$sUid) {
             $sUid = $this->uid;
         }
         if (!count($aGid)) {
             $aGid = $this->gid;
         }
         if (!acl::alterMyPerm($vPermission, $iWhat, $sUid, $aGid, $bSet)) {
             return false;
         }
     } else {
         if ($bSet) {
             $vPermission = ($vPermission ^ $iWhat) + ($vPermission & $iWhat);
         } else {
             $vPermission = ($vPermission | $iWhat) - $iWhat;
         }
     }
     return $bResult;
 }