Provide accessor for SearchEntry object

This commit is contained in:
ecs-hk 2023-07-26 09:35:06 -04:00
parent 1cc6a733ba
commit 46b7de1130
1 changed files with 6 additions and 2 deletions

View File

@ -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
}