无法从searchEntry中检索objectName,当我将ldapjs更新到v3时。

huangapple go评论77阅读模式
英文:

Cannot retrive objectName from searchEntry when I update ldapjs to v3

问题

I recently upgraded the package ldapjs from v2 to v3. When I search for a user attribute with searchEntry, I get an empty object, but all other functions worked without a problem, this is my code:

client.search(adSuffix, searchOptions, async (err: any, res: any) => {
  assert.ifError(err);
  await res.on('searchEntry', async (entry: any) => {
    //
    //this part was working normally with ldapjs v2
    //
    console.log("entry.objectName ", entry.objectName);
    //but now I get an empty object
  });
});

Did someone have the same issue? or know how to fix it?

英文:

I recently upgraded the package ldapjs from v2 to v3. When I search for a user attribute with searchEntry, I get an empty object, but all others functions worked without a problem, this is my code:

          client.search(adSuffix, searchOptions, async (err: any, res: any) => {
            assert.ifError(err);
            await res.on('searchEntry', async (entry: any) => {
             //
             //this part was working normaly with ldapjs v2
             //
             console.log("entry.objectName ",entry.objectName);
             //but now i get an empty object
            });
          });

Did someone had the same issue ? or know how to fix it ?

答案1

得分: 0

我找到了解决方案,我添加了 .pojo 以访问对象:

res.on('searchEntry', async (entry: any) => {
    console.log('entry: ' + JSON.stringify(entry.pojo.objectName));
}
英文:

I found the solution, I added .pojo to access to the object:

res.on('searchEntry', async (entry: any) => {
             console.log('entry: ' + JSON.stringify(entry.pojo.objectName));
}

huangapple
  • 本文由 发表于 2023年4月11日 16:59:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75984099.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定