You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by GitBox <gi...@apache.org> on 2019/10/02 10:24:35 UTC

[GitHub] [directory-server] alesuiss edited a comment on issue #23: DIRSERVER-1844 adding automatic memberOf attributes

alesuiss edited a comment on issue #23: DIRSERVER-1844 adding automatic memberOf attributes
URL: https://github.com/apache/directory-server/pull/23#issuecomment-537431674
 
 
   Hello all,
   
   I need this functionality too, so I've had a look yesterday. I've managed to advance quite a bit but I got stuck, so I'd like to ask for some input. Attached below is my current code (I can clean it up and do a proper PR once it works).
   
   TL;DR: how do you use an ExprNode in an EntryFilter?
   
   What currently works:
   - lookup works and adds the memberOf attributes
   - search also adds the memberOf attributes
   
   What doesn't:
   - search can't search on memberOf (necessary for most use cases)
   
   My approach in search is that I first remove any part of the filter ExprNode that checks memberOf (otherwise it returns empty since the attribute isn't set on entries):
   ```
           ExprNode filter = searchContext.getFilter() ;
           ExprNode newfilter = (ExprNode) filter.clone().accept(new RemoveMemberOfFilterVisitor()) ;
           if(newfilter == null)
               newfilter = ObjectClassNode.OBJECT_CLASS_NODE ;
           searchContext.setFilter(newfilter);
   ```
   
   Then I call next, and on the resulting cursor I add a filter that adds the memberOf attributes.
   
   Finally, I should apply the original ExprNode filter on the modified entry that now has memberOf. But I can't for the life of me figure out how to do that.
   
   Any help would be most welcome :-)
   
   Thanks,
   Arthur
   
   [MemberOfInterceptor.txt](https://github.com/apache/directory-server/files/3680570/MemberOfInterceptor.txt)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org