/** * Enter description here... * * @param string $aro * @param string $aco * @param string $action * @return boolean * @access public */ function check($aro, $aco, $action = "*") { $Perms = new ArosAco(); $Aro = new Aro(); $Aco = new Aco(); if ($aro == null || $aco == null) { return false; } $permKeys = $this->_getAcoKeys($Perms->loadInfo()); $aroPath = $Aro->getPath($aro); $tmpAcoPath = $Aco->getPath($aco); if ($tmpAcoPath === null) { return false; } $tmpAcoPath = array_reverse($tmpAcoPath); $acoPath = array(); if ($action != '*' && !in_array('_' . $action, $permKeys)) { trigger_error('ACO permissions key "' . $action . '" does not exist in DB_ACL::check()', E_USER_NOTICE); return false; } foreach ($tmpAcoPath as $a) { $acoPath[] = $a['Aco']['id']; } for ($i = count($aroPath) - 1; $i >= 0; $i--) { $perms = $Perms->findAll(array('ArosAco.aro_id' => $aroPath[$i]['Aro']['id'], 'ArosAco.aco_id' => $acoPath), null, 'Aco.lft desc'); if ($perms == null || count($perms) == 0) { continue; } else { foreach ($perms as $perm) { if ($action == '*') { // ARO must be cleared for ALL ACO actions foreach ($permKeys as $key) { if (isset($perm['ArosAco'])) { if ($perm['ArosAco'][$key] != 1) { return false; } } } return true; } else { switch ($perm['ArosAco']['_' . $action]) { case -1: return false; case 0: continue; break; case 1: return true; break; } } } } } return false; }