lemonldap-ng-conf-ldap
Advanced tools
Comparing version 0.5.1 to 0.5.4
@@ -1,22 +0,21 @@ | ||
/* | ||
* LemonLDAP::NG LDAP configuration accessor for Node.js | ||
* | ||
* See README.md for license and copyright | ||
*/ | ||
(function() { | ||
/* | ||
* LemonLDAP::NG LDAP configuration accessor for Node.js | ||
* | ||
* See README.md for license and copyright | ||
*/ | ||
var ldapConf; | ||
ldapConf = (function() { | ||
function ldapConf(args) { | ||
ldapConf = class ldapConf { | ||
constructor(args) { | ||
var a, i, len, ref; | ||
ref = ['ldapServer', 'ldapConfBase']; | ||
// ldapServer ldapConfBase ldapBindDN ldapBindPassword | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
a = ref[i]; | ||
if (!args[a]) { | ||
throw "Missing " + a + " argument"; | ||
throw `Missing ${a} argument`; | ||
} | ||
} | ||
this.ldapServer = args.ldapServer.match(/^ldap/) ? args.ldapServer : "ldap://" + args.ldapServer; | ||
this.ldapServer = args.ldapServer.match(/^ldap/) ? args.ldapServer : `ldap://${args.ldapServer}`; | ||
this.ldapConfBase = args.ldapConfBase; | ||
@@ -34,3 +33,3 @@ this.dn = args.ldapBindDN; | ||
ldapConf.prototype.available = function() { | ||
available() { | ||
var self; | ||
@@ -42,7 +41,7 @@ self = this; | ||
if (err) { | ||
return reject("LDAP bind failed: " + err); | ||
return reject(`LDAP bind failed: ${err}`); | ||
} | ||
data = []; | ||
opt = { | ||
filter: "(objectClass=" + self.objClass + ")", | ||
filter: `(objectClass=${self.objClass})`, | ||
scope: 'sub', | ||
@@ -56,3 +55,3 @@ attributes: [self.idAttr] | ||
res.on('error', function(err) { | ||
return reject("LDAP search failed: " + err); | ||
return reject(`LDAP search failed: ${err}`); | ||
}); | ||
@@ -75,5 +74,5 @@ return res.on('end', function(result) { | ||
}); | ||
}; | ||
} | ||
ldapConf.prototype.lastCfg = function() { | ||
lastCfg() { | ||
var self; | ||
@@ -84,9 +83,9 @@ self = this; | ||
return resolve(av.pop()); | ||
})["catch"](function(err) { | ||
}).catch(function(err) { | ||
return reject(err); | ||
}); | ||
}); | ||
}; | ||
} | ||
ldapConf.prototype.load = function(cfgNum, fields) { | ||
load(cfgNum, fields) { | ||
var q, self; | ||
@@ -98,3 +97,3 @@ self = this; | ||
if (err) { | ||
return reject("LDAP bind failed: " + err); | ||
return reject(`LDAP bind failed: ${err}`); | ||
} | ||
@@ -104,6 +103,6 @@ data = []; | ||
opt = { | ||
filter: "(objectClass=" + self.objClass + ")", | ||
filter: `(objectClass=${self.objClass})`, | ||
scope: 'sub' | ||
}; | ||
return self.ldap.search(self.idAttr + "=lmConf-" + cfgNum + "," + self.base, opt, function(err, res) { | ||
return self.ldap.search(`${self.idAttr}=lmConf-${cfgNum},${self.base}`, opt, function(err, res) { | ||
if (err) { | ||
@@ -116,3 +115,3 @@ throw err; | ||
res.on('error', function(err) { | ||
return reject("LDAP search failed: " + err); | ||
return reject(`LDAP search failed: ${err}`); | ||
}); | ||
@@ -124,3 +123,3 @@ return res.on('end', function(result) { | ||
if (!$_.match(/^\{(.*?)\}(.*)/)) { | ||
reject("Bad conf line: " + $_); | ||
reject(`Bad conf line: ${$_}`); | ||
} | ||
@@ -140,10 +139,8 @@ k = RegExp.$1; | ||
}); | ||
}; | ||
} | ||
return ldapConf; | ||
}; | ||
})(); | ||
module.exports = ldapConf; | ||
}).call(this); |
@@ -6,3 +6,3 @@ { | ||
"name": "lemonldap-ng-conf-ldap", | ||
"version": "0.5.1", | ||
"version": "0.5.4", | ||
"description": "LemonLDAP::NG handler for Node.js", | ||
@@ -24,2 +24,4 @@ "main": "lib/index", | ||
"lib", | ||
"CHANGELOG.md", | ||
"LICENSE", | ||
"README.md" | ||
@@ -51,2 +53,2 @@ ], | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6146