From 46b7de113053a722ec33c97d17d440802fd5d086 Mon Sep 17 00:00:00 2001 From: ecs-hk <8094390+ecs-hk@users.noreply.github.com> Date: Wed, 26 Jul 2023 09:35:06 -0400 Subject: [PATCH] Provide accessor for SearchEntry object --- lib/messages/search_response.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/messages/search_response.js b/lib/messages/search_response.js index c9d88c6..2e6c9cb 100644 --- a/lib/messages/search_response.js +++ b/lib/messages/search_response.js @@ -74,7 +74,10 @@ SearchResponse.prototype.send = function (entry, nofiltering) { entry = new SearchEntry({ objectName: typeof (save.dn) === 'string' ? parseDN(save.dn) : save.dn, messageId: self.messageId, - attributes: Attribute.fromObject(entry.attributes) + attributes: Attribute.fromObject(entry.attributes), + getAttribute: function(a) { + this.attributes.filter(f => f.type === a).map(m -> m.values).pop() + } }) } @@ -100,7 +103,8 @@ SearchResponse.prototype.createSearchEntry = function (object) { const entry = new SearchEntry({ messageId: this.messageId, objectName: object.objectName || object.dn, - attributes: object.attributes ?? [] + attributes: object.attributes ?? [], + getAttribute: object.getAttribute ?? function() { return null } }) return entry }