Support for "returning attributes" in searches
----------------------------------------------
Key: DIRGROOVY-7
URL: https://issues.apache.org/jira/browse/DIRGROOVY-7
Project: Directory Groovy LDAP
Issue Type: Improvement
Reporter: Grégory Joseph
Assignee: Stefan Zoerner
While the {{o.a.d.groovyldap.Search}} currently holds an {{attrs}} array for
these, and they are set accordingly on the SearchControls instance, 2 things
are missing to make it useful:
* support for this in the Map-based constructor
* {{o.a.d.groovyldap.jndi.DirContextToMapObjectFactory}} should use these
attributes (they're passed as {{attrs}} to the {{getObjectInstance}} instance)
instead of getting all attributes from the current record.
This would have two benefits:
* a presumed performance gain ? (I've always assumed that's one of the reasons
for passing "returning attributes" to searches)
* the ability to retrieve operational attributes such as 'createTimestamp' and
'modifyTimestamp' which are not retrieved when not specified explicitly.
I'll attach a patch that makes the following code work:
{code}
def LDAP ldap = LDAP.newInstance('ldap://localhost/dc=example,dc=com')
ldap.search(
'base': 'ou=users',
'filter': '(objectClass=posixAccount)',
'attrs': ['uid','cn',
'createTimestamp', 'creatorsName',
'modifyTimestamp', 'modifiersName'
]
).each {
println """${it.uid}: ${it.cn}
mod: ${it.modifyTimestamp} (${it.creatorsName})
cre: ${it.createTimestamp} (${it.modifiersName})"""
}{code}
(with the current groovyldap, the "mod" and "cre" lines print nulls)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira