[Zope-CMF] Better MemberData search for CMF
Florent Guillaume
fg at nuxeo.com
Thu Oct 30 12:04:35 EST 2003
Hi,
[Please keep zope-cmf at zope.org in all Ccs]
We need a better search API for searching members in CMF. I want to be
able to search on several attributes at the same time. I want to search
on all existing members. I want it to be efficient.
Currently CMF's MemberDataTool has
searchMemberData(search_param, search_term, attributes=())
but it can only do a search on one attribute. It returns a list of
dictionaries.
CMFLDAP's MemberDataTool inherits the one from CMF, and so actually does
the search only in cached members. This is a big problem for me.
Plone (in MembershipTool) has
searchForMembers(**kw)
that could search on arbitrary attributes but actually only does it on
name, email, roles, and last_login_time. It returns a list of user objects.
CMFLDAP's PloneLDAPMembershipTool seems to be more intelligent than its
MemberDataTool and do the full LDAP search, but I'm not sure.
I'd like to propose a standardized API on which we can agree for the future:
MemberDataTool:
searchForMembers(mapping, maybe_some_options=None, **kw)
It would search on all the keys of mapping+kw.
The options would be there to ask for a substring or exact match. To be
decided later.
I'd like it to return a list of users, but this may be problematic from
a security point of view. What do you think? Otherwise we could make it
take an attributes=('email', 'fullname') args, and return a dict with at
least the specified attributes.
A side problem is that this method will have to have knowledge of how to
do a search in the user folder. And there are lots of those, with
nowhere an standardized API in sight to do search either :-( (actually I
don't know any that can do a search appart from LDAPUserFolder). Maybe
we could take the oportunity to define one ? Searching for userids,
roles, groups (for me), is a prerequisite for me.
In any case I'm going to do what I outline above because I need it for
CPS. It would be nice if would could standardize the APIs and do a
minimal implementation in CMF Core/Default.
Thanks for your comments,
(please direct them to zope-cmf at zope.org)
Florent
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87 http://nuxeo.com mailto:fg at nuxeo.com
More information about the Zope-CMF
mailing list