소스 검색

Refs #4 memberOf structure

isundil 1 년 전
부모
커밋
562dc2eb3b
2개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 8 1
      routes/entity.ts
  2. 2 2
      src/ldapInterface.ts

+ 8 - 1
routes/entity.ts

@@ -87,8 +87,13 @@ class AttributesByClasses {
 
     public ToMap(): any {
         let result: any = {};
+        let classContent: any = {};
+
+        result.members = { memberOf: this.fUnmapped?.get("memberOf") || [] };
+        if (!result.members.memberOf.length)
+            result = {};
         for (let [ocKey, vals] of this.fEntries) {
-            let classContent: any = {};
+            classContent = {};
             for (let [i, j] of vals)
                 classContent[i] = j.length ? j : [""];
             result[ocKey] = classContent;
@@ -101,6 +106,8 @@ class AttributesByClasses {
         for (let [ocKey, _] of this.fEntries)
             result.push(ocKey);
         result.sort();
+        if (this.fUnmapped?.has("memberOf"))
+            result.unshift('members');
         return result;
     }
 

+ 2 - 2
src/ldapInterface.ts

@@ -71,7 +71,7 @@ class LDAPManager implements ILDAPManager {
 
 	private Search(base: string, scope: string, filter: string|undefined =undefined, attributes: string[]|undefined =undefined): Promise<Map<string, Map<string, string[]>>> {
 		return new Promise((ok, ko) => {
-			this.cli.search(base, { scope: scope, filter: filter, attributes: attributes, paged: false }, (err: any, res: any) => {
+			this.cli.search(base, { scope: scope, filter: filter, attributes: attributes || ['*', 'memberof'], paged: false }, (err: any, res: any) => {
 				if (err) {
 					console.error("Search error: ", { base: base, scope: scope, filter: filter, attributes: attributes });
 					ko(err);
@@ -250,4 +250,4 @@ export default class LDAPFactory {
 	}
 }
 
-export { ILDAPManager };
+export { ILDAPManager };