public static function sqlCondition($columnName, $action, $objectType = null)
    {
        global $PPHP;
        $db = $PPHP['db'];
        $sqlTRUE = '(1=1)';
        $sqlFALSE = '(1=2)';

        if (!isset($_SESSION['ACL_INFO'])) {
            return $db->query($sqlFALSE);
        };
        $acl = $_SESSION['ACL_INFO'];

        $granted = array();
        foreach (array('*', $action) as $act) {
            if (array_key_exists($act, $acl)) {
                $acl2 = $acl[$act];
                foreach (array('*', $objectType) as $typ) {
                    if (array_key_exists($typ, $acl2)) {
                        $granted = array_merge($granted, $acl2[$typ]);
                    };
                };
            };
        };
        if (in_array(0, $granted)) {
            return $db->query($sqlTRUE);
        } elseif (count($granted) === 1) {
            return $db->query("{$columnName}=?", $granted[0]);
        } elseif (count($granted) > 0) {
            return $db->query("{$columnName} IN")->varsClosed($granted);
        };
        return $db->query($sqlFALSE);
    }