node-ldap2json
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -38,16 +38,22 @@ var ldap = require('ldapjs') | ||
items.forEach(function(itm){ | ||
var o= new Object(); | ||
o.path=itm.distinguishedName; | ||
o.hide=(itm.showInAdvancedViewOnly=="TRUE") ? true : false; | ||
if (itm.objectClass.indexOf('organizationalUnit')>-1){ | ||
var o={}; | ||
o.type='OU'; | ||
o.name=itm.ou; | ||
o.path=itm.distinguishedName; | ||
retitems.push(o); | ||
} | ||
if (itm.objectClass.indexOf('person')>-1){ | ||
var o={}; | ||
} else if (itm.objectClass.indexOf('person')>-1){ | ||
o.type='USER'; | ||
o.name=itm.cn; | ||
o.path=itm.distinguishedName; | ||
retitems.push(o); | ||
} | ||
} else if(itm.objectClass.indexOf('container')>-1){ | ||
o.type='CN'; | ||
o.name=itm.cn; | ||
retitems.push(o); | ||
} else if(itm.objectClass.indexOf('group')>-1){ | ||
o.type='GROUP'; | ||
o.name=itm.cn; | ||
retitems.push(o); | ||
} else console.log(itm.cn+'--'+itm.objectClass); | ||
count--; | ||
@@ -54,0 +60,0 @@ if (count<=0){ |
@@ -8,7 +8,23 @@ var | ||
var fillChilds=function(itm,options,cr,cb){ | ||
if (itm.hide){ | ||
cb(null); | ||
return; | ||
} | ||
var newSearchOptions= extend({},options); | ||
var searchChild=true; | ||
if (itm.type=="OU"){ | ||
newSearchOptions.base='ou='+itm.name+','+options.base; | ||
if(itm.type=="OU"){ | ||
newSearchOptions.base='ou='+itm.name+','+options.base; | ||
} else if (itm.type=="CN") { | ||
newSearchOptions.base='cn='+itm.name+','+options.base; | ||
} else { | ||
searchChild=false; | ||
} | ||
if (searchChild){ | ||
cr.getJson(newSearchOptions,function(e,t){ | ||
if (e){ | ||
console.log(e); | ||
console.log(newSearchOptions); | ||
} | ||
if (t.items.length>0){ | ||
@@ -21,4 +37,3 @@ itm.haschilds=true; | ||
cb(itm); | ||
}); | ||
}); | ||
} else { | ||
@@ -42,3 +57,3 @@ itm.haschilds=false; | ||
var count=items.length; | ||
if (count==0){ | ||
if (count==0) { | ||
cb(null,me); | ||
@@ -48,3 +63,5 @@ } else { | ||
fillChilds(itm,options,recfunc,function(obj){ | ||
me.items.push(obj); | ||
if (me!=null){ | ||
me.items.push(obj); | ||
} | ||
count--; | ||
@@ -51,0 +68,0 @@ if(count<=0){ |
{ | ||
"name": "node-ldap2json", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "LDAP2JSON makes a json return from LDAP Tree", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
5288
141