node-ldap2json
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -6,3 +6,3 @@ var | ||
ldap.Attribute.settings.guid_format = ldap.GUID_FORMAT_B; | ||
//ldap.Attribute.settings.guid_format = ldap.GUID_FORMAT_B; | ||
@@ -25,2 +25,5 @@ function lditem2obj(lditem){ | ||
} | ||
if (lditem.telephoneNumber){ | ||
o.phone=lditem.telephoneNumber; | ||
} | ||
o.groups=lditem.memberOf; | ||
@@ -74,3 +77,4 @@ } else if(lditem.objectClass.indexOf('container')>-1){ | ||
var client=ldap.createClient({ | ||
url:'ldap://'+options.host+':389' | ||
url:'ldap://'+options.host+':389', | ||
timeout : 2000 | ||
}); | ||
@@ -89,3 +93,3 @@ var opts = { | ||
var items = []; | ||
client.timeout=0; | ||
client.search(options.base,opts,[new ldap.PagedResultsControl({value:{size:500}})],function(err,res){ | ||
@@ -135,3 +139,4 @@ if (err) { | ||
var client=ldap.createClient({ | ||
url:'ldap://'+options.host+':389' | ||
url:'ldap://'+options.host+':389', | ||
timeout : 2000 | ||
}); | ||
@@ -149,2 +154,3 @@ var opts = { | ||
} | ||
client.timeout=0; | ||
clientSearch(client,options,opts,function(e,itms){ | ||
@@ -166,3 +172,4 @@ cb(e,itms); | ||
var client=ldap.createClient({ | ||
url:'ldap://'+options.host+':389' | ||
url:'ldap://'+options.host+':389', | ||
timeout : 2000 | ||
}); | ||
@@ -180,2 +187,3 @@ var opts = { | ||
} | ||
client.timeout=0; | ||
clientSearch(client,options,opts,function(e,itms){ | ||
@@ -192,3 +200,4 @@ cb(e,itms); | ||
var client=ldap.createClient({ | ||
url:'ldap://'+options.host+':389' | ||
url:'ldap://'+options.host+':389', | ||
timeout : 2000 | ||
}); | ||
@@ -206,2 +215,3 @@ | ||
} else { | ||
client.timeout=0; | ||
client.search(options.base,opts,function(err,res) { | ||
@@ -245,3 +255,4 @@ if (err){ | ||
var client=ldap.createClient({ | ||
url:'ldap://'+options.host+':389' | ||
url:'ldap://'+options.host+':389', | ||
timeout : 2000 | ||
}); | ||
@@ -257,2 +268,3 @@ var opts = { | ||
} else { | ||
client.timeout=0; | ||
var items=[]; | ||
@@ -259,0 +271,0 @@ client.search(options.base,opts,function(err,res) { |
@@ -90,4 +90,3 @@ var | ||
checkOptions(options,function(newoptions){ | ||
options=newoptions; | ||
lib.getSGroupsInLdap(options,function(e,items){ | ||
lib.getSGroupsInLdap(newoptions,function(e,items){ | ||
if (e){ | ||
@@ -105,6 +104,5 @@ console.log("getSecurityGroups:"+e); | ||
checkOptions(options,function(newoptions){ | ||
options=newoptions; | ||
lib.getUser(options,username,password,function(e,user){ | ||
lib.getUser(newoptions,username,password,function(e,user){ | ||
if (e){ | ||
console.log("CheckUser err :"+e+'\n'+JSON.stringify(options)+'\n'+username+'\n'+password); | ||
console.log("CheckUser err :"+e+'\n'+JSON.stringify(newoptions)+'\n'+username+'\n'+password); | ||
cb(e,null); | ||
@@ -120,4 +118,3 @@ } else { | ||
checkOptions(options,function(newoptions){ | ||
options=newoptions; | ||
lib.searchUser(options,keyword,function(e,items){ | ||
lib.searchUser(newoptions,keyword,function(e,items){ | ||
if (e){ | ||
@@ -135,4 +132,5 @@ cb(e,null); | ||
checkOptions(options,function(newoptions){ | ||
newoptions.base=objectdn; | ||
lib.getObject(newoptions,function(e,item){ | ||
var newoptions2= extend({},newoptions); | ||
newoptions2.base=objectdn; | ||
lib.getObject(newoptions2,function(e,item){ | ||
if (e){ | ||
@@ -148,5 +146,7 @@ cb(e,null); | ||
exports.getObjectWithGuid=function(options,objectguid,cb){ | ||
console.log(objectguid+"---"+options.host); | ||
checkOptions(options,function(newoptions){ | ||
newoptions.base='<GUID=ed386d41-2888-4333-bd10-de6d2dcb193a>'; | ||
lib.getObject(newoptions,function(e,item){ | ||
var newoptions2= extend({},newoptions); | ||
newoptions2.base='<GUID='+objectguid+'>'; | ||
lib.getObject(newoptions2,function(e,item){ | ||
if (e){ | ||
@@ -153,0 +153,0 @@ cb(e,null); |
{ | ||
"name": "node-ldap2json", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "LDAP2JSON makes shortcuts LDAP.JS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,10 +12,10 @@ var | ||
host : '192.168.11.100', | ||
adminuser : 'usishi\\Administrator', | ||
adminpass : '1', | ||
adminuser : 'usishi\\fatih', | ||
adminpass : 'Ofelya2011', | ||
base : 'dc=usishi,dc=pvt' | ||
}, | ||
testuser:'fatih', | ||
testuserpass : '1', | ||
testuserpass : 'Ofelya2011', | ||
searchkeyword : 'gĂśk', | ||
searchguid : 'ed386d41-2888-4333-bd10-de6d2dcb193a' | ||
searchguid : 'a8269929-a0cd-41c5-a3cb-1c566506f2d2' | ||
} | ||
@@ -65,2 +65,3 @@ | ||
items.length.should.be.above(0); | ||
console.log(items.length); | ||
done(); | ||
@@ -67,0 +68,0 @@ }); |
173195
485