How to use the ldapjs.EqualityFilter 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 conjurinc / teleport / lib / ldap / listUsers.js View on Github external
function listUsers(req, res, next) {
	assert([ 2, 3 ].indexOf(keys(req.rdns).length) !== null);
	assert('teleport' === req.rdns.o);
	assert('users' === req.rdns.ou);
	var layer = req.bindLayer;
	assert(layer);
	// If searching for a specific user
	var uid = req.rdns.uid;

  if ( uid ) {
    req.filter = new ldap.AndFilter({
      filters: [req.filter, new ldap.EqualityFilter({attribute: 'uid', value: uid})]
    });
  }
	
  var resultCount = 0;
  
	function end(err) {
		log.info({requestId: req.logId, command: 'listUsers', resultCount: resultCount}, "Sent %d users", resultCount);
    res.end();
		next(err);
	}

	dataStore.layerUsers(layer).on('user', function(user) {
    var attributes = clone(user);
    // Apply some defaults
    if ( !attributes.uid ) attributes.uid = user.uid;
    if ( !attributes.cn ) attributes.cn = user.uid;
github PhilWaldmann / openrecord / lib / stores / ldap / data_types / _operators.js View on Github external
binary: function(attr, value, options) {
            value = this.definition.cast(attr, value, 'write', this)
            options.filter.filters.push(
              new ldap.EqualityFilter({ attribute: attr, value: value })
            )
          }
        }
github PhilWaldmann / openrecord / lib / stores / ldap / data_types / _operators.js View on Github external
function(attr, value, options) {
        options.filter.filters.push(
          new ldap.NotFilter({
            filter: new ldap.EqualityFilter({ attribute: attr, value: value })
          })
        )
      },
      {
github PhilWaldmann / openrecord / lib / stores / activedirectory / data_types / guid.js View on Github external
defaultMethod: function(attr, value, options) {
              value = this.definition.cast(attr, value, 'write', this)
              options.filter.filters.push(
                new ldap.EqualityFilter({ attribute: attr, value: value })
              )
            },