ldap-async
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -133,6 +133,7 @@ /// <reference types="node" /> | ||
attrs: Map<string, Attribute>; | ||
dn: string; | ||
constructor(data: SearchEntry, client: Ldap); | ||
get(attr: string): string | undefined; | ||
one(attr: string): string | undefined; | ||
first(attr: string): string | undefined; | ||
get(attr: string): string; | ||
one(attr: string): string; | ||
first(attr: string): string; | ||
all(attr: string): string[]; | ||
@@ -139,0 +140,0 @@ buffer(attr: string): Buffer | undefined; |
@@ -216,3 +216,3 @@ "use strict"; | ||
for (const entry of results) | ||
ret.set(entry.get('dn'), entry); | ||
ret.set(entry.dn, entry); | ||
})); | ||
@@ -456,5 +456,4 @@ } | ||
for (const sg of groups) { | ||
const dn = sg.one('dn'); | ||
if (!groupsExplored.has(dn)) { | ||
groupsExplored.add(dn); | ||
if (!groupsExplored.has(sg.dn)) { | ||
groupsExplored.add(sg.dn); | ||
await this.getMemberRecur(ret, sg, groupsExplored); | ||
@@ -524,2 +523,3 @@ } | ||
this.attrs = new Map(); | ||
this.dn = data.pojo.objectName; | ||
for (const attr of data.attributes) { | ||
@@ -531,4 +531,3 @@ const attrWithoutOptions = attr.type.split(';', 2)[0].toLocaleLowerCase(); | ||
get(attr) { | ||
var _a, _b; | ||
return (_b = (_a = this.attrs.get(attr.toLocaleLowerCase())) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b[0]; | ||
return this.all(attr)[0]; | ||
} | ||
@@ -543,2 +542,4 @@ one(attr) { | ||
var _a, _b; | ||
if (attr === 'dn') | ||
return [this.dn]; | ||
return (_b = (_a = this.attrs.get(attr.toLocaleLowerCase())) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : []; | ||
@@ -579,3 +580,3 @@ } | ||
toJSON() { | ||
const obj = {}; | ||
const obj = { dn: this.dn }; | ||
for (const attr of this.attrs.values()) { | ||
@@ -609,3 +610,2 @@ if (attr.buffers.length > 0) { | ||
let entry = this; | ||
const dn = this.get('dn'); | ||
const attrWithOptions = [attr, ...this.options(attr).filter(o => !o.startsWith('range='))].join(';'); | ||
@@ -623,3 +623,3 @@ const ret = []; | ||
const newHigh = newLow + pageSize - 1; | ||
entry = (await this.client.load(dn, attrWithOptions + `;range=${newLow}-${newHigh}`)); | ||
entry = (await this.client.load(this.dn, attrWithOptions + `;range=${newLow}-${newHigh}`)); | ||
} | ||
@@ -626,0 +626,0 @@ } |
{ | ||
"name": "ldap-async", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "A wrapper around ldapjs to provide promises, pooling, config by environment, and other conveniences.", | ||
@@ -5,0 +5,0 @@ "exports": { |
@@ -82,3 +82,3 @@ # Overview | ||
const people = await ldap.search('ou=people,dc=yourdomain,dc=com', { scope: 'sub', filter: 'objectclass=person' }) | ||
console.log(people.toJSON()) // [{ givenName: 'John', ... }, { givenName: 'Mary', ... }] | ||
console.log(people.map(p => p.toJSON())) // [{ givenName: 'John', ... }, { givenName: 'Mary', ... }] | ||
``` | ||
@@ -85,0 +85,0 @@ ## Return object |
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
786
46343