Supply values to virtual attributes via plug-in?
Hi All,
is it possible, to write a plug-in, that creats values on the fly for a virtual attribute, i.e. when a search ocurs and all the attribute values are returned to a client, one ore more of the values a calculated by the plug-in depending on the dn of the returned record.
Which type of plug-in would that be? The documentation is a bit unclear on that ...
Any help and thoughts appreciated!
Cheers, Stefan!
[443 byte] By [
stefvienna] at [2007-11-26 9:12:07]

# 2
Hi,
yes, I actually checked already the CoS-docs, but it seems, as if CoS is only able to provide static values via the templates.
What I actually need to do, is to pull down attribute values from another LDAP-Server depending on the dn of an entry. I.e. each rocord would point to a different value. I would need to analyze the current dn, then generate the LDAP-URI and read the value of the referenced attribute and supply this to a virtual attribute. Think of it as a kind of flexible view spanning more then one server.
Now if I could hook up some code to a template, that would be great, but I don't think, that canbe done somehow ...
Cheers, Stefan!
# 3
Hi Stefan,
Did you ever figure this one out? If so, can you post the solution?
We have merged two attributes from our old schema into one attribute in our new schema, but it would be nice if we could provide the old attributes in the new schema as well -- but that would mean splitting apart the new attribute. I'm not so sure we can do this with CoS...
Thanks.
-lucas
lrucb at 2007-7-6 23:33:16 >

# 4
Hi Lucas,
CoS won't help you out on this, as it does not allow you to branch-/reach-out of your local server, but -
yep - I finally managed to create virtual attributes on the fly via a preoperation plug-in. Basically I extended the testpreop_send()-funtion of the testpreop.c example. This plug-in intercepts just before results get send to the client. You then have to check, whether it is a non-internal operation and the result of a search, then analyze the matching dn, whether this a resulkt you want to modify and finally use e.g. slapi_entry_add_values_sv() to add any Slapi_Entry you have created.
Be aware - the docs are somewhat sparse, crappy and often misleading ... you have been warned ;-)
Cheers, Stefan!