--On Tuesday, August 29, 2006 10:18 AM -0600 Philip Prindeville <[EMAIL PROTECTED]> wrote:

Hi.

I'm dealing with an LDAP server that answers queries with data
that has the objectClass attribute in no particular order, i.e. and
had a question for you all.

Is there an easy way to get the values of:

$mesg->entry(0)->get_value('objectClass')

into hierarchical sorted value?  I'm seeing returned values like:

iplanet-am-user-service, iplanet-am-managed-person, top,
iPlanetPreferences, person, inetuser, inetOrgPerson, inetAdmin,
organizationalPerson


which clearly isn't correct.  I figure that the Schema class probably
contains enough information in this to put things into the proper order
that the hierarchy implies.

(Of course, multiple inheritance makes things a little tricky...)

Reason is we want to be able to look at an object with a browser, and
go up the (objectClass) tree until we find a node on the tree that
(mostly)
knows how to render this object.

For instance, if we don't know how to render a node as an 'inetOrgPerson',
well, we could render it as an 'organizationalPerson' instead, etc.

Does it make sense to add a convenience wrapper that handles this logic
for us (and perhaps caches the schema conveniently to avoid having to
pull it down multiple times)?

Use OpenLDAP 2.3, and use the valsort attribute overlay, which was written exactly for this purpose. It lets you assign hidden "weights" to attributes so that the return order is guaranteed when the server is queried.

--Quanah


--
Quanah Gibson-Mount
Principal Software Developer
ITS/Shared Application Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

Reply via email to