How to use the ldapjs.Change 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 auth0 / ad-ldap-connector / lib / users.js View on Github external
// AD will search and delay an error till later if no password is given
    if (password === '') {
      return callback(new WrongPassword(profile));
    }

    log('Change password for DN "' + profile.dn.green + '"');

    var modification = {};
    if(nconf.get('ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD') === true){
      modification.unicodePwd = Buffer.from('"'+password+'"',"utf16le").toString();
    }else{
      modification.userPassword = password;
    }

    var passwordResetChange = new ldap.Change({
      operation: 'replace',
      modification: modification
    });

    var changeSet = [passwordResetChange];

    if (nconf.get('AUTO_UNLOCK_ON_PASSWORD_CHANGE') === true) {
      var unlockAccountChange = {
        operation: 'replace',
        modification: { lockoutTime: 0 }
      };
      changeSet.push(unlockAccountChange);
    }

    self._client.modify(profile.dn, changeSet, function (err) {
      if (err) {
github DataFire / Integrations / integrations / manual / ldap / index.js View on Github external
const args = params.map(name => {
      if (fn === 'modify' && name === 'change') {
        return new ldapJS.Change(input[name]);
      }
      return input[name]
    });
    return getClient(context).then(client => {
github PhilWaldmann / openrecord / lib / stores / ldap / save.js View on Github external
tmp[name] = addedValues

                  values.push(
                    new ldap.Change({
                      operation: 'add',
                      modification: tmp
                    })
                  )
                }

                if (removedValues.length > 0) {
                  tmp = {}
                  tmp[name] = removedValues

                  values.push(
                    new ldap.Change({
                      operation: 'delete',
                      modification: tmp
                    })
                  )
                }
              } else {
                tmp = {}
                var operation = 'replace'

                if (value === null || value === '') {
                  if (oldValue === null || oldValue === '') {
                    operation = null
                  } else {
                    operation = 'delete'
                    tmp[name] = oldValue
                  }