[ https://issues.apache.org/jira/browse/DIRGROOVY-7?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Grégory Joseph updated DIRGROOVY-7: ----------------------------------- Attachment: DIRGROOVY-7.patch Here's the patch. It does one additional thing: the keys of the map returned by {{o.a.d.g.jndi.DirContextToMapObjectFactory#getObjectInstance}} are NOT lowercased anymore; I found it very confusing to request the {{modifyTimestamp}} attribute but have to use {{modifytimestamp}} on my search results. Granted, now, if one requests {{modifytimestamp}}, they'll have to use {{modifyTimestamp}} too. The best would probably to do what ldap does, ie ignore the case of attribute names. ps: can't edit my own issue to fix the layout of the description, sorry. (I assumed the wiki-like syntax was enabled, apparently it's not) > 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 > Attachments: DIRGROOVY-7.patch > > > 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