How to use the ldapjs.parseFilter function in ldapjs

To help you get started, we’ve selected a few ldapjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joyent / moray / lib / db / objects.js View on Github external
if (!schema[k])
            return false;

        switch (schema[k].type) {
        case 'boolean':
            return v ? 'true' : 'false';

        case 'number':
            return v;

        default:
            return '\'' + v + '\'';
        }
    }

    var f = ldap.parseFilter(query);
    var where = '';
    var val;

    switch (f.type) {
    case 'and':
    case 'or':
        var vals = [];
        for (var i = 0; i < f.filters.length; i++) {
            var _f = f.filters[i].toString();
            val = compileQuery(bucket, schema, _f, true);
            if (val)
                vals.push(val);
        }
        if (!child && vals.length === 0)
            throw new NotIndexedError(bucket, query);
        where += '(' + vals.join(' ' + f.type.toUpperCase() + ' ') + ')';
github PhilWaldmann / openrecord / lib / stores / ldap / helper.js View on Github external
}))
        }
        
        if(or.length > 0){
          tmp.addFilter(new ldap.OrFilter({filters: or}));
        }
        
        continue;
      }
      
    }else{
      var query = conditions[i].query;
      var args = conditions[i].args;
      //TODO: put args into query
      
      var custom = ldap.parseFilter(query);
      
      if(conditions.length === 1){
        operator.filter = custom;
      }else{
        tmp.addFilter(custom);
      }
      
    }
    
  }
};